Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » NoClassDefFoundError when deploying with
NoClassDefFoundError when deploying with [message #177287] Fri, 18 August 2006 01:27 Go to next message
Eclipse UserFriend
Originally posted by: craig.haenterprises.com.au

I have a J2EE Project (lets call it XXX) that depends on three other
normal Java projects (A, B, and C). I go into my XXX's J2EE Module
Depencencies tab and select A, B, and C (as well as adding a couple of
other JAR libraries that those guys are dependent on).

When I click on publish, and check the .../tmp0/webapps/XXX/WEB-INF/lib
directory, I see that jars have been dynamically created for A/B/C and the
other dependent jars have been added. Love your work! I start Tomcat
(5.0) in Eclipse and everything looks OK at this point.

However, when I try to browse to a page in my Struts application, I get a
NoClassDefFoundError. In project XXX, I have a class called
XXXActionServlet that subclasses CCCActionServlet (which is in project C).
The error message is saying that it can't find CCCActionServlet - which I
can see has been successfully included in C.jar in WEB-INF/lib.

Any thoughts? I saw in other threads that if I add the dependent projects
to the J2EE Modules tab, then they should be removed from the Java Build
Path, but if I do that, then my project doesn't compile... and in any
case, the jars for the dependent projects seem to be successfully created
and published. Tomcat just doesn't seem to pick them up properly...

Do projects A,B,C have to be J2EE projects as well, or can they be Java
projects?

Running Eclipse 3.2 on Ubuntu Drake with WST 1.5.0.v200606092300. Any
advice would be much appreciated. Thanks a lot.

--
Craig
Re: NoClassDefFoundError when deploying with [message #177635 is a reply to message #177287] Mon, 21 August 2006 22:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: craig.haenterprises.com.au

Anyone? At this stage, I would be happy with some wild guesses :-)
Thanks...

--
Craig
Re: NoClassDefFoundError when deploying with [message #177651 is a reply to message #177635] Tue, 22 August 2006 15:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: avinh.verizon.net

Craig,

Sometimes the description of the error may not be accurate. For me, when
it said that my class was not found when it was right there in the classes
directory or in one of the jar files, I was confused just like you.

I suggest that you try migrating your application and its dependencies to
the Application Server's (Tomcat's) webapps directory and try running it
there instead. Tomcat may give you better/truer error msgs as far as which
class failed. In my case, it was some dependencies involving the Axis jar
and what other jar files that Axis needed (the version of Axis that came
with WTP 1.02 was older too, I think the latest for Axis is 1.3(?)). Once
I put those dependent jar files into the webapps/xxx/WEB-INF/lib
directory, the application was happy.

Good luck - Alan
Re: NoClassDefFoundError when deploying with [message #177820 is a reply to message #177287] Thu, 24 August 2006 19:51 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Craig,

What you describe should work, implying there is a missing piece to this
puzzle. Is this still not working?

Cheers,
Larry

Craig Edwards wrote:
> I have a J2EE Project (lets call it XXX) that depends on three other
> normal Java projects (A, B, and C). I go into my XXX's J2EE Module
> Depencencies tab and select A, B, and C (as well as adding a couple of
> other JAR libraries that those guys are dependent on).
>
> When I click on publish, and check the .../tmp0/webapps/XXX/WEB-INF/lib
> directory, I see that jars have been dynamically created for A/B/C and
> the other dependent jars have been added. Love your work! I start
> Tomcat (5.0) in Eclipse and everything looks OK at this point.
>
> However, when I try to browse to a page in my Struts application, I get
> a NoClassDefFoundError. In project XXX, I have a class called
> XXXActionServlet that subclasses CCCActionServlet (which is in project
> C). The error message is saying that it can't find CCCActionServlet -
> which I can see has been successfully included in C.jar in WEB-INF/lib.
>
> Any thoughts? I saw in other threads that if I add the dependent
> projects to the J2EE Modules tab, then they should be removed from the
> Java Build Path, but if I do that, then my project doesn't compile...
> and in any case, the jars for the dependent projects seem to be
> successfully created and published. Tomcat just doesn't seem to pick
> them up properly...
>
> Do projects A,B,C have to be J2EE projects as well, or can they be Java
> projects?
>
> Running Eclipse 3.2 on Ubuntu Drake with WST 1.5.0.v200606092300. Any
> advice would be much appreciated. Thanks a lot.
>
> --
> Craig
>
Re: NoClassDefFoundError when deploying with [message #185316 is a reply to message #177820] Wed, 20 December 2006 17:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kenk.agitar.com

Craig,

Did you get resolution on your NoClassDefFoundError?

I've experienced a similar problem. When my tomcat instance tries to
load a struts class from a jar (and I've verified that the jar is in
WEB-INF/lib and that the class is in the jar), tomcat reports a
NoClassDefFoundError. I stepping through the tomcat classloading code
and noticed that it got an IOException when trying to get the manifest
of the jar file that contained the class in question. The IOException
reported that there was a bad header.

Manually unjarring and rejarring the jar file fixed the
NoClassDefFoundError.

Interestingly this happened on my windows install, but not my linux install.

Has anyone else seen this or does anyone know how to prevent it?

Thanks,
Ken


Larry Isaacs wrote:
> Craig,
>
> What you describe should work, implying there is a missing piece to this
> puzzle. Is this still not working?
>
> Cheers,
> Larry
>
> Craig Edwards wrote:
>> I have a J2EE Project (lets call it XXX) that depends on three other
>> normal Java projects (A, B, and C). I go into my XXX's J2EE Module
>> Depencencies tab and select A, B, and C (as well as adding a couple of
>> other JAR libraries that those guys are dependent on).
>>
>> When I click on publish, and check the
>> .../tmp0/webapps/XXX/WEB-INF/lib directory, I see that jars have been
>> dynamically created for A/B/C and the other dependent jars have been
>> added. Love your work! I start Tomcat (5.0) in Eclipse and
>> everything looks OK at this point.
>>
>> However, when I try to browse to a page in my Struts application, I
>> get a NoClassDefFoundError. In project XXX, I have a class called
>> XXXActionServlet that subclasses CCCActionServlet (which is in project
>> C). The error message is saying that it can't find CCCActionServlet -
>> which I can see has been successfully included in C.jar in WEB-INF/lib.
>>
>> Any thoughts? I saw in other threads that if I add the dependent
>> projects to the J2EE Modules tab, then they should be removed from the
>> Java Build Path, but if I do that, then my project doesn't compile...
>> and in any case, the jars for the dependent projects seem to be
>> successfully created and published. Tomcat just doesn't seem to pick
>> them up properly...
>>
>> Do projects A,B,C have to be J2EE projects as well, or can they be
>> Java projects?
>>
>> Running Eclipse 3.2 on Ubuntu Drake with WST 1.5.0.v200606092300. Any
>> advice would be much appreciated. Thanks a lot.
>>
>> --
>> Craig
>>
Re: NoClassDefFoundError when deploying with [message #185349 is a reply to message #185316] Wed, 20 December 2006 21:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kenk.agitar.com

I found out what my problem was. The auto-generated manifest.mf file
had been incorrectly checked out by a windows client. The resulting
manifest had windows line-separators in it, which was causing tomcat to
get those IOExceptions when reading out the jar's manifest. Removing
the checked in manifest caused it to get properly regenerated and fixed
the problem.

--Ken


Ken Koster wrote:
> Craig,
>
> Did you get resolution on your NoClassDefFoundError?
>
> I've experienced a similar problem. When my tomcat instance tries to
> load a struts class from a jar (and I've verified that the jar is in
> WEB-INF/lib and that the class is in the jar), tomcat reports a
> NoClassDefFoundError. I stepping through the tomcat classloading code
> and noticed that it got an IOException when trying to get the manifest
> of the jar file that contained the class in question. The IOException
> reported that there was a bad header.
>
> Manually unjarring and rejarring the jar file fixed the
> NoClassDefFoundError.
>
> Interestingly this happened on my windows install, but not my linux
> install.
>
> Has anyone else seen this or does anyone know how to prevent it?
>
> Thanks,
> Ken
>
>
> Larry Isaacs wrote:
>> Craig,
>>
>> What you describe should work, implying there is a missing piece to
>> this puzzle. Is this still not working?
>>
>> Cheers,
>> Larry
>>
>> Craig Edwards wrote:
>>> I have a J2EE Project (lets call it XXX) that depends on three other
>>> normal Java projects (A, B, and C). I go into my XXX's J2EE Module
>>> Depencencies tab and select A, B, and C (as well as adding a couple
>>> of other JAR libraries that those guys are dependent on).
>>>
>>> When I click on publish, and check the
>>> .../tmp0/webapps/XXX/WEB-INF/lib directory, I see that jars have been
>>> dynamically created for A/B/C and the other dependent jars have been
>>> added. Love your work! I start Tomcat (5.0) in Eclipse and
>>> everything looks OK at this point.
>>>
>>> However, when I try to browse to a page in my Struts application, I
>>> get a NoClassDefFoundError. In project XXX, I have a class called
>>> XXXActionServlet that subclasses CCCActionServlet (which is in
>>> project C). The error message is saying that it can't find
>>> CCCActionServlet - which I can see has been successfully included in
>>> C.jar in WEB-INF/lib.
>>>
>>> Any thoughts? I saw in other threads that if I add the dependent
>>> projects to the J2EE Modules tab, then they should be removed from
>>> the Java Build Path, but if I do that, then my project doesn't
>>> compile... and in any case, the jars for the dependent projects seem
>>> to be successfully created and published. Tomcat just doesn't seem
>>> to pick them up properly...
>>>
>>> Do projects A,B,C have to be J2EE projects as well, or can they be
>>> Java projects?
>>>
>>> Running Eclipse 3.2 on Ubuntu Drake with WST 1.5.0.v200606092300.
>>> Any advice would be much appreciated. Thanks a lot.
>>>
>>> --
>>> Craig
>>>
Re: NoClassDefFoundError when deploying with [message #185457 is a reply to message #185349] Sat, 30 December 2006 01:07 Go to previous message
David Williams is currently offline David WilliamsFriend
Messages: 722
Registered: July 2009
Senior Member
On Wed, 20 Dec 2006 16:19:26 -0500, Ken Koster <kenk@agitar.com> wrote:
>
> I found out what my problem was. The auto-generated manifest.mf file =
=

> had been incorrectly checked out by a windows client. The resulting =

> manifest had windows line-separators in it, which was causing tomcat t=
o =

> get those IOExceptions when reading out the jar's manifest.

I'm not sure of how to improve this situation with EOL's and manifest.mf=
=

files,
but, see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=3D165834
for some related discussion.
Previous Topic:Websphere Test Environment versions
Next Topic:How to obtain original line numbers for exceptions in JSPs?
Goto Forum:
  


Current Time: Thu Apr 18 05:18:29 GMT 2024

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

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

Back to the top