aspose file tools
The moose likes Servlets and the fly likes web-app directory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "web-app directory" Watch "web-app directory" New topic
Author

web-app directory

Saif Ullah
Greenhorn

Joined: Mar 21, 2002
Posts: 29
Hi all Ranchers!
I am working hard to find out this problem but alas!
1: a Compiled servlet class and its mapping web.xml has been placed in the directory of tomcat 4.0 as
d:\tomcat\webapps\ROOT\WEB-INF\

2: but even after restarting the server the message is produced while accessing the server that "the specified "name of servlet" is not available.
3: When I placed these two files in the tomcat 4.0 directory
d:\tomcat\classes\
It works fine, and its init() methods parameters are initialized.
4: When I placed these two files in JSDK 2.0
directory:
d:\jsdk\webpages\WEB-INF\
the servlet is successfully accessed but the init() method parameters are not initialized to the specified values assigned through web.xml deployment descriptor.
Please let me know what is wrong with this
A Java Student
Saif Ullah
SCJP2
Mike Dunn
Greenhorn

Joined: Apr 24, 2002
Posts: 4
1 and 2: If your servlet class is in the default package, then your class file goes under d:\tomcat\webapps\ROOT\WEB-INF\classes\
If your servlet is an a package, say com.javaranch, then it goes under d:\tomcat\webapps\ROOT\WEB-INF\classes\com\javaranch\
In both cases, the web.xml file always goes under d:\tomcat\webapps\ROOT\WEB-INF\
3: Classes in d:\tomcat\classes\ are global to all applications, and so wouldn't be the place to put your class file.
4: Sorry, I'm not familiar with JSDK 2.0
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
hai
this is just a wild guess..
4. init parameters are initialized only when servlet is loaded into JVM. Ur servelt may be already present in memmory when u tried to acess and so init is not getting triggered.
Hope this helps
Rgds
Manohar
Dbugmaker
Greenhorn

Joined: May 05, 2002
Posts: 1
Well About this problem u just put ur classes in a new folder in webapps suppose
c:\tomcat\webapps\newfolder\web-apps\classes
put ur web.xml in newfolder
and for loading init() on startup write <load-on-startup>1 </load-on-startup> in ur xml
hope this will help
CU
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Dbugmaker... and what a prophetic choice that was...

Please update your display name to correspond with our naming policy

As for the prophetic aspect of your name:
c:\tomcat\webapps\newfolder\web-apps\classes

the web-apps folder should be WEB-INF and web.xml should go in WEB-INF (not newfolder)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: web-app directory
 
Similar Threads
How can make .war file for IBM websphere configurable?
Problem: Beans with JSP in Tomcat
How to run a servlet using Tomcat?
Tomcat is unable to detect web.xml from WAR
ServletConfig getInitParameter() ????