tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <randy.lay...@aswethink.com>
Subject RE: specifying servlet in subdirectory in web.xml
Date Thu, 24 Jan 2002 11:58:35 GMT

	The directories under the classes directory correspond to the
package statement used in the source file.  If you want to call your class
hello.HelloWorldExample then you need to put "package hello;" as the first
line of HelloWorldExample.java and recompile.

	Randy
 

> -----Original Message-----
> From: Cressatti, Dominique [mailto:Dominique.Cressatti@lansa.co.uk]
> Sent: Thursday, January 24, 2002 7:40 AM
> To: Tomcat Users List
> Subject: specifying servlet in subdirectory in web.xml
> 
> 
> Hi,
>  
> how do I specify the location of class in a subdirectory.
>  
> I have HelloWorldExample.class and LocalStrings.properties under
> /webapps/test/WEB-INF/classes
> and my web.xml looks like:
> ...
> <servlet>
>     <servlet-name>hello</servlet-name>
>     <servlet-class>HelloWorldExample</servlet-class>
> </servlet>
>  
> <servlet-mapping>
>     <servlet-name>hello</servlet-name>
>     <url-pattern>/hello</url-pattern>
> </servlet-mapping>
> ...
>  
> It all works find I point my browser to 
> http://localhost:8080/test/hello.
> However if I move HelloWorldExample.class and 
> LocalStrings.properties under
> /webapps/test/WEB-INF/classes/hello
> and change my web.xml (to reflect the move) to:
> ... 
> <servlet>
>     <servlet-name>hello</servlet-name>
>     <servlet-class>hello.HelloWorldExample</servlet-class>
> </servlet>
> ...
> 
> pointing my browser to http://localhost:8080/test/hello
> comes up with:
> error 500
> location/test/hello
> internal error
> java.lang.NoClassDefFoundError: hello/HelloWorldExample 
> (wrong name: HelloWorldExample)
> ....
> why? I suspect that didn't define the path in <servlet-class> 
> correctly so what's the right syntax?
>  
> Thanks
> Dom
> 
> 

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message