question

Chris Meola avatar image
Chris Meola asked

Trouble with mvn exec:java using companionService

Hi - I'm having trouble getting the java client to execute. Everything seems to be in order and the companionService is running. mvn install shows build success, but when I run: mvn exec:java numerous errors are returned. The stack trace is: C:\AVS\javaclient>mvn exec:java [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Alexa Voice Service Sample Java Client 1.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ sample-java-client --- Qt: Untested Windows version 10.0 detected! [WARNING] java.lang.reflect.InvocationTargetException 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:497) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) at java.lang.Thread.run(Thread.java:745) Caused by: javax.json.stream.JsonParsingException: Unexpected char 65 at (line no=7, column no=22, offset=152) 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:48) at com.amazon.alexa.avs.AVSApp. (AVSApp.java:63) at com.amazon.alexa.avs.AVSApp.main(AVSApp.java:58) ... 6 more [WARNING] thread Thread[Java Sound Event Dispatcher,5,com.amazon.alexa.avs.AVSApp] was interrupted but is still alive after waiting at least 15000msecs [WARNING] thread Thread[Java Sound Event Dispatcher,5,com.amazon.alexa.avs.AVSApp] will linger despite being asked to die via interruption [WARNING] NOTE: 1 thread(s) did not finish despite being asked to via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied. [WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=com.amazon.alexa.avs.AVSApp,maxpri=10] java.lang.IllegalThreadStateException at java.lang.ThreadGroup.destroy(ThreadGroup.java:778) at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:328) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 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:497) 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) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 18.916 s [INFO] Finished at: 2015-12-25T11:08:10-08:00 [INFO] Final Memory: 9M/22M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project sample-java-client: An exception occured while executing the Java class. null: InvocationTargetException: Unexpected char 65 at (line no=7, column no=22, offset=152) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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 ===end I'm not familiar with java so I'm having trouble debugging this. I can execute mvn with the -X switch if necessary, but maybe this is enough information to troubleshoot. Any help is greatly appreciated. Chris
alexa voice service
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Chris Meola avatar image
Chris Meola answered
Solved. I was using relative paths in the config.json file. I checked the json formatting/validator tool online ( https://jsonformatter.curiousconcept.com/) and it revealed the error in the format. Once I included absolute paths with a double backslash because the single backslash is interpreted as another character, i.e. (C:\\AlexaWeb..\\javaclient) everything worked perfectly. HTH
10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

javaDev avatar image
javaDev answered

Thanks Chris. Even I had same issue and I was just sitting on it for couple of hours. If we see the exception carefully we will notice that it is clearly telling the issue.

Unexpected char 33 at (line no=4, column no=19, offset=152

When i used JSON formatter I was able to see clearly the issue with JSON format.

10 |3000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.