Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Tomcat/Eclipse: NoClassDefFoundError

Thread view: 
Magnus Warker - 09 Apr 2007 15:19 GMT
Hi,

there is a Tomcat application which uses another library, provided as a
JAR-file.

The code compiles without problems in Eclipse, after I added the needed
JAR-file to the class path.

But the integrated Tomcat (Sysdeo) throws a NoClassDefFoundError and is
missing a class from the external library.

I already defined the classpath. Why is this not propagated to Tomcat? How
is this done the standard way?

Thank you,
Magnus
Axel - 09 Apr 2007 15:25 GMT
Magnus Warker schrieb:
> Hi,
>
[quoted text clipped - 12 lines]
> Thank you,
> Magnus

Hi Magnus,

I think you just added the jar file to the eclipse classpath, right? You
should put in the WEB-INF/lib directory so that it's deployed to tomcat
too. That should solve you problem, if I got you right. In Eclipse you
can reference the file from the WEB-INF/lib folder as well.

Cheers,
Axel
Andrew Thompson - 09 Apr 2007 15:32 GMT
..
>there is a Tomcat application which uses another library, provided as a
>JAR-file.
..
>But the integrated Tomcat (Sysdeo) throws a NoClassDefFoundError
...
>I already defined the classpath.

What or whose classpath?

>...Why is this not propagated to Tomcat? How
>is this done the standard way?

The standard way to make archives od classes available
to a web-app, is to place the archive in WEB-INF/lib and
perhaps restart the server.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Magnus Warker - 09 Apr 2007 16:22 GMT
Hi Andrew and Axel,

thank you for your hints! I added the JAR as a symlink to the WEB-INF/lib
folder, and it worked.

But let me ask two questions about that:

1. Why do I need to specify this twice?
Once for Eclipse to treat my code as "known code" (syntax highlighting and
son on), and once for Tomcat to work? This is somewhat doubled
configuration, isn't it?

2. What about many projects using one library?
Assume many web projects using a single JAR library. Copying JAR files all
the time does not seem conventional for me. What I did in this case was
creating a symbolic link. Is this the normal way?

Thanks a lot!
Magnus
Axel Seinsche - 09 Apr 2007 19:19 GMT
Hi Magnus,

> thank you for your hints! I added the JAR as a symlink to the WEB-INF/lib
> folder, and it worked.
That's fine. ;-)

> But let me ask two questions about that:
>
> 1. Why do I need to specify this twice?
> Once for Eclipse to treat my code as "known code" (syntax highlighting and
> son on), and once for Tomcat to work? This is somewhat doubled
> configuration, isn't it?

You don't need to specify it twice. Answer see question 2.

> 2. What about many projects using one library?
> Assume many web projects using a single JAR library. Copying JAR files all
> the time does not seem conventional for me. What I did in this case was
> creating a symbolic link. Is this the normal way?

Of course you can do it with a symbolic link. This works for Linux/Unix
systems. But the normal way would be to copy the jar file in the
WEB-INF/lib folder in your eclipse project. When eclipse creates a WAR
or whatever archive you need, the lib will be automatically be deployed
with your project. Inside eclipse you can add jar files from your
WEB-INF/lib folder to be able to compile.

> Thanks a lot!
> Magnus
Hope this helps and answers your questions.

Cheers,
Axel
Arne Vajhøj - 10 Apr 2007 00:34 GMT
> But let me ask two questions about that:
>
> 1. Why do I need to specify this twice?
> Once for Eclipse to treat my code as "known code" (syntax highlighting and
> son on), and once for Tomcat to work? This is somewhat doubled
> configuration, isn't it?

You could view it that way, but consider that
you used Eclipse to develop an web
app with version N of the jar and NetBeans to develop another
web app with version N+1 of the jar and both got deployed to
the same Tomcat residing on a web hotel that you have only
HTTP and FTP access to.

They way it is makes that no problem. So consider it a feature.
You may not need it now. But you may need it some day.

> 2. What about many projects using one library?
> Assume many web projects using a single JAR library. Copying JAR files all
> the time does not seem conventional for me. What I did in this case was
> creating a symbolic link. Is this the normal way?

shared/lib exist for that purpose, but be really sure that you want
that jar used by all web apps before putting something there.

Arne
Magnus Warker - 10 Apr 2007 06:22 GMT
Hi Andrew and Axel,

thank you very much!

Magnus


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.