Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tomcat isn't seeing JARs in webapps/<appname>/lib?

Status
Not open for further replies.

Ghodmode

Programmer
Feb 17, 2004
177
NZ
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

Apache Tomcat 6.0.14
Java 1.6.0_02-b05
Wicket 1.3.0-beta3

I think I must be misunderstanding something basic about Tomcat web application deployment.

So, I create a basic "HelloWorld" type servlet using Wicket 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:
Code:
@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:
Code:
@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"
   "[URL unfurl="true"]http://java.sun.com/dtd/web-app_2_3.dtd">[/URL]
<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:
Code:
@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,

--
-- Ghodmode

Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top