Details
-
Task
-
Resolution: Won't Do
-
Major
-
None
-
7.0.2.Final
-
None
Description
We are injecting code (like a profiler) using the JVMTI interface. Normally, we use the JVM options -Xbootclasspath and -agentpath to get our code running, like so:
set JAVA_OPTS=-Xmx1024m -Xms1024m -Xbootclasspath/a:C:\\Panorama\\hedzup\\mn\\lib\\awcore
JIDAcore.jar -agentpath:C:\\Panorama\\hedzup\\mn\\bin
AwProfile.dll=verbose -Dpanorama.jida.instance=jboss-1
With JBoss 7, we get a NoClassDefFoundError:
Exception in thread "main" java.lang.NoClassDefFoundError: com/altaworks/da/jida/AwMisc
at org.jboss.as.server.Main.main(Main.java)
. . .
This is the exact same kind of error that we used to get with OSGI before we modified our code to account for it - in that case we had to inject our package name into the list of packages that OSGI would search the bootclass path for. As we discussed on the phone today (Rich S), this is likely a similar class loader issue that we're running into with the new JBoss Modules. I can tell that we are successfully using JVMTI to inject our code. The problem is that the injected code, as it runs, tries to access classes in our package (com.altaworks.*) which are in our JIDAcore.jar file – but due to the new class loading scheme, it's unable to find those classes.
How I reproduce this problem:
1. [download and unzip jboss-as-7.0.2.Final.zip]
2. SET JAVA_OPTS=... (as above)
3. standalone.bat
============[ Full Error from startup ] ================
16:53:41.91> standalone.bat
Calling C:\Documents and Settings\dchestnutt\My Documents\Downloads\jboss-as-7.0
.2.Final\jboss-as-7.0.2.Final\bin\standalone.conf.bat
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: C:\Documents and Settings\dchestnutt\My Documents\Downloads\jboss-
as-7.0.2.Final\jboss-as-7.0.2.Final
JAVA: C:\Progra~1\Java\jdk1.6.0_25\bin\java
JAVA_OPTS: -Dprogram.name=standalone.bat -Xmx1024m -Xms1024m -Xbootclasspath/a
:C:\\Panorama\\hedzup\\mn\\lib\\awcore
JIDAcore.jar -agentpath:C:\\Panorama
he
dzup\\mn\\bin
AwProfile.dll=verbose -Dpanorama.jida.instance=jboss-1 -server
===============================================================================
**set CODE_SIZE_LIMIT = 8
OPNET JIDA jvmti monitoring initialized
-
-
-
-
- Panorama JIDA configuration enhanced for your monitoring pleasure *****
-
-
-
- C:\Panorama\hedzup\mn/lib/awapp/JIDAapp.jar added to system classpath
Minimum active percentage for metrics set to 1.0
Minimum duration percentage for metrics set to 2.0
AwLogFile: Logger is using properties file C:/Panorama/hedzup/mn/data/DA-JIDA_jb
oss-1_logger.properties
logging verbosity changed to 0
16:53:51,761 INFO [org.jboss.modules] JBoss Modules version 1.0.2.GA
Exception in thread "main" java.lang.NoClassDefFoundError: com/altaworks/da/jida
/AwMisc
at org.jboss.as.server.Main.main(Main.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.modules.Module.run(Module.java:272)
at org.jboss.modules.Main.__AW_main(Main.java:313)
at org.jboss.modules.Main.main(Main.java)
Caused by: java.lang.ClassNotFoundException: com.altaworks.da.jida.AwMisc from [
Module "org.jboss.as.server:main" from local module loader @3c0007 (roots: C:\Do
cuments and Settings\dchestnutt\My Documents\Downloads\jboss-as-7.0.2.Final\jbos
s-as-7.0.2.Final\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:
191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(Concu
rrentClassLoader.java:361)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(Concu
rrentClassLoader.java:333)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentCl
assLoader.java:310)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoad
er.java:103)
... 8 more