Hi,
Is it possible to inject a *.jar jmon which references third party jars? As jar's are not able to contain other *.jars i followed the following steps but it failed:
1. Wrote a simple Jmon *.jar and inserted it correctly into the correlator running the -j option. -> Worked
2. Added a reference to a class from a third party *.jar. I compiled and created my *.jar -> Worked
3. Started the correlator with -j option and -J "-classpath=/somedirectoryContainingJars" -> worked
4. Injected my *updated* jar with references to classes located in a *.jar in the /somedirectoryContainingJars directory and the correlator spat out a ClassNotFoundException exception (below)
4.5: I moved the third party jars to the $APAMA_HOME/lib too in case it could just load all jars by default from there but again this failed.
Surely the purpose of writting jmon code is so that we can have custom java code running in the correlator's JVM so i'm just wondering the correct way of ensuring my third party *.jar files are correctly loaded so my jmon would recognise the classes i reference?
Thanks in advance
Antoine
2011-11-04 14:40:16.390 INFO [139770704410368] - Injected JMon application JMSClientMon, size 2594 bytes, injection time 0.07 seconds
2011-11-04 14:40:16.391 INFO [139770705463040] - Sender engine_inject (0x1fa42c0) (component ID 5670980397611286784/5670980397611286784) disconnected cleanly: Other party requested disconnection
2011-11-04 14:40:16,392 WARN [ApamaProcessing] - JMonApplicationClassLoader.findClass(String) - ClassNotFoundException - could not find class in either JMon or parent ClassLoader for name: com.rt.jms.JMSClient
2011-11-04 14:40:16,392 WARN [ApamaProcessing] - JMonApplicationClassLoader.initApp() - Failed to instantiate monitor class. Detail: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.apama.jmon.internal.JMonApplicationClassLoader.initApp(JMonApplicationClassLoader.java:647)
Caused by: java.lang.NoClassDefFoundError: com/rt/jms/JMSClient
at JMSClientMon.onLoad(JMSClientMon.java:25)
... 5 more
Caused by: java.lang.ClassNotFoundException: com.rt.jms.JMSClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at com.apama.jmon.internal.JMonApplicationClassLoader.findClass(JMonApplicationClassLoader.java:431)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.apama.jmon.internal.JMonApplicationClassLoader.loadClass(JMonApplicationClassLoader.java:361)
... 6 more
2011-11-04 14:40:16,393 ERROR [ApamaProcessing] - JMonApplicationClassLoader.initApp() - trapped an unexpected exception while calling an onLoad() method on a JMon application. The Application will be deleted.
You need to use -J "-Djava.clsss.path=..."
You will need to include $apama_home/lib/jplugin_internal4.x.jar in the path
Hi Gregg,
Thanks for your reply, that worked a charm.
In case anyone uses this as a resource it appears that its the jmon_internal4.x.jar which is required (jplugin may have been a typo?), and classpaths can be delimited by ':'
-J "-Djava.clsss.path=$apama_home/lib/jplugin_internal4.x.jar:/sampleDir/sample.jar"
Regards
Antoine