You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Lothar Diefenbaker <ja...@gmail.com> on 2015/05/22 15:36:32 UTC

Problem with Eclipse and UIMA

Hello Everyone,

 I recently become involved in a project with Apache UIMA. As I was totally
unfamiliar with it as I was to eclipse, so I started reading the
documentation from the very beginning and I try to follow the tutorials.
But a problem came up when I tried to configure Eclipse to work with UIMA.
I installed the UIMA plugins for eclipse from
http://www.apache.org/dist/uima/eclipse-update-site, I followed all the
steps in order to set it up, I added my UIMA_HOME to the Java Build Path in
Eclipse. I imported the uimaj-examples but I cannot run them, when I tried
to run any of the tools I get the Error: Could not find or load main class
org.apache.uima.tools.AnnotationViewerMain (for example this happens when I
tried to run the Annotation Viewer). I know this seems to be a path
problem, so I checked the build path of the project and it does includes
everything in my installation of UIMA, the lib is there with the jar of the
tools. My environment variables of %UIMA_HOME%, %JAVA_HOME% exist and they
hold as value the path of UIMA and JAVA respectively. I also included the
lib directory of uima to the %CLASSPATH%, and the bin and lib directories
of the uima to the %PATH%.

 I tried to make the tutorial of “My first Annotator”, I created the
project RoomNumberAnnotator and followed the tutorial step by step. But at
the end when I tried to test it with the UIMA CAS Visual Debugger again I
only got Error: Could not find or load main class
org.apache.uima.tools.cvd.CVD since I cannot run the SDK tools from
eclipse. I ran from the CVD from the console and it worked, and I loaded
the analysis engine of RoomNumberAnnotator and it worked. Nevertheless I
still cannot make it work from eclipse.

 I looked for information about this and I didn't find much, which makes me
think it's something too basic to solve to require help. Anyway I've been
stuck with these days checking what can be wrong with my configurations of
java, eclipse, and classpaths. Please If someone could help me with some
advise or hint to solve these it would be much appreciated.

 I'm running Eclipse Luna 4.4.2 with EMF tools and Maven (m2e), JDK
1.7.0_79, UIMA 2.7, all these over Ubuntu 14.

Re: Problem with Eclipse and UIMA

Posted by Marshall Schor <ms...@schor.com>.
>From the trace it looks like the classpath you're running with is missing the
main UIMA core jar. 

I assume you're launching from Eclipse.  Please check the classpath used when
launching to insure it has the UIMA core jar.

-Marshall

On 6/3/2015 2:21 AM, molly wrote:
> Hi Marshall,
>
> I have a similar issue. I followed
> http://uima.apache.org/doc-uima-annotator.html example. I added the
> uimaj-examples, too.
> When I add "uimaj-tools" as you suggedsted, I get following erroe:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/uima/internal/util/CommandLineParser
> 	at org.apache.uima.tools.cvd.CVD.createCmdLineParser(CVD.java:89)
> 	at org.apache.uima.tools.cvd.CVD.main(CVD.java:131)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.uima.internal.util.CommandLineParser
> 	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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> 	... 2 more
>
> Any idea what can be the issue?
>
> Thanks
>
>
>
>
>
>
>


Re: Problem with Eclipse and UIMA

Posted by molly <ms...@cs.ucr.edu>.
Hi Marshall,

I have a similar issue. I followed
http://uima.apache.org/doc-uima-annotator.html example. I added the
uimaj-examples, too.
When I add "uimaj-tools" as you suggedsted, I get following erroe:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/uima/internal/util/CommandLineParser
	at org.apache.uima.tools.cvd.CVD.createCmdLineParser(CVD.java:89)
	at org.apache.uima.tools.cvd.CVD.main(CVD.java:131)
Caused by: java.lang.ClassNotFoundException:
org.apache.uima.internal.util.CommandLineParser
	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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 2 more

Any idea what can be the issue?

Thanks







Re: Problem with Eclipse and UIMA

Posted by Mandy Neumann <ma...@gesis.org>.
Lothar Diefenbaker <ja...@...> writes:
> 
> Hello Marshall,
> 
> Thank you very much for your help and answer, sorry I didn't answer before.
> Your assupmtions were correct, I downloaded the binary package and I try to
> import the uimaj-examples into Eclipse, the problem was exactly the same as
> Molly's.
> 
> I tried to run them from eclipse, if I run the jars from the command line
> they work fine. I did ran the script to adjust the paths, and both the
> JAVA_HOME and the UIMA_HOME are set as environment variables. I had already
> tried add the uima-tools jar file as a external jar, yet with no results,
> I'll try that again.
> 
> Anyway what finally worked for me was to download the UIMA source
> distibution and build it. I tried building it with maven from command line;
> I also imported it as a maven project to build it on Eclipse and they both
> seemed to work. I'm now able to run the tools and examples from eclipse.
> 
> Again I thank you very much for your help and interest ;)
> Lothar

Hello Lothar,

I have the exact same issues as you had when you asked here. I'm not able to
run any of the launch configurations of UIMA in eclipse...

Obviously you found a workaround, but I don't quite understand what you did,
because I'm not very familiar with maven. Could you please explain in detail
what you did to "build the UIMA source distribution"? Did you import the
whole source into eclipse (that would be a lot of projects)?

Best,
Mandy



Re: Problem with Eclipse and UIMA

Posted by Lothar Diefenbaker <ja...@gmail.com>.
Hello Marshall,

Thank you very much for your help and answer, sorry I didn't answer before.
Your assupmtions were correct, I downloaded the binary package and I try to
import the uimaj-examples into Eclipse, the problem was exactly the same as
Molly's.

I tried to run them from eclipse, if I run the jars from the command line
they work fine. I did ran the script to adjust the paths, and both the
JAVA_HOME and the UIMA_HOME are set as environment variables. I had already
tried add the uima-tools jar file as a external jar, yet with no results,
I'll try that again.

Anyway what finally worked for me was to download the UIMA source
distibution and build it. I tried building it with maven from command line;
I also imported it as a maven project to build it on Eclipse and they both
seemed to work. I'm now able to run the tools and examples from eclipse.

Again I thank you very much for your help and interest ;)
Lothar

On Sun, May 24, 2015 at 7:08 AM, Marshall Schor <ms...@schor.com> wrote:

> Hi,
> Sorry to hear of the startup troubles; I think they can be quickly
> solved.  Here
> are some suggestions.
>
> The bottom line - I think the directions were written assuming you have two
> Eclipse projects in your workspace, one for the uimaj-examples, and one
> for the
> uimaj-tools itself.  This would be the case if you downloaded the source
> distribution, unzipped (or untarred) it, and then used the Eclipse Import
> to
> "import existing Maven projects".
> But there's a work around.  Please read on...
>
> When you say you cannot run them, are you trying to run them via Eclipse
> (run
> menu), or the command line?
>
> It sounds like you may have downloaded the UIMA Java SDK "binary" package
> and
> unzipped or untarred it, is that correct?
> Or did you download the source code, import it into Eclipse, and "built"
> it?
>
> I'm guessing you may have done the "binary" package.  In that case there
> are a
> couple of steps to do, described in the binary distribution's README -
> scroll
> down to the part about setting the Environment Variables JAVA_HOME and
> UIMA_HOME, and running UIMA_HOME/bin/adjustExamplesPaths.bat (or .sh if on
> linux).
>
> I know you said you set UIMA_HOME as an "Eclipse" variable, but did you
> also set
> it as an environment variable?
>
> If you're running from Eclipse, go to the run configuration ( menu -> run
> -> run
> configurations) and pick a tool, say for instance, the UIMA Document
> Analyzer,
> and click it once to "open" it.  Then look at the "classpath" tab.  On my
> installation, it shows under "User Entries" two projects:  "uimaj-tools"
> and
> "uimaj-examples".  I suspect you only have an Eclipse Project for
> "uimaj-examples", and are missing the one for uimaj-tools.
>
> You can fix this by clicking on "User Entries", and then on the right on
> "Add
> External Jars", and there add the uimaj-tools jar from the lib directory
> in the
> unzipped UIMA Binary distribution.
>
> If I've made wrong guesses about the details of your situation, please
> respond
> back with the corrected details :-)
>
> Good Luck! -Marshall
>
> On 5/22/2015 9:36 AM, Lothar Diefenbaker wrote:
> > Hello Everyone,
> >
> >  I recently become involved in a project with Apache UIMA. As I was
> totally
> > unfamiliar with it as I was to eclipse, so I started reading the
> > documentation from the very beginning and I try to follow the tutorials.
> > But a problem came up when I tried to configure Eclipse to work with
> UIMA.
> > I installed the UIMA plugins for eclipse from
> > http://www.apache.org/dist/uima/eclipse-update-site, I followed all the
> > steps in order to set it up, I added my UIMA_HOME to the Java Build Path
> in
> > Eclipse. I imported the uimaj-examples but I cannot run them, when I
> tried
> > to run any of the tools I get the Error: Could not find or load main
> class
> > org.apache.uima.tools.AnnotationViewerMain (for example this happens
> when I
> > tried to run the Annotation Viewer). I know this seems to be a path
> > problem, so I checked the build path of the project and it does includes
> > everything in my installation of UIMA, the lib is there with the jar of
> the
> > tools. My environment variables of %UIMA_HOME%, %JAVA_HOME% exist and
> they
> > hold as value the path of UIMA and JAVA respectively. I also included the
> > lib directory of uima to the %CLASSPATH%, and the bin and lib directories
> > of the uima to the %PATH%.
> >
> >  I tried to make the tutorial of “My first Annotator”, I created the
> > project RoomNumberAnnotator and followed the tutorial step by step. But
> at
> > the end when I tried to test it with the UIMA CAS Visual Debugger again I
> > only got Error: Could not find or load main class
> > org.apache.uima.tools.cvd.CVD since I cannot run the SDK tools from
> > eclipse. I ran from the CVD from the console and it worked, and I loaded
> > the analysis engine of RoomNumberAnnotator and it worked. Nevertheless I
> > still cannot make it work from eclipse.
> >
> >  I looked for information about this and I didn't find much, which makes
> me
> > think it's something too basic to solve to require help. Anyway I've been
> > stuck with these days checking what can be wrong with my configurations
> of
> > java, eclipse, and classpaths. Please If someone could help me with some
> > advise or hint to solve these it would be much appreciated.
> >
> >  I'm running Eclipse Luna 4.4.2 with EMF tools and Maven (m2e), JDK
> > 1.7.0_79, UIMA 2.7, all these over Ubuntu 14.
> >
>
>

Re: Problem with Eclipse and UIMA

Posted by Marshall Schor <ms...@schor.com>.
Hi,
Sorry to hear of the startup troubles; I think they can be quickly solved.  Here
are some suggestions.

The bottom line - I think the directions were written assuming you have two
Eclipse projects in your workspace, one for the uimaj-examples, and one for the
uimaj-tools itself.  This would be the case if you downloaded the source
distribution, unzipped (or untarred) it, and then used the Eclipse Import to
"import existing Maven projects".
But there's a work around.  Please read on...

When you say you cannot run them, are you trying to run them via Eclipse (run
menu), or the command line?

It sounds like you may have downloaded the UIMA Java SDK "binary" package and
unzipped or untarred it, is that correct?
Or did you download the source code, import it into Eclipse, and "built" it?

I'm guessing you may have done the "binary" package.  In that case there are a
couple of steps to do, described in the binary distribution's README - scroll
down to the part about setting the Environment Variables JAVA_HOME and
UIMA_HOME, and running UIMA_HOME/bin/adjustExamplesPaths.bat (or .sh if on linux).

I know you said you set UIMA_HOME as an "Eclipse" variable, but did you also set
it as an environment variable?

If you're running from Eclipse, go to the run configuration ( menu -> run -> run
configurations) and pick a tool, say for instance, the UIMA Document Analyzer,
and click it once to "open" it.  Then look at the "classpath" tab.  On my
installation, it shows under "User Entries" two projects:  "uimaj-tools" and
"uimaj-examples".  I suspect you only have an Eclipse Project for
"uimaj-examples", and are missing the one for uimaj-tools.

You can fix this by clicking on "User Entries", and then on the right on "Add
External Jars", and there add the uimaj-tools jar from the lib directory in the
unzipped UIMA Binary distribution.

If I've made wrong guesses about the details of your situation, please respond
back with the corrected details :-)

Good Luck! -Marshall

On 5/22/2015 9:36 AM, Lothar Diefenbaker wrote:
> Hello Everyone,
>
>  I recently become involved in a project with Apache UIMA. As I was totally
> unfamiliar with it as I was to eclipse, so I started reading the
> documentation from the very beginning and I try to follow the tutorials.
> But a problem came up when I tried to configure Eclipse to work with UIMA.
> I installed the UIMA plugins for eclipse from
> http://www.apache.org/dist/uima/eclipse-update-site, I followed all the
> steps in order to set it up, I added my UIMA_HOME to the Java Build Path in
> Eclipse. I imported the uimaj-examples but I cannot run them, when I tried
> to run any of the tools I get the Error: Could not find or load main class
> org.apache.uima.tools.AnnotationViewerMain (for example this happens when I
> tried to run the Annotation Viewer). I know this seems to be a path
> problem, so I checked the build path of the project and it does includes
> everything in my installation of UIMA, the lib is there with the jar of the
> tools. My environment variables of %UIMA_HOME%, %JAVA_HOME% exist and they
> hold as value the path of UIMA and JAVA respectively. I also included the
> lib directory of uima to the %CLASSPATH%, and the bin and lib directories
> of the uima to the %PATH%.
>
>  I tried to make the tutorial of “My first Annotator”, I created the
> project RoomNumberAnnotator and followed the tutorial step by step. But at
> the end when I tried to test it with the UIMA CAS Visual Debugger again I
> only got Error: Could not find or load main class
> org.apache.uima.tools.cvd.CVD since I cannot run the SDK tools from
> eclipse. I ran from the CVD from the console and it worked, and I loaded
> the analysis engine of RoomNumberAnnotator and it worked. Nevertheless I
> still cannot make it work from eclipse.
>
>  I looked for information about this and I didn't find much, which makes me
> think it's something too basic to solve to require help. Anyway I've been
> stuck with these days checking what can be wrong with my configurations of
> java, eclipse, and classpaths. Please If someone could help me with some
> advise or hint to solve these it would be much appreciated.
>
>  I'm running Eclipse Luna 4.4.2 with EMF tools and Maven (m2e), JDK
> 1.7.0_79, UIMA 2.7, all these over Ubuntu 14.
>