• Post Reply Bookmark Topic Watch Topic
  • New Topic

web-app directory

 
Saif Ullah
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!