You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ghodmode <gh...@ghodmode.com> on 2007/09/04 00:35:05 UTC
NoClassDefFoundError, Tomcat isn't seeing JARs in webapps//lib?
This is related to my previous email thread, but slightly different
circumstances.
Apache Tomcat 6.0.14
Java 1.6.0_02-b05
Wicket 1.3.0-beta3
I'm trying to run a Wicket application and it's not working. I'm getting a
NoClassDefFoundError:
java.lang.NoClassDefFoundError:
org/apache/wicket/protocol/http/WebApplication
I think I must be misunderstanding something basic about Tomcat web
application deployment.
So, I create a basic "HelloWorld" type servlet to try and troubleshoot the
problem.
I've double- and triple-checked the package against the documentation and
even verified it by listing the contents of the JAR with unzip.
What am I doing wrong?
The Wicket JAR file and two of its dependencies are in WEB-INF/lib:
@home:~/dev/tomcat/webapps/HelloWicket/WEB-INF/classes$ ls -ltr ../lib
total 1648
-rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
-rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
-rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar
Here's my web.xml:
@home:~/dev/tomcat/webapps/HelloWicket/WEB-INF$ cat web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>configuration</param-name>
<param-value>development</param-value>
</context-param>
<servlet>
<servlet-name>HelloWicket</servlet-name>
<servlet-class>org.apache.wicket.protocol.http.WicketServlet
</servlet-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>mypackage.HelloWicketApp</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloWicket</servlet-name>
<url-pattern>/helloWicket/*</url-pattern>
</servlet-mapping>
</web-app>
Here's the layout of my servlet's directory:
@home:~/dev/tomcat/webapps/HelloWicket$ ls -ltrR
.:
total 8
-rw-r--r-- 1 vince vince 44 2007-09-04 10:00 index.html
drwxr-xr-x 4 vince vince 4096 2007-09-04 10:27 WEB-INF
./WEB-INF:
total 12
drwxr-xr-x 2 vince vince 4096 2007-09-04 10:00 lib
drwxr-xr-x 3 vince vince 4096 2007-09-04 10:05 classes
-rwxr-xr-x 1 vince vince 755 2007-09-04 10:08 web.xml
./WEB-INF/lib:
total 1648
-rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
-rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
-rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar
./WEB-INF/classes:
total 8
-rw-r--r-- 1 vince vince 601 2007-09-04 10:04 HelloWicket.html
drwxr-xr-x 2 vince vince 4096 2007-09-04 10:20 mypackage
./WEB-INF/classes/mypackage:
total 16
-rw-r--r-- 1 vince vince 238 2007-09-04 10:06 HelloWicket.java
-rw-r--r-- 1 vince vince 192 2007-09-04 10:20 HelloWicketApp.java
-rw-r--r-- 1 vince vince 468 2007-09-04 10:20 HelloWicket.class
-rw-r--r-- 1 vince vince 347 2007-09-04 10:20 HelloWicketApp.class
Thank you,
Vince
Re: NoClassDefFoundError, Tomcat isn't seeing JARs in webapps//lib?
Posted by Ghodmode <gh...@ghodmode.com>.
On 9/4/07, reno <re...@free.fr> wrote:
>
> hello,
>
> ...
your web.xml is a bit different from the Wicket HelloWorld example
> http://wicket.apache.org/examplehelloworld.html
>
> did you try with:
> <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
> ??
> and did you follow this tutorial??
>
Hi Reno. Thank you for your reply. Actually, I followed this tutorial:
http://cwiki.apache.org/WICKET/newuserguide.html In spite of the small note
that it's a little outdated and incomplete, it has had some updates which
reflect differences in the latest version of Wicket.
The package for the current version of WicketServlet is
org.apache.wicket.protocol.http.WicketServlet. However, I used the
servlet-class you recommended when I used the older version, 1.2.6. I still
didn't have any luck.
The only other difference I can see is the development configuration
parameter. I don't think that would affect Tomcat's initial loading of the
classes.
Thank you,
Vince
Re: NoClassDefFoundError, Tomcat isn't seeing JARs in
webapps//lib?
Posted by reno <re...@free.fr>.
hello,
> Here's my web.xml:
> @home:~/dev/tomcat/webapps/HelloWicket/WEB-INF$ cat web.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> <context-param>
> <param-name>configuration</param-name>
> <param-value>development</param-value>
> </context-param>
>
> <servlet>
> <servlet-name>HelloWicket</servlet-name>
> <servlet-class>org.apache.wicket.protocol.http.WicketServlet
> </servlet-class>
> <init-param>
> <param-name>applicationClassName</param-name>
> <param-value>mypackage.HelloWicketApp</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>HelloWicket</servlet-name>
> <url-pattern>/helloWicket/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
your web.xml is a bit different from the Wicket HelloWorld example
http://wicket.apache.org/examplehelloworld.html
did you try with:
<servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
??
and did you follow this tutorial??
Re: NoClassDefFoundError, Tomcat isn't seeing JARs in webapps//lib?
Posted by Ghodmode <gh...@ghodmode.com>.
On 9/4/07, Per Johnsson <Pe...@omxgroup.com> wrote:
>
>
> Just a quick one, how do you start Tomcat? Is it another user? Does the
> directories/apps have the correct rights. And does Tomcat/java have the
> necessery rights to read, and run?
>
>
Hi Per, I start Tomcat using $CATALINA_HOME/bin/startup.sh and stop it with
$CATALINA_HOME/bin/shutdown.sh. I untarred the Tomcat installation with a
normal user (ie: not root) and I start and stop it with the same user that
untarred it. It's in a normal directory inside of my home directory.
Thank you,
Vince
RE: NoClassDefFoundError, Tomcat isn't seeing JARs in
webapps//lib?
Posted by Per Johnsson <Pe...@omxgroup.com>.
Just a quick one, how do you start Tomcat? Is it another user? Does the
directories/apps have the correct rights. And does Tomcat/java have the
necessery rights to read, and run?
Regards Per Jonsson
-----Original Message-----
From: Ghodmode [mailto:ghodmode@ghodmode.com]
Sent: den 4 september 2007 09:22
To: Tomcat Users List
Subject: Re: NoClassDefFoundError, Tomcat isn't seeing JARs in
webapps/<appname>/lib?
On 9/4/07, David Delbecq <de...@oma.be> wrote:
>
> J2EE specs says librairies of a webapp must be in /WEB-INF/lib
> (that's for the part about subjet line where you use /lib)
Thank you David. That was a typo. I am actually using WEB-INF/lib.
Now, for you mail content you seem to be indeed using WEB-INF/lib, and
> it seems to be the 3 libs required by wicket example. I suggest you
> investigate the possibility of having downloaded a broken jar. Maybe,
> try switching away from a beta version....
I've double-checked the JAR file and it's okay, but I re-downloaded it
anyway and I still get the same results. The Wicket download page says
that the latest beta is stable and suggests using it for new projects.
But I tried version 1.2.6 anyway and I have the same results :(
I have become convinced that this is a Tomcat problem. Just to be
thorough, though, I'm going to try with an earlier version of Java.
Wicket's site states that it requires 1.4. I think that it means 1.4
and up, but I'm using 1.6. So, I'll give it a try with 1.5, then with
1.4.
Thank you,
Vince
********************************************************************************
This e-mail and the information it contains may be privileged and/or
confidential. It is for the intended addressee(s) only.
The unauthorised use, disclosure or copying of this e-mail, or any information it contains, is prohibited.
If you are not an intended recipient, please contact the sender and delete the material from your computer.
********************************************************************************
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: NoClassDefFoundError, Tomcat isn't seeing JARs in webapps//lib?
Posted by Ghodmode <gh...@ghodmode.com>.
On 9/4/07, David Delbecq <de...@oma.be> wrote:
>
> J2EE specs says librairies of a webapp must be in /WEB-INF/lib (that's
> for the part about subjet line where you use /lib)
Thank you David. That was a typo. I am actually using WEB-INF/lib.
Now, for you mail content you seem to be indeed using WEB-INF/lib, and
> it seems to be the 3 libs required by wicket example. I suggest you
> investigate the possibility of having downloaded a broken jar. Maybe,
> try switching away from a beta version....
I've double-checked the JAR file and it's okay, but I re-downloaded it
anyway and I still get the same results. The Wicket download page says that
the latest beta is stable and suggests using it for new projects. But I
tried version 1.2.6 anyway and I have the same results :(
I have become convinced that this is a Tomcat problem. Just to be thorough,
though, I'm going to try with an earlier version of Java. Wicket's site
states that it requires 1.4. I think that it means 1.4 and up, but I'm
using 1.6. So, I'll give it a try with 1.5, then with 1.4.
Thank you,
Vince
Re: NoClassDefFoundError, Tomcat isn't seeing JARs in webapps//lib?
Posted by David Delbecq <de...@oma.be>.
J2EE specs says librairies of a webapp must be in /WEB-INF/lib (that's
for the part about subjet line where you use /lib)
Now, for you mail content you seem to be indeed using WEB-INF/lib, and
it seems to be the 3 libs required by wicket example. I suggest you
investigate the possibility of having downloaded a broken jar. Maybe,
try switching away from a beta version....
Ghodmode a écrit :
> This is related to my previous email thread, but slightly different
> circumstances.
>
> Apache Tomcat 6.0.14
> Java 1.6.0_02-b05
> Wicket 1.3.0-beta3
>
> I'm trying to run a Wicket application and it's not working. I'm getting a
> NoClassDefFoundError:
>
> java.lang.NoClassDefFoundError:
> org/apache/wicket/protocol/http/WebApplication
>
> I think I must be misunderstanding something basic about Tomcat web
> application deployment.
>
> So, I create a basic "HelloWorld" type servlet to try and troubleshoot the
> problem.
>
> I've double- and triple-checked the package against the documentation and
> even verified it by listing the contents of the JAR with unzip.
>
> What am I doing wrong?
>
> The Wicket JAR file and two of its dependencies are in WEB-INF/lib:
> @home:~/dev/tomcat/webapps/HelloWicket/WEB-INF/classes$ ls -ltr ../lib
> total 1648
> -rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
> -rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
> -rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar
>
>
> Here's my web.xml:
> @home:~/dev/tomcat/webapps/HelloWicket/WEB-INF$ cat web.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> <context-param>
> <param-name>configuration</param-name>
> <param-value>development</param-value>
> </context-param>
>
> <servlet>
> <servlet-name>HelloWicket</servlet-name>
> <servlet-class>org.apache.wicket.protocol.http.WicketServlet
> </servlet-class>
> <init-param>
> <param-name>applicationClassName</param-name>
> <param-value>mypackage.HelloWicketApp</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>HelloWicket</servlet-name>
> <url-pattern>/helloWicket/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
> Here's the layout of my servlet's directory:
> @home:~/dev/tomcat/webapps/HelloWicket$ ls -ltrR
> :
> total 8
> -rw-r--r-- 1 vince vince 44 2007-09-04 10:00 index.html
> drwxr-xr-x 4 vince vince 4096 2007-09-04 10:27 WEB-INF
>
> /WEB-INF:
> total 12
> drwxr-xr-x 2 vince vince 4096 2007-09-04 10:00 lib
> drwxr-xr-x 3 vince vince 4096 2007-09-04 10:05 classes
> -rwxr-xr-x 1 vince vince 755 2007-09-04 10:08 web.xml
>
> /WEB-INF/lib:
> total 1648
> -rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
> -rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
> -rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar
>
> /WEB-INF/classes:
> total 8
> -rw-r--r-- 1 vince vince 601 2007-09-04 10:04 HelloWicket.html
> drwxr-xr-x 2 vince vince 4096 2007-09-04 10:20 mypackage
>
> /WEB-INF/classes/mypackage:
> total 16
> -rw-r--r-- 1 vince vince 238 2007-09-04 10:06 HelloWicket.java
> -rw-r--r-- 1 vince vince 192 2007-09-04 10:20 HelloWicketApp.java
> -rw-r--r-- 1 vince vince 468 2007-09-04 10:20 HelloWicket.class
> -rw-r--r-- 1 vince vince 347 2007-09-04 10:20 HelloWicketApp.class
>
>
> Thank you,
> Vince
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: NoClassDefFoundError, Tomcat isn't seeing JARs in webapps//lib?
Posted by Ghodmode <gh...@ghodmode.com>.
I'm happy to say that I have discovered the solution to this problem as well
as my problem with NoClassDefFoundError for HttpServlet...
The problem seemed intermittent and now I know why. It depended on what
directory I was in when I started Tomcat.
I wanted to save myself some typing, so I made symbolic links to
$CATALINA_HOME/bin/startup.sh and $CATALINA_HOME/shutdown.sh and put them in
~/bin, which I've added to my path.
I know there is some code in those shell scripts to detect if the command
that called it is a symbolic link and take appropriate actions based on
that, but I guess it doesn't work perfectly.
I've changed my symlinks to actual scripts, with two lines each. Change to
the Tomcat directory, then run startup.sh. Now everything works fine every
time :)
Thank you all for your time and consideration.
-- Vince
On 9/4/07, Ghodmode <gh...@ghodmode.com> wrote:
>
> This is related to my previous email thread, but slightly different
> circumstances.
>
> Apache Tomcat 6.0.14
> Java 1.6.0_02-b05
> Wicket 1.3.0-beta3
>
> I'm trying to run a Wicket application and it's not working. I'm getting
> a NoClassDefFoundError:
>
> java.lang.NoClassDefFoundError:
> org/apache/wicket/protocol/http/WebApplication
>
> I think I must be misunderstanding something basic about Tomcat web
> application deployment.
>
> So, I create a basic "HelloWorld" type servlet to try and troubleshoot the
> problem.
>
> I've double- and triple-checked the package against the documentation and
> even verified it by listing the contents of the JAR with unzip.
>
> What am I doing wrong?
>
> The Wicket JAR file and two of its dependencies are in WEB-INF/lib:
> @home:~/dev/tomcat/webapps/HelloWicket/WEB-INF/classes$ ls -ltr ../lib
> total 1648
> -rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
> -rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
> -rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar
>
>
> Here's my web.xml:
> @home:~/dev/tomcat/webapps/HelloWicket/WEB-INF$ cat web.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
> <context-param>
> <param-name>configuration</param-name>
> <param-value>development</param-value>
> </context-param>
>
> <servlet>
> <servlet-name>HelloWicket</servlet-name>
> <servlet-class>
> org.apache.wicket.protocol.http.WicketServlet</servlet-class>
> <init-param>
> <param-name>applicationClassName</param-name>
> <param-value>mypackage.HelloWicketApp
> </param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>HelloWicket</servlet-name>
> <url-pattern>/helloWicket/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
> Here's the layout of my servlet's directory:
> @home:~/dev/tomcat/webapps/HelloWicket$ ls -ltrR
> .:
> total 8
> -rw-r--r-- 1 vince vince 44 2007-09-04 10:00 index.html
> drwxr-xr-x 4 vince vince 4096 2007-09-04 10:27 WEB-INF
>
> ./WEB-INF:
> total 12
> drwxr-xr-x 2 vince vince 4096 2007-09-04 10:00 lib
> drwxr-xr-x 3 vince vince 4096 2007-09-04 10:05 classes
> -rwxr-xr-x 1 vince vince 755 2007-09-04 10:08 web.xml
>
> ./WEB-INF/lib:
> total 1648
> -rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
> -rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
> -rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar
>
> ./WEB-INF/classes:
> total 8
> -rw-r--r-- 1 vince vince 601 2007-09-04 10:04 HelloWicket.html
> drwxr-xr-x 2 vince vince 4096 2007-09-04 10:20 mypackage
>
> ./WEB-INF/classes/mypackage:
> total 16
> -rw-r--r-- 1 vince vince 238 2007-09-04 10:06 HelloWicket.java
> -rw-r--r-- 1 vince vince 192 2007-09-04 10:20 HelloWicketApp.java
> -rw-r--r-- 1 vince vince 468 2007-09-04 10:20 HelloWicket.class
> -rw-r--r-- 1 vince vince 347 2007-09-04 10:20 HelloWicketApp.class
>
>
> Thank you,
> Vince
>