I also get resource unavailable when I try something very similar:
All I want to do is verify that I can register a servlet.  Here's what I
did:

I added a subdirectory under webapps, called solitaire.

I added the following context entry to server.xml:
        <!-- Solitaire registration for home directory -->
        <Context path="/solitaire" docBase="solitaire" 
         debug="0" privileged="true"/>

I copied HelloWorldExample (and the properties files) to:
        webapps\solitaire\WEB-INF\classes\HelloWorldExample.class

and I added the following web.xml in webapps\solitaire\WEB-INF\
<!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>
    <!-- Define servlets that are included in the solitaire application -->

   <servlet>
        <servlet-name>HelloWorldExample</servlet-name>
        <servlet-class>HelloWorldExample</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloWorldExample</servlet-name>
        <url-pattern>/HelloWorldExample</url-pattern>
    </servlet-mapping>

</web-app>

Any hints?

later,
 
Jeff Oakes
(860)-843-3918 Windsor
(860)-673-4816 Home
(860)-547-4620 Hartford


-----Original Message-----
From: Andreas Mohrig [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 12:12 PM
To: 'Tomcat Users List'
Subject: RE: Dumb Question com.justatest.test.MyServlet error


I just experimented with this a bit. It seems tomcat provides standard
mappings for the servlets you deploy under the document base of your webapp.
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.

greetings

Andreas Mohrig

-----Original Message-----
From: John-Paul Delaney [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 9:43 PM
To: Tomcat Users List
Subject: RE: Dumb Question com.justatest.test.MyServlet error


Hello... Sorry about pushing so - but I'm stuck with this one....

What URL do I use to launch the servlet MyServlet deployed (not a .war) as:

<tomcat-root>/webapps/jat/classes/com/justatest/test/MyServlet.class?

(<tomcat-root>/webapps/jat/classes/MyServlet.class launches successfully
with 
this url:

http://localhost:8080/jat/servlet/MyServlet)

I'm running tomcat 4.0.1 with sun jdk 1.3.1 on redhat 7.0.

thanks for any help,
/j-p. 



Quoting Miguel Angel Mulero Martinez <[EMAIL PROTECTED]>:

> Maybe the InitSnoop.java don't start with "package com.justatest.test;"
> 
> 
> -----Mensaje original-----
> De: John-Paul Delaney [mailto:[EMAIL PROTECTED]]
> Enviado el: viernes, 20 de septiembre de 2002 12:43
> Para: [EMAIL PROTECTED]
> Asunto: Dumb Question ../servlet/com.justatest.test.MyServlet error
> 
> Hello List...
> 
> I've created the directory path:
>  <tomcat-root>webapps/jat/WEB-INF/classes/com/justatest/test/
> 
> but I get an error when I try to run the oreilly servlet from URL:
> http://localhost:8080/jat/servlet/com.justatest.test.InitSnoop
> 
> 
> The same servlet will run ok from URL:
> http://localhost:8080/jat/servlet/InitSnoop
> 
> The exception is:
> Cannot allocate servlet instance for
> path /jat/servlet/com.justatest.test.InitSnoop
> 
> cause:
> lang.NoClassDefFoundError: com/justatest/test/InitSnoop (wrong name:
> InitSnoop)
> 
> Any suggestions on what I'm doing wrong would be appreciated,
> 
> thanks
> /j-p.
> 


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

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to