java.lang.NoClassDefFoundError

H

HARI OM

SUBJECT: java.lang.NoClassDefFoundError
I am using Tomcat 4.1.31 on SuSE Linux 8.1 and Java 1.4

I have my application as following:

/local/tomcat/webapps/hari
/local/tomcat/webapps/hari/index.html
/local/tomcat/webapps/hari/WEB-INF/classes/util/BatchUpload1.class
/local/tomcat/webapps/hari/WEB-INF/classes/util/*.class
/local/tomcat/webapps/hari/WEB-INF/lib/cos.jar (this is Oreilly's
predefined classes)
/local/tomcat/webapps/hari/WEB-INF/web.xml

I access my WEB application as http://us.hari.com/uhin/BatchUpload and
get following error wonder why:
--------------------------------------------------------------------------------
description: The server encountered an internal error () that prevented
it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class
util.BatchUpload1
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)

at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:621)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:163)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)

at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

at java.lang.Thread.run(Thread.java:534)

root cause

java.lang.NoClassDefFoundError:
com/oreilly/servlet/multipart/FileRenamePolicy

at java.lang.Class.getDeclaredConstructors0(Native Method)
at
java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
at java.lang.Class.getConstructor0(Class.java:1930)
at java.lang.Class.newInstance0(Class.java:278)
at java.lang.Class.newInstance(Class.java:261)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:856)

-----------------------------------------------------------------------------------

I am using Oreilly's predefined classes which are stored in "cos.jar"
file and under WEB-INF/lib/ directory... I have also added this to the
CLASSPATH...


When I un-jar my cos.jar file I get follwing files...
com/oreilly/servlet/*.classes


Any pointer on this would be appreciated...

THANKS!

HARI OM
 
K

kaeli

java.lang.NoClassDefFoundError:
com/oreilly/servlet/multipart/FileRenamePolicy

It's looking for
com/oreilly/servlet/multipart/FileRenamePolicy.class
When I un-jar my cos.jar file I get follwing files...
com/oreilly/servlet/*.classes

Where's the multipart directory?
Because that's what it's looking for.


--
--
~kaeli~
A midget fortune teller who escapes from prison is a small
medium at large.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
H

HARI OM

THANKS Kaeli.

My multipart directory is under "com/oreilly/servlet/multipart"

Any other hints on this?

THANKS again!

HARI OM
 
K

kaeli

THANKS Kaeli.

My multipart directory is under "com/oreilly/servlet/multipart"

Okay; you posted servlet/*.class
What you meant was servlet/multipart/*.class?
Any other hints on this?

You also verified that the FileRenamePolicy.class file is actually there, in
that multipart directory, right?
I've unjarred things to find that classes weren't in there that I thought.

Next, verify that a plain ordinary java program can find it. Whip up a test
case and import that class and make sure it finds it. If it does, you know
your problem is with Tomcat. If not, something else is going on.

--
--
~kaeli~
She was engaged to a boyfriend with a wooden leg but broke
it off.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
H

HARI OM

Thanks Kaeli again.

My com/oreilly/servlet file consists of classes and a directory
"multipart" and multipart itself contains classes (one of them being
FileRenamePolicy.class)

com/oreilly/servlet/*.class
com/oreilly/servlet/multipart/*.class

etc.

In my Servlets I have imported...
 
W

Wendy Smoak

HARI OM said:
My com/oreilly/servlet file consists of classes and a directory
"multipart" and multipart itself contains classes (one of them being
FileRenamePolicy.class)

Have you left the .jar file in place in addition to expanding it under
classes? Do one or the other. Having duplicate classes can confuse the
ClassLoader and it may insist that the class isn't there.
 
K

kaeli

com/oreilly/servlet/*.class
com/oreilly/servlet/multipart/*.class

etc.

In my Servlets I have imported...

Oops.
import com.oreilly.servlet.MultipartRequest.*;

Try that instead.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top