uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thilo Goetz <twgo...@gmx.de>
Subject Re: PEAR Classpath issues
Date Fri, 27 Jul 2012 06:24:43 GMT
On 26/07/12 18:17, Erik Fäßler wrote:
> Hi all,
> I know this question has been asked a few times in the past years but I didn't really
come to a definite answer or a solution to the problem. The issue is to use a PEAR packaged
simple AE in a pipeline without setting the classpath manually. On the contrary, my primary
goal is to make use of the PEAR isolation feature introduced in UIMA 2.2. 
> I created a very small example. My AE is a simple (non-aggregate) AE without dependencies
on any resources. It does only rely on the commons-lang3 library. The process method is this:
> public void process(JCas aJCas) throws AnalysisEngineProcessException {
> 		String[] mow = {"eins", "zwei", "drei"};
> 		System.out.println("wow: " + StringUtils.join(mow, " -- "));
> 	}
> My humble goal is to make a PEAR of this AE, to install it and let it run successfully
using the Cas Visual Debugger. I created an AE descriptor and placed it in the "desc" directory.
I copied the dependency JARs into the "lib" directory (using the Maven dependency plugin).
> I created the PEAR package manually by using the Eclipse PEAR plugin, not the Maven plugin.
I left the automatically created install.xml untouched:
> <?xml version="1.0" encoding="UTF-8"?>
> 	<OS>
> 		<NAME>Linux</NAME>
> 	</OS>
> 		<ID>peartest</ID>
> 		<NAME></NAME>
> 		<DESC>$main_root/desc/aeDescriptor.xml</DESC>
> 			<ACTION>set_env_variable</ACTION>
> 				<VAR_VALUE>$main_root/target/classes;</VAR_VALUE>
> 		</PROCESS>
> I did intentionally not include my libraries in the classpath here, because the documentation
> "The buildComponentClasspath method of the PackageBrowser class builds a classpath string
from what it finds in the CLASSPATH specification here, plus adds a classpath entry for all
Jars in the lib directory. Because of this, there is no need to specify Class Path entries
for Jars in the lib directory."

If the documentation still says that, I think it's outdated.  I'm pretty
sure we changed this defaulty behavior at some point.

> I created the PEAR package and then used the runPearPackage.sh script to install it,
which went fine. Then I hit the button to test the AE with CVD and got this exception:
> 26.07.12 18:00:13 - 10: org.apache.uima.tools.cvd.MainFrame.handleException(529): SCHWERWIEGEND:
> java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
> 	at de.julielab.peartest.PearTestAE.process(PearTestAE.java:38)
> 	at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:377)
> 	at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:295)
> 	at org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:339)
> 	at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> 	at org.apache.uima.tools.cvd.MainFrame.internalRunAE(MainFrame.java:1506)
> 	at org.apache.uima.tools.cvd.MainFrame.runAE(MainFrame.java:430)
> 	at org.apache.uima.tools.pear.install.InstallPear$2.run(InstallPear.java:448)
> 	at java.lang.Thread.run(Thread.java:680)
> Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
> 	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 java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at org.apache.uima.internal.util.UIMAClassLoader.loadClass(UIMAClassLoader.java:151)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 10 more
> When I - for a test - add the path for the used library manually to the install.xml (which
then reads: "$main_root/lib/commons-lang-2.4.jar;"), the CVD runs smoothly without exception.
I.e. the library is there and working.

Good, then everything is as expected.

> Have I done something completely wrong? Shouldn't the CVD - and later then, the runCPE.sh
script - automatically add the libraries in the lib/ directory of a PEAR automatically to
create an isolated PEAR runtime?
> And one fall-back-question: In case I would just add all my libraries manually into the
install.xml, would I still get the PEAR isolation?

I think the answer to that is "yes", but I'm not sure I really
understand your question.


> Thanks for your time,
> 	Erik

View raw message