Description
JRebel 6 introduced a new 'JRebel 6 agent' that uses a native library and requires a different command line parameter. The old agent is now called the "legacy" agent.
The problem: JRebel fails to start when our -Djrebel variable (which triggers the JRebel profile from the project pom) is combined with the new command line parameter .
To reproduce, start the archetype with the new JRebel agent plus the -Djrebel flag:
mvn -Pcargo.run -Dcargo.jvm.args="-agentpath:$REBEL_HOME/lib/libjrebel64.so" -Djrebel
(the exact agentpath parameter differs per OS: see http://manuals.zeroturnaround.com/jrebel/misc/upgrade-core.html)
Expected: the archetype starts up and uses the JRebel 6 agent if that's available, otherwise it falls back to the legacy agent.
Actual: the archetype fails to start up, and logs the following stacktrace:
Exception in thread "main" java.lang.reflect.InvocationTargetException
[INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:483)
[INFO] [talledLocalContainer] at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
[INFO] [talledLocalContainer] at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
[INFO] [talledLocalContainer] Caused by: java.lang.NoSuchMethodError: com.zeroturnaround.javarebel.os.d(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
[INFO] [talledLocalContainer] at com.zeroturnaround.javarebel.aom.<clinit>(SourceFile:74)
[INFO] [talledLocalContainer] at com.zeroturnaround.javarebel.axU.premain(SourceFile:82)
[INFO] [talledLocalContainer] ... 6 more
[INFO] [talledLocalContainer] Aborted
The problem is that the 'jrebel' profile in the project pom adds a '-javaagent' parameter. When both the -javaagent and -agentpath parameter are used, JRebel fails to start.
A simple workaround is to not add the -Djrebel flag when starting Tomcat. But since all Hippo+JRebel users are very much used to doing this, many users may be confused by the clash.