You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Roderick Timmerman <ro...@gmail.com> on 2009/05/22 15:31:52 UTC
Tomcat 6.0.18 useBean NoClassDefFoundError
Hello people
My question is a nooby one but I don't use Java full time because I
use tools that works however, I need it to work NOW. In a nutshell,
my question is when Tomcat panics and gives this...
...
...
javax.servlet.ServletException: java.lang.NoClassDefFoundError:
user/UserData (wrong name: UserData)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NoClassDefFoundError: user/UserData (wrong name: UserData)
java.lang.ClassLoader.findBootstrapClass(Native Method)
java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:891)
java.lang.ClassLoader.loadClass(ClassLoader.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:299)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
java.lang.ClassLoader.loadClass(ClassLoader.java:251)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1178)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Generator.generate(Generator.java:3365)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...
... what is it moaning about?
As you can see this test is based on a tutorial (which is here:
http://www.jsptut.com/Forms.jsp).
My project's directory layout roughly looks like this.
%catalina_home%\webapps\test\test5.jsp
%catalina_home%\webapps\test\WEB-INF\classes\user\UserData.class
the source code for UserData states it's package:
package user;
class UserData implements java.io.Serializable {
private String username;
private String email;
private int age;
public void setUsername(String value) {
username = value;
}
...
}
The jsp for test5.jsp looks like this:
<jsp:useBean id="user" class="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<html>
<body>
<%=user.getUsername()%><br>
<%=user.getEmail()%><br>
<%=user.getAge()%><br>
<form method="post" action="test5.jsp">
Name: <input type="text" value=""/><br>
Email: <input type="text" value=""/><br>
Age: <input type="text" value=""/><br>
</form>
</body>
</html>
I think i've isolated the problem to line 1 of the JSP script and know
its a classpath issue. Why is Tomcat not picking up the user.UserData
from WEB-INF\classes, is it because of the lack of web.xml content?
How can get this simple code example to work?
Again I know these questions are nooby but I've been stuck on this
"bean" stuff since yesterday and am rapidly loosing my patience short
of calling Tomcat 6 a failure. So, any help is very greately
appreciated.
Thanks in advance,
Roderick
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by Martin Gainty <mg...@hotmail.com>.
clean all contents from container folder of CATALINA work folder check
$CATALINA_HOME/work/Catalina
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Fri, 22 May 2009 17:12:03 +0100
> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
> From: roderick.timmerman@gmail.com
> To: users@tomcat.apache.org
>
> I concur. Just need to find out how the class file is managing to
> exist after I've deleted it and shutdown tomcat, its lingering
> somewhere thus running "javap user.UserData" from anywhere still
> returns code.
>
> Thanks very much for the help.
>
> On Fri, May 22, 2009 at 4:57 PM, Caldarale, Charles R
> <Ch...@unisys.com> wrote:
> >> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> >> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
> >>
> >> ran the given command:
> >>
> >> public class UserData extends java.lang.Object{
> >
> > That's proof that the package statement isn't in there. Had it been, javap would show "public class user.UserData extends..."
> >
> > Looks like what you're editing is not what you're compiling.
> >
> > - Chuck
> >
> >
> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>
> I concur. Just need to find out how the class file is managing to
> exist after I've deleted it and shutdown tomcat, its lingering
> somewhere thus running "javap user.UserData" from anywhere still
> returns code.
Do you have a CLASSPATH environment variable set? If so, get rid of it - that will cause havoc with the classloaders.
Run a Windows Search for UserData.class to see where other copies might be hiding.
If you're running from a .war file (just in case - there's no evidence you are), Tomcat may be expanding it when it starts, overwriting changes you made to the expanded directory.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by Roderick Timmerman <ro...@gmail.com>.
I concur. Just need to find out how the class file is managing to
exist after I've deleted it and shutdown tomcat, its lingering
somewhere thus running "javap user.UserData" from anywhere still
returns code.
Thanks very much for the help.
On Fri, May 22, 2009 at 4:57 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
>> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>>
>> ran the given command:
>>
>> public class UserData extends java.lang.Object{
>
> That's proof that the package statement isn't in there. Had it been, javap would show "public class user.UserData extends..."
>
> Looks like what you're editing is not what you're compiling.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>
> ran the given command:
>
> public class UserData extends java.lang.Object{
That's proof that the package statement isn't in there. Had it been, javap would show "public class user.UserData extends..."
Looks like what you're editing is not what you're compiling.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by Roderick Timmerman <ro...@gmail.com>.
ran the given command:
public class UserData extends java.lang.Object{
java.lang.String username;
java.lang.String email;
int age;
public UserData();
public void setUsername(java.lang.String);
public void setUserEmail(java.lang.String);
public void setAge(int);
public java.lang.String getUsername();
public java.lang.String getEmail();
public int getAge();
}
On Fri, May 22, 2009 at 4:45 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
>> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>>
>> I'm building everything from scratch/no IDEs save the VIM editor.
>> Timestamp on the UserData.class is up-to-date (recompiled a few
>> minutes ago).
>
> Try using javap to see what's in the class file:
> javap -classpath %catalina_home%\webapps\test\WEB-INF\classes user.UserData
>
> Post the results.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>
> I'm building everything from scratch/no IDEs save the VIM editor.
> Timestamp on the UserData.class is up-to-date (recompiled a few
> minutes ago).
Try using javap to see what's in the class file:
javap -classpath %catalina_home%\webapps\test\WEB-INF\classes user.UserData
Post the results.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by David Smith <dn...@cornell.edu>.
Look closely. There has to be some discrepancy between what you
perceive and what tomcat does. Is UserData.class present anywhere else
visible to tomcat? Are you sure you are updating the webapp tomcat is
running? Is there any way possible tomcat could be picking up an old
copy of your class? Is there any way possible you might be updating one
file and compiling another?
--David
Roderick Timmerman wrote:
> I'm building everything from scratch/no IDEs save the VIM editor.
> Timestamp on the UserData.class is up-to-date (recompiled a few
> minutes ago). Tomcat is running on its own in Windows, it is not
> running as a service.
>
> On Fri, May 22, 2009 at 4:12 PM, Caldarale, Charles R
> <Ch...@unisys.com> wrote:
>
>>> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
>>> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>>>
>>> The source has been recompiled, Tomcat restarted however,
>>> same issue reoccurs.
>>>
>> Are you positive that the UserData.class file in WEB-INF/classes/user was replaced by the recompilation? Check the timestamp on it to make sure.
>>
>> Are you running Tomcat by itself, or under an IDE? IDEs sometimes have a mind of their own when deciding where things are located.
>>
>> - Chuck
>>
>>
>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by Roderick Timmerman <ro...@gmail.com>.
I'm building everything from scratch/no IDEs save the VIM editor.
Timestamp on the UserData.class is up-to-date (recompiled a few
minutes ago). Tomcat is running on its own in Windows, it is not
running as a service.
On Fri, May 22, 2009 at 4:12 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
>> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>>
>> The source has been recompiled, Tomcat restarted however,
>> same issue reoccurs.
>
> Are you positive that the UserData.class file in WEB-INF/classes/user was replaced by the recompilation? Check the timestamp on it to make sure.
>
> Are you running Tomcat by itself, or under an IDE? IDEs sometimes have a mind of their own when deciding where things are located.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>
> The source has been recompiled, Tomcat restarted however,
> same issue reoccurs.
Are you positive that the UserData.class file in WEB-INF/classes/user was replaced by the recompilation? Check the timestamp on it to make sure.
Are you running Tomcat by itself, or under an IDE? IDEs sometimes have a mind of their own when deciding where things are located.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by Roderick Timmerman <ro...@gmail.com>.
The source has been recompiled, Tomcat restarted however, same issue reoccurs.
On Fri, May 22, 2009 at 3:59 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
>> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>>
>> No clearly, this not helpful information and also I did not intend to
>> start a flame war. The package statement is present (as I stated in
>> the original message) -
>
> Yes, we know the package statement is in the .java source now, but the .class file in your WEB-INF/classes/user directory is packageless; that's what the "wrong name: UserData" means. You need to recompile your source.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> Subject: Re: Tomcat 6.0.18 useBean NoClassDefFoundError
>
> No clearly, this not helpful information and also I did not intend to
> start a flame war. The package statement is present (as I stated in
> the original message) -
Yes, we know the package statement is in the .java source now, but the .class file in your WEB-INF/classes/user directory is packageless; that's what the "wrong name: UserData" means. You need to recompile your source.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by Roderick Timmerman <ro...@gmail.com>.
No clearly, this not helpful information and also I did not intend to
start a flame war. The package statement is present (as I stated in
the original message) -
package user;
class UserData {
...
}
If anybody can help at all it would be appreciated.
Best regards
Roderick
On Fri, May 22, 2009 at 3:13 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
>> Subject: Tomcat 6.0.18 useBean NoClassDefFoundError
>>
>> I don't use Java full time because I use tools that works
>
> Interesting that you expect to get help from people when your first sentence is designed to annoy them.
>
>> java.lang.NoClassDefFoundError: user/UserData (wrong name: UserData)
>
> You compiled your class without a package statement.
>
>> ... what is it moaning about?
>
> The error message isn't moaning, you are. It's simply letting you know you made a mistake.
>
>> the source code for UserData states it's package:
>
> It does now, but not when you compiled it.
>
>> I think i've isolated the problem to line 1 of the JSP script
>> and know its [sic] a classpath issue.
>
> No, it's not a classpath issue. The UserData.class file in WEB-INF/classes/user was not created with a package statement.
>
>> Why is Tomcat not picking up the user.UserData from
>> WEB-INF\classes
>
> See above.
>
>> How can get this simple code example to work?
>
> Follow the instructions.
>
>> am rapidly loosing my patience short of calling Tomcat 6 a failure.
>
> Clearly, Tomcat 6 is a world-wide success. What's your track record?
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat 6.0.18 useBean NoClassDefFoundError
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roderick Timmerman [mailto:roderick.timmerman@gmail.com]
> Subject: Tomcat 6.0.18 useBean NoClassDefFoundError
>
> I don't use Java full time because I use tools that works
Interesting that you expect to get help from people when your first sentence is designed to annoy them.
> java.lang.NoClassDefFoundError: user/UserData (wrong name: UserData)
You compiled your class without a package statement.
> ... what is it moaning about?
The error message isn't moaning, you are. It's simply letting you know you made a mistake.
> the source code for UserData states it's package:
It does now, but not when you compiled it.
> I think i've isolated the problem to line 1 of the JSP script
> and know its [sic] a classpath issue.
No, it's not a classpath issue. The UserData.class file in WEB-INF/classes/user was not created with a package statement.
> Why is Tomcat not picking up the user.UserData from
> WEB-INF\classes
See above.
> How can get this simple code example to work?
Follow the instructions.
> am rapidly loosing my patience short of calling Tomcat 6 a failure.
Clearly, Tomcat 6 is a world-wide success. What's your track record?
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org