You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by john-paul delaney <jp...@justatest.com> on 2002/09/21 23:30:03 UTC

RE: Solved! Dumb Question com.justatest.test.MyServlet error

That was it... thanks a bunch for figuring it out for me Jon.
With Regards
/j-p.


On Sat, 21 Sep 2002, jon wingfield wrote:

> Open the InitSnoop.java source file. If the first line is not:
> 
> package com.justatest.test;
> 
> then that is your problem. The directory structure under WEB-INF/classes
> maps to the package stucture of your servlet and other java classes deployed
> in the webapp.
> 
> Change the package name to the right one, recompile the class, redeploy and
> that should be it. Your servlet mapings are otherwise ok.
> 
> Jon
> 
> -----Original Message-----
> From: john-paul delaney [mailto:jp@justatest.com]
> Sent: 21 September 2002 00:22
> To: Tomcat Users List
> Subject: RE: Dumb Question com.justatest.test.MyServlet error
> 
> 
> Thanks Andreas... at first I didn't want to use any web.xml entries as this
> was just a test directory to run the examples of the oreilly book.  I just
> wanted to compile the examples and run them without messing with web.xml.
> 
> Nevertheless, I took your advice but I get the same server exceptions
> (cannot allocate servlet instance for path
> /jat/servlet/com.justatest.test.InitSnoop ... and ... cause
> NoClassDefFoundError: com/justatest/test/InitSnoop (wrong name: InitSnoop))
> even when I run http://localhost:8080/jat/servlet/MyServletName after adding
> your entry into web.xml and restarting the server.
> 
> It's looking like the problem lies somewhere else i.e. the url's I've been
> using are correct?
> 
> thanks
> /j-p.
> 
> 
> On Fri, 20 Sep 2002, Andreas Mohrig wrote:
> 
> > A servlet residing in
> > <tomcat-root>/webapps/jat/classes/com/justatest/test/MyServlet.class
> > should be reachable under
> > http://yourserver/jat/servlet/com.justatest.test.MyServlet , at lest if
> you
> > put it in the right package ("package com.justatest.test;", see the other
> > answer below).
> 
> 
> 
> 
> 
> > If you define your servlet in your web.xml (which - in my humble opinion -
> > you should always do), you get some more URLs for your servlet. The
> > following will give you
> >
> > http://yourserver/jat/servlet/MyServletName
> >
> > and
> >
> > http://yourserver/jat/MyServletURL
> >
> >     <servlet>
> >         <servlet-name>MyServletName</servlet-name>
> >         <servlet-class>com.justatest.test.MyServlet</servlet-class>
> >     </servlet>
> >     <servlet-mapping>
> >         <servlet-name>MyServletName</servlet-name>
> >         <url-pattern>/MyServletURL</url-pattern>
> >     </servlet-mapping>
> >
> > Try it and tell us if it works for you too.
> >
> -----------------------
>  JUSTATEST Art Online
>   www.justatest.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-----------------------
 JUSTATEST Art Online
  www.justatest.com




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>