Hi all
We are having trouble adding jars to the CLASSPATH using mvn exec:java.
Here's the story:
We have a project that is basically a platform for executing contributed
code. There's more to it of course, but that's the part of it we are
having trouble with. Basically, users send our servers messages
(RabbitMQ) that include the names of classes to instantiate and methods
to execute. The code is in jar files that do live in our maven
repository. We have been trying to run our code using mvn exec, for example
mvn -X-e exec:java
-Dexec.mainClass=org.renci.databridge.engines.relevance.RelevanceEngine
-Dexec.additionalClasspathElements="/projects/databridge/howard/repository/org/renci/databridge/contrib/similarity/mocksimilarity/1.0-BETA/mocksimilarity-1.0-BETA.jar"
-Dexec.classpathScope=runtime
but we can't instantiate the class. Here's an example trace:
Jan 30, 2015 11:03:44 AM
org.renci.databridge.engines.relevance.RelevanceEngineMessageHandler
processCreateSimilarityMessage
SEVERE: Can't instantiate class
org.renci.databridge.contrib.similarity.mocksimilarity.MockSimilarity
java.lang.ClassNotFoundException:
org.renci.databridge.contrib.similarity.mocksimilarity.MockSimilarity
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at
org.renci.databridge.engines.relevance.RelevanceEngineMessageHandler.processCreateSimilarityMessage(RelevanceEngineMessageHandler.java:76)
at
org.renci.databridge.engines.relevance.RelevanceEngineMessageHandler.handle(RelevanceEngineMessageHandler.java:56)
at
org.renci.databridge.engines.relevance.RelevanceEngineMessageListener.run(RelevanceEngineMessageListener.java:119)
I don't think it's the code, because if I put a dependency in the pom it
does work, but we don't want to do that. Maybe it's a bad idea to try
to run this through mvn, but it does seem like there should be some way
to add jars to the maven runtime class path without adding to the pom.
Of course, it's also possible the problem isn't in maven.
Any suggestions (other than RTFM!) would be helpful.
Thanks
Howard
--
Howard Lander <mailto:[email protected]>
Senior Research Software Developer
Renaissance Computing Institute (RENCI) <http://www.renci.org>
The University of North Carolina at Chapel Hill
Duke University
North Carolina State University
100 Europa Drive
Suite 540
Chapel Hill, NC 27517
919-445-9651