Trouble getting sample broker to connect to local server

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble getting sample broker to connect to local server

bornxfree
I will (hopefully) be using this software to teach a class on sustainable energy systems starting in about two weeks, but so far this summer I've been unable to get any sample brokers running.  Just as a disclaimer, I am not very familiar with Java, and even less so with Maven, so it is possible that my issue is very simple and I just don't know it.

Here are the details:
I downloaded sample-broker-1.6.0 and server-distribution-release-1.6.0.  I ran mvn clean test on both, and both say that they've built just fine and failed no tests.  I have two command lines open, one for each.  When I use the command 'mvn -P web2' on the server, it starts without a problem, and I'm able to access the visualizer.  I also ran a bootstrapping session to get some initial data, and that seems to work without issue as well.  The only problem I have is with the broker.

I have tried everything I know to try and googled everything I know to google.  I made sure the broker name was consistent in both the properties file and the pom.xml file.  When I use the command 'mvn compile exec:exec' and just 'mvn exec:exec' from the sample-broker directory, I get the following:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.powertac:Sample >-------------------------
[INFO] Building Sample 1.6.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) @ Sample ---
<options
/>
Starting session 1
  name=Sample
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:804)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:751)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:313)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:567)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.758 s
[INFO] Finished at: 2019-08-07T08:46:41-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (default-cli) on project Sample: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [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

I have been able to find almost no helpful information on that error.  All I can gather is that it is something to do with Maven rather than the broker itself, but I am entirely at a loss.  Please let me know if anyone can point me in the right direction.  Also, if more information is needed, just tell me what else you need to see and I'll be more than happy to provide all the details I can.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

grampajohn
Administrator
Hello -

This is indeed a bizarre error, and as you say, quite free of helpful information. I have never seen anything quite like this.

At this point, I know what you tried to do, and it should just work, but I don't know anything about the environment you are doing it in. My environment is Linux, and many of us use the Power TAC system on Mac and Windows machines.

Could you please give us info on your machine, operating system and version, and the versions of Java and Maven you are using? The error seems to be arising inside Maven in the context of the exec:exec command.

For reference, here is what I see on my machine:
jcollins@hazel:~/bin$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

jcollins@hazel:~/bin$ mvn --version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 1.8.0_101, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-55-generic", arch: "amd64", family: "unix"
I hope we can find an easy fix for you once we have a bit more info.

Cheers -

John

bornxfree wrote
I will (hopefully) be using this software to teach a class on sustainable energy systems starting in about two weeks, but so far this summer I've been unable to get any sample brokers running.  Just as a disclaimer, I am not very familiar with Java, and even less so with Maven, so it is possible that my issue is very simple and I just don't know it.

Here are the details:
I downloaded sample-broker-1.6.0 and server-distribution-release-1.6.0.  I ran mvn clean test on both, and both say that they've built just fine and failed no tests.  I have two command lines open, one for each.  When I use the command 'mvn -P web2' on the server, it starts without a problem, and I'm able to access the visualizer.  I also ran a bootstrapping session to get some initial data, and that seems to work without issue as well.  The only problem I have is with the broker.

I have tried everything I know to try and googled everything I know to google.  I made sure the broker name was consistent in both the properties file and the pom.xml file.  When I use the command 'mvn compile exec:exec' and just 'mvn exec:exec' from the sample-broker directory, I get the following:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.powertac:Sample >-------------------------
[INFO] Building Sample 1.6.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) @ Sample ---
<options
/>
Starting session 1
  name=Sample
[ERROR] Command execution failed.
.....

I have been able to find almost no helpful information on that error.  All I can gather is that it is something to do with Maven rather than the broker itself, but I am entirely at a loss.  Please let me know if anyone can point me in the right direction.  Also, if more information is needed, just tell me what else you need to see and I'll be more than happy to provide all the details I can.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

bornxfree
Thank you so much for your quick reply!  We're definitely using different versions of Java, but the Maven versions are pretty close.  Here is my version output:

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T15:00:29-04:00)
Maven home: C:\Users\Rusti\Desktop\Research\Teaching\SustainableEnergyCourse\apache-maven-3.6.1\bin\..

Java version: 12.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-12.0.1
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I'll track down the same builds you're using and test it again, and update you as soon as I see what it does.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

grampajohn
Administrator
It's possible your problem is related to Java version incompatibilities. I'm still using Java 8, and all the libraries used by the sample broker are built with Java 8. Support for Java 8 has ended; I've created an issue to track the upgrade to Java 11 LTS (not Java 12) because of the disruption potential with frequent upgrades.

I will try to find time soon to install Java 11 LTS on my machine and see if I can reproduce your problem. Unfortunately I won't have time to work on this until Friday. Of course, this may not solve your problem, and I'm sorry for the inconvenience. Perhaps Erik or Fred would have time to look into this in the meantime?

Cheers -

John
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

bornxfree
I appreciate it.  I got Maven 3.6.0 running just fine, but now I've run into a new problem.  I went to the Java archives and tried installing both JRE 1.8.0_101 and JDK 1.8.0_101.  I set my environment variables to the correct values, but even when JDK 1.8.0_101 was the only Java installed on my machine, I got:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.powertac:Sample >-------------------------
[INFO] Building Sample 1.6.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ Sample ---
[INFO] Deleting C:\Users\Rusti\Desktop\PowerTACtest\sample-broker-1.6.0\target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-versions) @ Sample ---
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ Sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ Sample ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to C:\Users\Rusti\Desktop\PowerTACtest\sample-broker-1.6.0\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.494 s
[INFO] Finished at: 2019-08-07T15:18:00-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project Sample: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[ERROR] -> [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/MojoFailureException

However, my Java and Maven versions are

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: C:\Users\Rusti\Desktop\Research\Teaching\SustainableEnergyCourse\apache-maven-3.6.0\bin\..
Java version: 1.8.0_101, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_101
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

grampajohn
Administrator
bornxfree wrote
I appreciate it.  I got Maven 3.6.0 running just fine, but now I've run into a new problem.  I went to the Java archives and tried installing both JRE 1.8.0_101 and JDK 1.8.0_101.  I set my environment variables to the correct values, but even when JDK 1.8.0_101 was the only Java installed on my machine, I got:

...
Java version: 1.8.0_101, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_101
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Your problem is that Maven is using the JRE, not the JDK. You can see that above -- "Java(TM) SE Runtime Environment (build 1.8.0_101-b13)". You need to set your JAVA_HOME to the JDK rather than the JRE.

Cheers -

John
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

bornxfree
Ah, I finally got it all set up and was able to compile and run the broker.  Thank you for your help!  This will be a wonderful teaching tool this fall!
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

mnayeem
In reply to this post by grampajohn
Same issue I am going through last two weeks-
For Sample broker
mvn exec:exec -Dexec.args="--repeat-count 50"
 Session starts but sample broker can't connect to default broker ! Can anyone help me with that?


Java & Maven version in my system are -
[09:39, 09/05/2021] Nayeem_REM: java version "16.0.1" 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

[09:39, 09/05/2021] Nayeem_REM: Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Program Files\apache-maven-3.8.1\bin\..
Java version: 16.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-16.0.1
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

grampajohn
Administrator
Good morning. I see you are using Java 16. I've never tried that, has anyone else? To my knowledge the current "stable" version of Java is 11, which is what we use to build and test the system. When we run it, we get warnings that some of the things the server is doing will "soon" be considered to be errors. What do you see when you start the server? When I start the server I see this:
---
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
---
John
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

grampajohn
Administrator
In reply to this post by mnayeem
One more thing to look at --

The server and broker both generate log files when they run. The broker logs are in the sample-broker/log directory, and if you are using the web interface, the server logs are in server-distribution/files/admin/log.

Each time you run a session in either the server or broker, you get a state log and a trace log. Please look in the trace logs of both the server and broker and see if the string "ERROR" occurs. If it does, please let us know what the errors are.

John
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

mnayeem
In reply to this post by grampajohn
After installing JDK 11, Sample Broker is connected to Default Broker.


Thanks a lot, John!
Best Wishes.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting sample broker to connect to local server

grampajohn
Administrator
I'm glad we found a solution. I've create Issue #1090 to track this problem.

John