Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Servlet build is ignoring the classpath to a local jar file.
Servlet build is ignoring the classpath to a local jar file. [message #215187] Thu, 12 June 2008 21:02 Go to next message
Eclipse UserFriend
Originally posted by: jim.fayettedigital.com

I am just diving into using eclipse with tomcat and have generated a
simple web app. The first thing I did was to add an index.jsp to the
WebContent and add it to the server and publish it. That worked, then I
added a servlet using New->Other->Web->Servlet. That didn't.

It uses the Xapian java bindings jar file which I put in
..../WebContent/WEB-INF/lib and then went into the project properties for
the JXSearch project. I added the jar as a "Add Jars" button on the
libraries tab in the Java Build Path of the properties screen. That
seemed to go OK. It found the file and it is listed when I bring up
that tab again.

I'm getting a couple of error messages displayed on the browser, the
last being:

java.lang.ClassNotFoundException: org.xapian.Query

org.apache.catalina.loader.WebappClassLoader.loadClass(Webap pClassLoader.java:1362)

org.apache.catalina.loader.WebappClassLoader.loadClass(Webap pClassLoader.java:1208)
(truncated)

The full output of the error can be viewed at
http://fayettedigital.com/err.html.

The last line of that output says, "note The full stack trace of the
root cause is available in the Apache Tomcat/5.5 logs." but I can't find
any log files for Tomcat. I've done quite a bit of Tomcat development
in the past and am familiar with a traditional Tomcat install but I
can't figure out where anything is on the Eclipse install. The
$TOMCAT_HOME/logs directory is empty.

If there is more info somewhere I'd sure like to figure out where it is
and if anyone has any idea why it isn't finding or using the jar file,
that would be nice too. Oh here's part of the jar output listing
contents of the xapian jar file:
jar -tf xapian_jni.jar
META-INF/
META-INF/MANIFEST.MF
org/xapian/Database.class
org/xapian/Document.class
org/xapian/Enquire.class
org/xapian/ESet.class
org/xapian/ESetIterator.class
org/xapian/ExpandDecider.class
org/xapian/MatchDecider.class
org/xapian/MSet.class
org/xapian/MSetIterator.class
org/xapian/PositionIterator.class
org/xapian/Query.class
org/xapian/RSet.class
org/xapian/Stem.class
....

org.xapian.Query is surely there.


I should also probably mention I'm running Ubuntu 8.04, Eclipse 3.2.2
that came with Ubuntu and Tomcat 5.5. I could tell you a lot more but I
don't know what's important.


Here's a bit more confusing information. When I look in the Navigator
tab, I do not see the jar file in the .../lib direcory (folder). However
when I inspect the .classpath file in the .settings directory I see an
entry for that jar file. Yes, the path is correct, I copied/pasted the
entry and did an ls to prove it to myself.

For some reason the build is not paying attention to the classpath that
Eclipse generated.

Is there any way I can see what the build step is doing? I think I'm
going back to vi, ant and Tomcat. At least I'm able to make that work.
I don't see Eclipse as anything more than an impediment to getting my
work done.

Thanks for any assistance, my hair, that's not pulled out yet thanks
you too.
Jim.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215197 is a reply to message #215187] Thu, 12 June 2008 21:21 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Adding the jar to the "WebContent\WEB-INF\lib" folder of your project
should be sufficient to add the jar to the build path and have the jar
included in the published web module. Just adding adding the jar to the
Java Build Path doesn't by itself include the jar in the published web
module. Because you have done both, adding it on the Libraries tab may
be preventing the jar from being included in the web module. Try
removing the jar on the Libraries tab and see if that fixes the problem.
Re-add the jar to the WebContent\WEB-INF\lib if it somehow went missing.

For additional details about the Tomcat support in WTP, see:

http://wiki.eclipse.org/WTP_Tomcat_FAQ

Cheers,
Larry

Jim Lynch wrote:
> I am just diving into using eclipse with tomcat and have generated a
> simple web app. The first thing I did was to add an index.jsp to the
> WebContent and add it to the server and publish it. That worked, then I
> added a servlet using New->Other->Web->Servlet. That didn't.
>
> It uses the Xapian java bindings jar file which I put in
> .../WebContent/WEB-INF/lib and then went into the project properties for
> the JXSearch project. I added the jar as a "Add Jars" button on the
> libraries tab in the Java Build Path of the properties screen. That
> seemed to go OK. It found the file and it is listed when I bring up
> that tab again.
>
> I'm getting a couple of error messages displayed on the browser, the
> last being:
>
> java.lang.ClassNotFoundException: org.xapian.Query
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(Webap pClassLoader.java:1362)
>
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(Webap pClassLoader.java:1208)
>
> (truncated)
>
> The full output of the error can be viewed at
> http://fayettedigital.com/err.html.
>
> The last line of that output says, "note The full stack trace of the
> root cause is available in the Apache Tomcat/5.5 logs." but I can't find
> any log files for Tomcat. I've done quite a bit of Tomcat development
> in the past and am familiar with a traditional Tomcat install but I
> can't figure out where anything is on the Eclipse install. The
> $TOMCAT_HOME/logs directory is empty.
>
> If there is more info somewhere I'd sure like to figure out where it is
> and if anyone has any idea why it isn't finding or using the jar file,
> that would be nice too. Oh here's part of the jar output listing
> contents of the xapian jar file:
> jar -tf xapian_jni.jar
> META-INF/
> META-INF/MANIFEST.MF
> org/xapian/Database.class
> org/xapian/Document.class
> org/xapian/Enquire.class
> org/xapian/ESet.class
> org/xapian/ESetIterator.class
> org/xapian/ExpandDecider.class
> org/xapian/MatchDecider.class
> org/xapian/MSet.class
> org/xapian/MSetIterator.class
> org/xapian/PositionIterator.class
> org/xapian/Query.class
> org/xapian/RSet.class
> org/xapian/Stem.class
> ...
>
> org.xapian.Query is surely there.
>
>
> I should also probably mention I'm running Ubuntu 8.04, Eclipse 3.2.2
> that came with Ubuntu and Tomcat 5.5. I could tell you a lot more but I
> don't know what's important.
>
>
> Here's a bit more confusing information. When I look in the Navigator
> tab, I do not see the jar file in the .../lib direcory (folder). However
> when I inspect the .classpath file in the .settings directory I see an
> entry for that jar file. Yes, the path is correct, I copied/pasted the
> entry and did an ls to prove it to myself.
>
> For some reason the build is not paying attention to the classpath that
> Eclipse generated.
>
> Is there any way I can see what the build step is doing? I think I'm
> going back to vi, ant and Tomcat. At least I'm able to make that work.
> I don't see Eclipse as anything more than an impediment to getting my
> work done.
>
> Thanks for any assistance, my hair, that's not pulled out yet thanks
> you too.
> Jim.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215203 is a reply to message #215197] Thu, 12 June 2008 21:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jim.fayettedigital.com

Larry Isaacs wrote:
> Adding the jar to the "WebContent\WEB-INF\lib" folder of your project
> should be sufficient to add the jar to the build path and have the jar
> included in the published web module. Just adding adding the jar to the
> Java Build Path doesn't by itself include the jar in the published web
> module. Because you have done both, adding it on the Libraries tab may
> be preventing the jar from being included in the web module. Try
> removing the jar on the Libraries tab and see if that fixes the problem.
> Re-add the jar to the WebContent\WEB-INF\lib if it somehow went missing.
>
> For additional details about the Tomcat support in WTP, see:
>
> http://wiki.eclipse.org/WTP_Tomcat_FAQ
>
> Cheers,
> Larry
>Hi, Larry

Well, that didn't work. I even generated a new project, copied the jar
into the .../lib directory before I even created the servlet and it
still fails the same way.

Does anyone know where the logs referred to are kept?

Jim.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215211 is a reply to message #215203] Thu, 12 June 2008 22:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jim.fayettedigital.com

Jim Lynch wrote:
> Larry Isaacs wrote:
>> Adding the jar to the "WebContent\WEB-INF\lib" folder of your project
>> should be sufficient to add the jar to the build path and have the jar
>> included in the published web module. Just adding adding the jar to
>> the Java Build Path doesn't by itself include the jar in the published
>> web module. Because you have done both, adding it on the Libraries
>> tab may be preventing the jar from being included in the web module.
>> Try removing the jar on the Libraries tab and see if that fixes the
>> problem. Re-add the jar to the WebContent\WEB-INF\lib if it somehow
>> went missing.
>>
>> For additional details about the Tomcat support in WTP, see:
>>
>> http://wiki.eclipse.org/WTP_Tomcat_FAQ
>>
>> Cheers,
>> Larry
>> Hi, Larry
>
> Well, that didn't work. I even generated a new project, copied the jar
> into the .../lib directory before I even created the servlet and it
> still fails the same way.
>
> Does anyone know where the logs referred to are kept?
>
> Jim.
I figured out a way to fix it, but I don't understand why it's doing
what it is doing. Should I file a bug or is there something I'm not
doing that accidentally gets done for me?

Out of frustration, I exported my project into a war file. I noticed
that the jar file was in the war file. So I shutdown eclipse, brought
up tomcat manually and used the manager to deploy the war. It worked.
So I shutdown tomcat and restarted eclipse only to find out that the lib
now contained the jar file like it should have all along. And before
you asked, yes I've shutdown eclipse many times before for various
reasons and it didn't fix it. So by exporting a war file, I guess I
forced Eclipse to wake up and do something right for a change.

That said, I'm not sure Eclipse is really an improvement. If I continue
to have these kinds of problems, the slight advantage of the IDE will be
more than offset by these phantom ghosts.

Jim.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215258 is a reply to message #215203] Fri, 13 June 2008 12:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jmordax.terra.es

Jim Lynch wrote:
> Larry Isaacs wrote:
>> Adding the jar to the "WebContent\WEB-INF\lib" folder of your project
>> should be sufficient to add the jar to the build path and have the
>> jar included in the published web module. Just adding adding the jar
>> to the Java Build Path doesn't by itself include the jar in the
>> published web module. Because you have done both, adding it on the
>> Libraries tab may be preventing the jar from being included in the
>> web module. Try removing the jar on the Libraries tab and see if
>> that fixes the problem. Re-add the jar to the WebContent\WEB-INF\lib
>> if it somehow went missing.
>>
>> For additional details about the Tomcat support in WTP, see:
>>
>> http://wiki.eclipse.org/WTP_Tomcat_FAQ
>>
>> Cheers,
>> Larry
>> Hi, Larry
>
> Well, that didn't work. I even generated a new project, copied the
> jar into the .../lib directory before I even created the servlet and
> it still fails the same way.
>
> Does anyone know where the logs referred to are kept?
>
> Jim.
How do you copy the JAR files?
Just in case you copy them outside Eclipse, you should remember to
perform a refresh of the project in Eclipse to gather the changes you
did outside.

Regards,

Chemi.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215304 is a reply to message #215211] Fri, 13 June 2008 13:49 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Jim Lynch wrote:
> Jim Lynch wrote:
>> Larry Isaacs wrote:
>>> Adding the jar to the "WebContent\WEB-INF\lib" folder of your project
>>> should be sufficient to add the jar to the build path and have the
>>> jar included in the published web module. Just adding adding the jar
>>> to the Java Build Path doesn't by itself include the jar in the
>>> published web module. Because you have done both, adding it on the
>>> Libraries tab may be preventing the jar from being included in the
>>> web module. Try removing the jar on the Libraries tab and see if
>>> that fixes the problem. Re-add the jar to the WebContent\WEB-INF\lib
>>> if it somehow went missing.
>>>
>>> For additional details about the Tomcat support in WTP, see:
>>>
>>> http://wiki.eclipse.org/WTP_Tomcat_FAQ
>>>
>>> Cheers,
>>> Larry
>>> Hi, Larry
>>
>> Well, that didn't work. I even generated a new project, copied the
>> jar into the .../lib directory before I even created the servlet and
>> it still fails the same way.
>>
>> Does anyone know where the logs referred to are kept?
>>
>> Jim.
> I figured out a way to fix it, but I don't understand why it's doing
> what it is doing. Should I file a bug or is there something I'm not
> doing that accidentally gets done for me?
>
> Out of frustration, I exported my project into a war file. I noticed
> that the jar file was in the war file. So I shutdown eclipse, brought
> up tomcat manually and used the manager to deploy the war. It worked.
> So I shutdown tomcat and restarted eclipse only to find out that the lib
> now contained the jar file like it should have all along. And before
> you asked, yes I've shutdown eclipse many times before for various
> reasons and it didn't fix it. So by exporting a war file, I guess I
> forced Eclipse to wake up and do something right for a change.
>
> That said, I'm not sure Eclipse is really an improvement. If I continue
> to have these kinds of problems, the slight advantage of the IDE will be
> more than offset by these phantom ghosts.
>
> Jim.

Which Java are you using to run Eclipse. I have used Eclipse on Ubuntu
6.0.6, 7.10, and 8.10. I've had problems when using the Eclipse and
Java supplied by Ubuntu. I believe this is primarily caused by the Java
that was installed by Ubuntu. Because I have always needed a newer
version than Ubuntu supplied, I installed my own Eclipse under my home
directory. I've also always used a Sun JDK when running Eclipse. With
this combination, I haven't seen any behavior better or worse than I've
seen on Windows.

Cheers,
Larry
Re: Servlet build is ignoring the classpath to a local jar file. [message #215402 is a reply to message #215304] Sat, 14 June 2008 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jim.fayettedigital.com

Larry Isaacs wrote:

>
> Which Java are you using to run Eclipse. I have used Eclipse on Ubuntu
> 6.0.6, 7.10, and 8.10. I've had problems when using the Eclipse and
> Java supplied by Ubuntu. I believe this is primarily caused by the Java
> that was installed by Ubuntu. Because I have always needed a newer
> version than Ubuntu supplied, I installed my own Eclipse under my home
> directory. I've also always used a Sun JDK when running Eclipse. With
> this combination, I haven't seen any behavior better or worse than I've
> seen on Windows.
>
> Cheers,
> Larry
I'm using Sun JDK
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)

I tried to install the 1.6 JDK but even though the filename that I
downloaded had "JDK" in it, it was a JRE. No compiler, no bin directory
anywhere, etc. I couldn't find a real JDK for 1.6.

So far other than that strangeness, it seems to be working OK. I'm just
going through some tutorials now to get familiar with Eclipse. I've
done a lot of j2ee/java development in the past.

Thanks,
Jim.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215409 is a reply to message #215258] Sat, 14 June 2008 13:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jim.fayettedigital.com

Chemi wrote:

>> Jim.
> How do you copy the JAR files?
> Just in case you copy them outside Eclipse, you should remember to
> perform a refresh of the project in Eclipse to gather the changes you
> did outside.
>
> Regards,
>
> Chemi.

1. I did it via a shell. How do you copy them from within Eclipse?
2. How do you do a refresh? I figured stopping Eclipse and restarting
it should have done it, but maybe I was wrong?

Thanks, you're probably on the right track.

Jim.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215429 is a reply to message #215409] Sun, 15 June 2008 08:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jmordax.terra.es

Jim Lynch wrote:
> 1. I did it via a shell. How do you copy them from within Eclipse?
Well, in Windows you can copy the files from Windows Explorer, go to
Eclipse, select the folder where you want to put them and paste them. In
Linux, I understand using any kind of GUI like KDE or GNome will work
the same.
> 2. How do you do a refresh? I figured stopping Eclipse and restarting
> it should have done it, but maybe I was wrong?
Right button on your project and select refresh. And no, restart Eclipse
doen't refresh the workspace.
>
> Thanks, you're probably on the right track.
>
> Jim.
Hope this helps,

Chemi.
Re: Servlet build is ignoring the classpath to a local jar file. [message #215454 is a reply to message #215402] Mon, 16 June 2008 11:37 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Jim Lynch wrote:
> Larry Isaacs wrote:
>
>>
>> Which Java are you using to run Eclipse. I have used Eclipse on
>> Ubuntu 6.0.6, 7.10, and 8.10. I've had problems when using the
>> Eclipse and Java supplied by Ubuntu. I believe this is primarily
>> caused by the Java that was installed by Ubuntu. Because I have
>> always needed a newer version than Ubuntu supplied, I installed my own
>> Eclipse under my home directory. I've also always used a Sun JDK when
>> running Eclipse. With this combination, I haven't seen any behavior
>> better or worse than I've seen on Windows.
>>
>> Cheers,
>> Larry
> I'm using Sun JDK
> java version "1.5.0_15"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
> Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)
>
> I tried to install the 1.6 JDK but even though the filename that I
> downloaded had "JDK" in it, it was a JRE. No compiler, no bin directory
> anywhere, etc. I couldn't find a real JDK for 1.6.
>
> So far other than that strangeness, it seems to be working OK. I'm just
> going through some tutorials now to get familiar with Eclipse. I've
> done a lot of j2ee/java development in the past.
>
> Thanks,
> Jim.

For Tomcat 5.5 and later, a JRE is sufficient. They contain a copy of
the Eclipse compiler and use that by default. I use a JDK because I
have to worry about running earlier versions of Tomcat.

Cheers,
Larry
Previous Topic:Adding a row to HTML table with Web Page Editor
Next Topic:Why does JSP editor complain about refs to generic Map?
Goto Forum:
  


Current Time: Sat Apr 20 01:34:40 GMT 2024

Powered by FUDForum. Page generated in 0.04029 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top