|
Hi,
I looked at the web.xml file...and I did not feel
confident about where to put the code you said...maybe at the beginning where I
can see some other similar codes? And, I have a question, do I have to
update this web.xml file whenever I put servlet classes in a package? Say,
if I create another servlet file called Xyz in a package called abc, then I will
have to update this web.xml file again with
<servlet-class>abc.xyz</servlet-class> statement?
Thanks, June
----- Original Message -----
Sent: Wednesday, August 08, 2001 10:03
PM
Subject: Re: running servlet in
package
Hi,
in place of :
<servlet-class>test.<yourServletName></servlet-class> put
<servlet-class>test.<yourServletClassName></servlet-class>
instead.
Sorry for that! See you
"Goulas, Theodor" wrote:
Hello,
first make sure that your code (class file ) is placed in a folder called
test. Add the file to your classpath. Then check your web.xml file.
You have to include in your
<servlet-class>test.<yourServletName></servlet-class> and
you have to reference to your servlet by the alias name you gave it to it.
That is the name in the following tag: <servlet-name>yourServletName
</servlet-name> Then to call your servlet you have to call it this
way: http://localhost:8080/contextPath/servlet/yourServletName
Hope this help! See you! June wrote:
I am reading Core Servlets and JSP and trying to run a
servlet in a package. I have put "package test; " in the source code
and compiled it in the dos using javac -d
c:\jakarta\webapps\root\web-inf\classes HelloWorld.java with no
problem. After running that command, I have this class file in the
c:\jakarta\webapps\root\web-inf\classes\test. However, when I type
"localhost/servlet/test.HelloWorld" in the explorer, I get the following
error. 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.java:430)
at
org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.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:797)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)Please
tell me what I am doing wrong. The Apache server and the tomcat are
running just fine, because I can run this servlet(without the package
statement) by typing localhost/servlet/HelloWorld with no problem.
Cheers,
June
|