• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet is not available

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to deploy a servlet in the tomcat. I have written the code using netbeans and i have copied the directory structure to tomcat/webapps folder.

Directory structure:-
D:\apache-tomcat-5.5.20\webapps\Demo
D:\apache-tomcat-5.5.20\webapps\Demo\WEB-INF
D:\apache-tomcat-5.5.20\webapps\Demo\WEB-INF\classes
D:\apache-tomcat-5.5.20\webapps\Demo\WEB-INF\classes\java

My web.xml is under D:\apache-tomcat-5.5.20\webapps\Demo\WEB-INF:-
====================================================================

=============================================================
My Welcome.class is under D:\apache-tomcat-5.5.20\webapps\Demo\WEB-INF\classes\java.

Welcome.java:-
==============================================================

=========================================================================

The index.jsp is working fine.

Please help me resolve this.


[BSouther: Added UBB CODE tags]

[ March 16, 2007: Message edited by: Ben Souther ]
[ March 17, 2007: Message edited by: Bear Bibeault ]
 
Raghuram Chaluvadi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the url i am using :-

http://localhost:8080/Demo/Welcome
 
Raghuram Chaluvadi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Is there anyone who can help me with this please....
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot find what are you asking? What is your problem? I've just seen the description of your code, but not what errors/stack traces you get...
 
Raghuram Chaluvadi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It says the servlet dummy_Welcome not found . with an http 404 error.

Then i put a new servlet right under the classes folder. It worked. So is it an issue with packages or so..?
 
Joan Horta Tosas
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We should always use a package with your classes. Recent tomcats doesn't allow you to deploy without packages. Your problem could be (haven't checked it, you can look for it if you want) using a package starting (or named) java, which possibly is protected. Try using another (not pertaining to Sun's API's domains) and tell us if it was your problem.
 
Raghuram Chaluvadi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey

Thanks a lot!!! Simple but great observation!! it worked
But if this the case probably netbeans needs a little modification to the package structure!
 
Joan Horta Tosas
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, I think it's not due to a Netbeans issue... After I wrote the reply yesterday, I tried making a class, compiling it and running it with Eclipse and Sun's JDK, and the package name was java (as yours).
So I got curious and investigated, and I've found the "problem". Inside the Tomcat docs, the Classloader HOW-TO gives an idea of it. The bootstrap classloader contains the JRE classes, and your class was loaded from one of multiple "webapp" classloaders (the one for your app). As it is stated nearly the end, since J2SE 1.4 you cannot override any of the J2SE base classes from within your web-app (or any other classloader). Haven't looked at the code, but I suppose they accomplish this protecting the java and javax packages (and others that are inside the JRE).
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java specification

Names of packages intended only for local use should have a first identifier that begins with a lowercase letter, but that first identifier specifically should not be the identifier java; package names that start with the identifier java are reserved by Sun for naming Java platform packages.
 
Joan Horta Tosas
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that info. Actually, I've never read the Java specification, just the ones about Servlets and JSPs
 
Right! We're on it! Let's get to work tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic