You have nothing telling tomcat to map a URL to your registered 
servlet.  You would do that like this:

<servlet>
         <servlet-name>hello</servlet-name>
         <servlet-class>foo.bar.baz.HelloWorld</servlet-class>
</servlet>

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

note that the "<servlet-name>" does not have anything to do with mapping a 
URL.  It is strictly for referring to a specified servlet in the web.xml file.

Also, make sure you put ALL <servlet> tags BEFORE <servlet-mapping> tags.

Do this and your example will work like a charm.

Keep in mind that if you want this to run through Apache on port 80, you 
will have to provide this mapping again in the mod_jk.conf connector config 
file by adding:

JkMount /practice/hello ajp13

after adding that, you would need to restart Apache to reload the 
mod_jk.conf file.

Jake

At 08:24 AM 12/30/2000 -0800, you wrote:
>Hello group -- I am trying to access a servlet via an alias. This I thought
>was done through the web.xml file in my directory
>webapps\practice\Web-inf\web.xml - practice is of course the name of my web
>application. I have changed only my web.xml file to run my servlet --
>
>This is what I have put into my web.xml file (this is the only thing in it).
><servlet>
>      <servlet-name>hello</servlet-name>
>      <servlet-class>foo.bar.baz.HelloWorld</servlet-class>
></servlet>
>
>When I try to run my servlet by going to
>http://localhost:8080/practice/servlet/hello
>
>I get this error (What am I doing wrong -- Pete ) [EMAIL PROTECTED]
>
>Error: 500
>Location: /practice/servlet/hello
>Internal Servlet Error:
>
>java.lang.NullPointerException
>  at java.lang.ClassLoader.resolveClass0(Native Method)
>  at java.lang.ClassLoader.resolveClass(ClassLoader.java:588)
>  at
>org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.j
>ava:518)
>  at
>org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoad
>er.java:174)
>  at
>org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:265)
>  at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
>  at org.apache.tomcat.core.Handler.service(Handler.java:254)
>  at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>  at
>org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
>7)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>  at
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
>onnectionHandler.java:210)
>  at
>org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>  at
>org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>  at java.lang.Thread.run(Thread.java:484)
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to