File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes servlet context problem tomcat7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "servlet context problem tomcat7 " Watch "servlet context problem tomcat7 " New topic

servlet context problem tomcat7

andy brookes

Joined: Jun 29, 2008
Posts: 6

I have tomcat7 set up on Slackware 13.37 on my personal PC as a none production web development set up .Tomcat is running Ok, welcome page is up and webmanager working and configured. I also got a simple web app deployed using webapp manager and a war file.

Taglibs work with jars in WEB-INF/lib.However I have to reference taglibs like so :
<%@ taglib uri="WEB-INF/lib/bartag.jar" prefix="bar" %>

tomcat doesn’t like it if I add an entry to web.xml ( in ROOT) like:



if fact if I do this it sabotages the welcome page coming up. Taking out the taglib entry from web.xml and restarting tomcat gets everything working OK again. Another thing I noticed another web.xml in tomcat/conf directory.

Also I have a problem with servlet context; previously with other versions of Tomcat
I just used ROOT directory and put for example :



into the ROOT web.xml ,and the servlet class into the ROOT/WEB-INF/classes

In previous versions of Tomcat I could get a servlet to launch. Now I have noticed doing anything to web.xml tomcat doesn’t like it .Also I got a simple web app working and again tomcat7 doesn’t seem to like anything done to the webapp/WEB-INF/web.xml file.

I have done some googling and a mention of META-INF comes up , but can not get any nitty gritty details. Also have had a look at tomcat docs, but after about 3 minutes my eyes glaze over.

QUESION: Can some tell me what is the preferred method to reference a servlet with tomcat7 ?

Whats the web.xml doing in tomcat7/conf when there is another web.xml in ROOT ?

One other thing to mention tomcat has permissions to files in ROOT which can be tedious
if you have say jsp files in your home directory and having to keep doing

# cp my.jsp /var/lib/tomcat/webapps/ROOT

previously to get around this I just did chown of ROOT to my user log in name, which allowed cut/copy and paste .This time I installed tomcat, then added a new user and added the group “tomcat” to the new user group list. This allows me to copy paste from home directory to ROOT. It hasn’t caused any probs that I can detect, unless its connected in some way to th above isues.

andy brookes

Joined: Jun 29, 2008
Posts: 6
well have now got servlets working, by editing web.xml in ROOT/WEB-INF

don't know why it didn't work earlier unless editing of web.xml was not updating maybe had two edit windows open at same time ?

once I get used to this don't think I will rush to tomcat8- now I know why some people are still using tomcat5.5!
I agree. Here's the link:
subject: servlet context problem tomcat7
It's not a secret anymore!