1

我正在尝试阅读本指南

https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/java-client-sample

我在“运行客户端”步骤,特别是第 4 步到第 8 步。我运行 mvn validate build success,

我运行 mvn install build 成功,

我运行 mvn exec:exec Build Failure 并出现以下错误

> C:\Users\tbh38\Desktop\Coding Files\AVSFiles\samples\javaclient>mvn exec:exec -e

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Alexa Voice Service Sample Java Client 20160207.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) @ sample-java-client ---
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Exception in thread "main" javax.json.stream.JsonParsingException: Unexpected char 85 at (line no=7, column no=27, offset=167)
        at org.glassfish.json.JsonTokenizer.unexpectedChar(JsonTokenizer.java:532)
        at org.glassfish.json.JsonTokenizer.unescape(JsonTokenizer.java:231)
        at org.glassfish.json.JsonTokenizer.readString(JsonTokenizer.java:184)
        at org.glassfish.json.JsonTokenizer.nextToken(JsonTokenizer.java:376)
        at org.glassfish.json.JsonParserImpl$ObjectContext.getNextEvent(JsonParserImpl.java:261)
        at org.glassfish.json.JsonParserImpl$StateIterator.next(JsonParserImpl.java:172)
        at org.glassfish.json.JsonParserImpl.next(JsonParserImpl.java:149)
        at org.glassfish.json.JsonReaderImpl.readObject(JsonReaderImpl.java:177)

        at org.glassfish.json.JsonReaderImpl.readObject(JsonReaderImpl.java:184)

        at org.glassfish.json.JsonReaderImpl.readObject(JsonReaderImpl.java:103)

        at com.amazon.alexa.avs.config.DeviceConfigUtils.readConfigFile(DeviceConfigUtils.java:60)

        at com.amazon.alexa.avs.config.DeviceConfigUtils.readConfigFile(DeviceConfigUtils.java:46)

        at com.amazon.alexa.avs.AVSApp.<init>(AVSApp.java:79)
        at com.amazon.alexa.avs.AVSApp.main(AVSApp.java:74)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.279 s
[INFO] Finished at: 2016-07-14T09:50:07-04:00
[INFO] Final Memory: 11M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project sample-java-client: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project sample-java-client: Command execution failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution failed.
        at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:362)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:610)

        at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:352)... 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
> 
> Blockquote

我的 pom.xml 文件看起来像

   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.amazon.alexa.avs</groupId>
  <artifactId>sample-java-client</artifactId>
  <version>20160207.0</version>
  <packaging>jar</packaging>
  <name>Alexa Voice Service Sample Java Client</name>
  <url>https://developer.amazon.com/appsandservices/solutions/alexa/alexa-voice-service</url>

  <properties>
    <jetty.version>9.3.7.v20160115</jetty.version>
    <!-- The latest version of alpn-boot that supports JDK 1.8.0_71 through 1.8.0_74 -->
    <!-- To override, pass -Dalpn-boot.version=YOUR_VERSION when running "mvn install" and "mvn exec:exec" -->
    <!-- Your version can be determined here: http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-versions -->
    <alpn-boot.version>8.1.8.v20160420</alpn-boot.version>
    <slf4j.version>1.7.10</slf4j.version>
    <log4j.version>2.3</log4j.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.9</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.4</version>
    </dependency>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.3.1</version>
    </dependency>
    <dependency>
      <groupId>uk.co.caprica</groupId>
      <artifactId>vlcj</artifactId>
      <version>2.4.1</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.json</artifactId>
      <version>1.0.4</version>
    </dependency>
    <dependency>
      <groupId>javazoom</groupId>
      <artifactId>jlayer</artifactId>
      <version>1.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.mortbay.jetty.alpn</groupId>
      <artifactId>alpn-boot</artifactId>
      <version>${alpn-boot.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>1.9.13</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>${log4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j.version}</version>
    </dependency> 
    <!-- Jetty 9.3.7-SNAPSHOT -->
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-alpn-client</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-http</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.http2</groupId>
      <artifactId>http2-client</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.http2</groupId>
      <artifactId>http2-http-client-transport</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.http2</groupId>
      <artifactId>http2-hpack</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.http2</groupId>
      <artifactId>http2-common</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-security</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-util</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-io</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-client</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <!-- Don't filter the mp3 files or they'll get corrupted -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/*.mp3</include>
        </includes>
      </resource>
    </resources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.3</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.2.1</version>
          <configuration>
            <executable>java</executable>
            <arguments>
              <argument>-Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn-boot.version}/alpn-boot-${alpn-boot.version}.jar</argument>
              <argument>-Dlog4j.configurationFile=file:///${basedir}/log4j2.xml</argument>
              <argument>-classpath</argument>
              <classpath/>
              <argument>-Djna.library.path=${env.VLC_PATH}</argument>
              <argument>com.amazon.alexa.avs.AVSApp</argument>
            </arguments>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

到目前为止,我已经尝试了 1.8u71 和 1.8u74 的不同版本的 JDK,我尝试在 mvn install 和 mvn exec:exec 之后使用命令“-Dalpn-boot.version=YOUR_VERSION”。我还从头开始重新启动了这个示例项目,并以同样的错误告终。

可悲的是,我对所有这一切仍然很陌生,并且在如何处理错误方面已经停滞不前。任何帮助表示赞赏。

4

0 回答 0