Cannot load servlet(s)

This is very strange to me. I've never had a problem like this before. I just started using Tomcat 5.5 (I used to use older versions) and after deploying I cannot seem to access any serlvets. I took everything out except for this one servlet and reduced to my web.xml file to map the one servlet. Here are the contents of my web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app

PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<display-name>My APP</display-name>

<description>

This is my app

</description>

<servlet>

<servlet-name>SignIn</servlet-name>

<servlet-class>SignIn</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>SignIn</servlet-name>

<url-pattern>servlet/SignIn</url-pattern>

</servlet-mapping>

</web-app>

Everything is in the right place and the jsp files load just fine, but I cannot access the SignIn servlet. I tried some of the example servlets already in Tomcat and they work just fine. I also see no difference in their web.xml files from mine.

I also never made any changes to conf/web.xml as I don't want the invoker running (I've read about security flaws when using it). Any thoughts? Thanks in advance.

[1581 byte] By [uberallesa] at [2007-11-27 2:54:42]
# 1

Just a wild guess here. Since you've switched to Tomcat 5.5, it comes with the implementation of servlet specification 2.4, so try this for the header of web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

On the other hand, I see that the class name of your servlet is not fully qualified - just SignIn is not enough, there should be at least some package name, like:

org.myorg.SignIn

depending on your package structure.

Regards,

Oleg

Message was edited by:

JOlegOOP

Message was edited by:

JOlegOOP

JOlegOOPa at 2007-7-12 3:30:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I haven't packaged any of the servlets. Is there any security risk in not packaging those classes? Thanks again.
uberallesa at 2007-7-12 3:30:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
> I haven't packaged any of the servlets. Is there any> security risk in not packaging those classes? Thanks> again.There's no security risk, but your servlets do have to be in a package.
DrClapa at 2007-7-12 3:30:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I don't think it's mandatory that they be in a package (though I'm sure it's just good practice to have them that way) because I've run apps on shared environments where I had all the servlets listed as shown above and never had them in packages. I even packaged that one 'SignIn' servlet and Tomcat still wouldn't find it.

uberallesa at 2007-7-12 3:30:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
I think the servlet class must in some package,it's a prerequisite
iamyessa at 2007-7-12 3:30:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
If in jsp u r using custom tags then it is mandatory to have a package structure.
adept17a at 2007-7-12 3:30:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
I do not think pacakage structure is an issue here,though it is a good practice.Can you give details of what error it shows in browser or in log files?Do you use /servlet/SignIn in browser while invoking the servlet?
think_tanka at 2007-7-12 3:30:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

I do use servlet/SignIn.

On my local machine I just used the invoker for now (and every works fine using the invoker) but I know that it has security issues and in the next week or so a friend and I will be setting up a real production server and I really need this to work strictly from the web.xml file.

This is such a simple task (simple as in it's worked before) I really don't see what's wrong. Thanks though fellas.

uberallesa at 2007-7-12 3:30:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...