Tomcat 7 can not be stopped with enabled JMX.

119 views
Skip to first unread message

Dima Z

unread,
Dec 27, 2016, 4:56:49 AM12/27/16
to Codehaus Cargo
Hello Cargo team!

I have cargo configuration listed below.
When container is stopping every time I have exception java.rmi.server.ExportException 

<plugin>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-maven2-plugin</artifactId>
   <version>1.6.1</version>
   <executions>
      <execution>
         <id>start-container</id>
         <phase>pre-integration-test</phase>
         <goals>
            <goal>start</goal>
         </goals>
      </execution>
      <execution>
         <id>stop-container</id>
         <phase>post-integration-test</phase>
         <goals>
            <goal>stop</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <container>
         <timeout>${cargo.container.timeout}</timeout>
      </container>
      <configuration>
         <properties>
            <cargo.servlet.port>${service.port}</cargo.servlet.port>
            <cargo.tomcat.ajp.port>${ajp.port}</cargo.tomcat.ajp.port>
            <cargo.logging>medium</cargo.logging>
            <cargo.jvmargs>
               -Dcom.sun.management.jmxremote
               -Dcom.sun.management.jmxremote.port=10000
               -Dcom.sun.management.jmxremote.ssl=false
               -Dcom.sun.management.jmxremote.authenticate=false
               -Dspring.profiles.active=testMode,server
               -Xms1024m
               -Xmx2048m
               -XX:+UseParNewGC
               -XX:+UseConcMarkSweepGC
            </cargo.jvmargs>
         </properties>
      </configuration>
   </configuration>
</plugin>

This is output from console:


[INFO] --- cargo-maven2-plugin:1.6.1:stop (stop-container)
[INFO] [talledLocalContainer] Tomcat 7.x is stopping...
[INFO] [talledLocalContainer] Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 10000; nested exception is:
[INFO] [talledLocalContainer]   java.net.BindException: Address already in use: JVM_Bind


Is there something wrong?

Thanks for any helps!


Dima Z

unread,
Dec 27, 2016, 5:09:42 AM12/27/16
to Codehaus Cargo
Here is solution for this case:

<cargo.start.jvmargs>
   -Dcom.sun.management.jmxremote
   -Dcom.sun.management.jmxremote.port=10000
   -Dcom.sun.management.jmxremote.ssl=false
   -Dcom.sun.management.jmxremote.authenticate=false
</cargo.start.jvmargs>

You should have enabling JMX in cargo.start.jvmargs

S. Ali Tokmen

unread,
Dec 27, 2016, 9:49:50 AM12/27/16
to codehau...@googlegroups.com

Hi Dima

It's good you figured this out yourself :)

What would you think would help others most to avoid this?

  • Some text in the Codehaus Cargo Web page? If so, where?
  • A warning message that the Cargo Java code would show (would you think people read)?
    ... or other ideas?

Please advise

S. Ali Tokmen
http://ali.tokmen.com/
http://contact.ali.tokmen.com/
-- You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group. To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/03e5c71d-c67e-4472-9672-fdced12b35da%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

Dima Z

unread,
Dec 30, 2016, 9:35:28 AM12/30/16
to Codehaus Cargo

Hello Ali,

Thanks for your message.

I think this Cargo page is pretty clear [ https://codehaus-cargo.github.io/cargo/Configuration+properties.html ] about cargo.start.jvmargs
What I suggest is to have some logging information when the plugin is starting and when stopping about applied Java args if it's possible.

These logs can be displayed w/ Maven option -X  

What do you think?

S. Ali Tokmen

unread,
Dec 30, 2016, 10:36:31 AM12/30/16
to codehau...@googlegroups.com

Hi Dima

Thanks - Indeed what you point out about https://codehaus-cargo.github.io/cargo/Configuration+properties.html helps. I see the two properties are described one after the others, and hence don't need more documenting.

Would you then suggest to show a warning when strings such as -Dcom.sun.management.jmxremote or -Xmx are detected as cargo.jvmargs and suggest the usage of cargo.start.jvmargs instead?

-- You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group. To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/bc354c7d-1501-4dc5-b407-286effba465e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages