GeeCON Prague 2014*
The moose likes Servlets and the fly likes How to do Deployment ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "How to do Deployment ?" Watch "How to do Deployment ?" New topic
Author

How to do Deployment ?

Soni Mitesh
Ranch Hand

Joined: Sep 02, 2007
Posts: 33
Hello friends,
I have tried to do deployment of servlet / jsp files
but unable to execute it in a browser.
I have tried performing it by reading the book head first servlet.
could you please make me understand or give me steps
how to create directories in Tomcat and then how to execute
for exam. http://mymagazine.com:8080/form.html or (myServlet)
such example is there in the book, but by passing this url
file not found error occurs...

Thanks
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Hi,
Check whether your application server(Tomcat/Weblogic etc) is in running mode.
Also confirm that,whether you have put the servlet class file and jsp file in a proper place.
(For jsp, put it in your web application folder.For servlet,put it in the WEB-INF/classes folder.
Also check whether you have prepared the propered deployment descriptor file(web.xml inside WEB-INF folder).



Baseet Ahmed.
Information Technologist.

***********************************
Tip: Modesty is all virtue.
***********************************
Soni Mitesh
Ranch Hand

Joined: Sep 02, 2007
Posts: 33
hey thanks ,

the directory structure i have created as per the
instructions given in the book,
but the program is not working.
I am able to get desired output if i do
all savings in default directories.
it would be nice if you just tell me that
in c:\jakarta-tomcat>...
where i have to create directories...
thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Soni Mitesh:

the directory structure i have created as per the
instructions given in the book,


If that were the case, it would be working.
That's probably the most popular book out there right now and it seems to be working for most everybody else.

Rather than ask us to repeat what's in it, why don't you post the directory structure that you have and see if someone here can see what's wrong with it.
When you do, please be careful about spelling and (especially) capitalization. Also, if you use UBB Code Tags your indenting will be preserved. This usually makes it easier to show directory structures.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Hello Mitesh,

As asked,use following directory structure if applicable:

C:\jakarta-tomcat\webapps\WebAppFolder\
C:\jakarta-tomcat\webapps\WebAppFolder\WEB-INF
C:\jakarta-tomcat\webapps\WebAppFolder\WEB-INF\classes
C:\jakarta-tomcat\webapps\WebAppFolder\WEB-INF\web.xml
C:\jakarta-tomcat\webapps\AppFolder\jspfiles

...
Give anyname to this directory WebAppFolder.

Remember to do the servlet-mapping in web.xml file as per the servlet and xml standards.


Baseet Ahmed.
Information Technologist.

***********************************
Tip: Modesty is all virtue.
***********************************
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Soni Mitesh:
Hello friends,
I have tried to do deployment of servlet / jsp files
but unable to execute it in a browser.
I have tried performing it by reading the book head first servlet.
could you please make me understand or give me steps
how to create directories in Tomcat and then how to execute
for exam. http://mymagazine.com:8080/form.html or (myServlet)
such example is there in the book, but by passing this url
file not found error occurs...

Thanks


I would suggest you to follow following steps:

1. Test URL: http://localhost:8080 (8080 is tomcat's default port. You can confirm it in server.xml presents in conf folder).

If this doesn't show you "tomcat screen" then your server is not started. In this case, download tomcat (from "apache site") and JDK (from "sun site"), unzip them in some directory. Add following two lines in startup.bat file (present in bin directory of tomcat):

set JAVA_HOME=<your jdk path>
set CATALINA_HOME=<your tomcat path>

2. Now double click startup.bat, check the URL mentioned above - it should work now.

3. Now place your application in webapps folder of tomcat. For time being, create a simple application that has single JSP file.

c:\tomcat\webapps\simpleapplication\test.jsp

I don't think you need WEB-INF folder (and web.xml file inside it) for this application as you don't have any java class (and servlet).

Now try this URL: http://localhost:8080/simpleapplication/test.jsp

Give it a try.
[ November 06, 2007: Message edited by: ankur rathi ]
prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
well , what error /status code do you get when you try to run your jsp/servlet?
 
GeeCON Prague 2014
 
subject: How to do Deployment ?