Deploy servlet error(Kindly Help me please)
What the step by step method of deploying a servlet.
This what I did to deploy servlet.
1). I created a"servlet.java" File
2). Compiled it on my machine.
3). Then on the machine I want to deploy it I created a folder"TestServlet" in tomcats webapps.
4).Under"TestServlet" I created"WEB-INF" folder
5). Under"WEB-INF" I created"classes"and"lib"folder.
6). Then I kept the java and class files in"classes" folder and all the .jar files in"lib"folder
7). But I access page form web browser it gave me following error.
HTTP Status 500 -
--
type Exception report
message
description The server encountered an internal error () that prevented it from fulfillingthis request.
exception
java.lang.NullPointerException
MyPdfServlet.doGet(MyPdfServlet.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
--
Apache Tomcat/5.5.9
I tried searching on the net but nothing gave me satisfactory answer.
Thanx for your help in advance.
Any help is appreciated.
:)
[1401 byte] By [
nitin403a] at [2007-11-27 11:02:32]

# 1
Hi,
There need to be one more file required for any web application, web.xml. I have added sample web.xml entry.
Following changes i made in your steps.
1). I created a "MyServlet.java" File
2). Compiled it on my machine.
3). Then on the machine I want to deploy it I created a folder "MyServlet" in tomcats webapps.
4). Under "MyServlet" I created "WEB-INF" folder
5). Under "WEB-INF" I created "classes" and "lib" folder.
6). Then I kept the class files in "classes" folder.
7). then i added web.xml under WEB-INF folder.
<?xml version="1.0" encoding="UTF-8"?>
<!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 id="WebApp_ID">
<display-name>SampleWeb</display-name>
<servlet>
<servlet-name>MyServlet</servlet-name>
<display-name>MyServlet</display-name>
<description></description>
<servlet-class>
MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
Try with the url http://localhost:8080/MyServlet/MyServlet
The First MySerlvet in the URL is URL-Pattern and the second MyServlet is actual servlet
Hope this will help u.
Cheers!!!
Kamatchi Sundaram.R
# 2
The topicstarter is crossposting (please never do that, it is considered rude) and this has nothing to do with JSF.
Also your solution certainly doesn't solve the NullPointerException. His servlet is successfully deployed, but simply written with bad code.
Please continue here: http://forum.java.sun.com/thread.jspa?threadID=5196556
# 3
Sorry for that crossposting.
Initailly I didn't find the right forum for this topic.
On seeing server in the forum name I posted here.
After finding the right forum I copy pasted in that forum.
Once again I very sorry for my mistakes.
:)