File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes can't access class files under WEB-INF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "can Watch "can New topic

can't access class files under WEB-INF

L. Wahana

Joined: Jun 30, 2002
Posts: 3
Can anyone help me with this problem?
Is there any setting at Tomcat or Apache to disable accessing WEB-INF directory?
Because I can access jsp, but unable to run servlet or accessing class under WEB-INF from this jsp. The chmod is 755, but still i cant access it.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You need a folder named 'classes' in the WEB-INF where you put all *.class and you need to configure the servlets in web.xml

Regards, Rene Larsen
Dropbox Invite
L. Wahana

Joined: Jun 30, 2002
Posts: 3
I created classes folder under WEB-INF, and I also defined servlet and servlet mapping at web.xml. But, still doesnt work.
In my local machine it worked fine, but not in my ISP machine. I have no idea how to solve this problem. There may be a configuration file that I need to set up.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13025
If your classes are not in a package, this could be the problem. When some servers see a class in the default package they look in the wrong place.
L. Wahana

Joined: Jun 30, 2002
Posts: 3
I did put the class in a package.
I found that there is examples.war running in my ISP machine. The difference with my web application is:
My web application is linked (using soft link) from tomcat/webapps directory.
Examples web-applications is physically under web-apps.
My ISP machine is using Red Hat Linux.
I agree. Here's the link:
subject: can't access class files under WEB-INF
It's not a secret anymore!