I am attempting to migrate a servlet from Tomcat 5.0.25 to 6.0.18, but
my efforts to access it while running under 6.0.18 have been
unsuccessful.  The servlet is accessed on the server via HTTP, but has
web interfaces for simple testing and to check servlet loading and
client-server message traffic.

The context.xml and web.xml files as described are similar to what we
have running under Tomcat 5.0.25.  Aside from the connector and shutdown
ports, the server.xml file is the same one that was bundled with 6.0.18.
We can access the servlet while running under 5.0.25, but not 6.0.18.
It is probably a simple configuration file or security setting that I
have not been able to locate.

The servlet is initialized by a context file placed in
{$CATALINA_HOME}/conf/Catalina/localhost.  Tailing the catalina.out
file, I have confirmed that the servlet context is being loadet at
Tomcat startup.  The context path is set to my home area for testing,
but is similar to what we use for production deployment, i.e., it is not
deployed from {$CATALINA_HOME}/webapps.  Here are the contents of my
context file:

<Context path="/UMI" docBase="/amd/homes/lataxeks/umi/ap/DataColl"
        reloadable="true">
        <Resources
className="org.apache.naming.resources.FileDirContext"
                allowLinking="true" />
        <Logger className="org.apache.catalina.logger.FileLogger"
                prefix="UMIAPDC_log." suffix=".txt"
                directory="/amd/homes/lataxeks/umi/logs"
                timestamp="true"/>
        <Realm className="org.apache.catalina.realm.MemoryRealm" />
</Context>


The following are the contents of the web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
<web-app>
        <!-- HUControlServlet configuration defs -->
        <servlet>
                <servlet-name>
                        HUControlServlet
                </servlet-name>
                <servlet-class>
        
com.nielsenmedia.umi.ap.datacollection.servlet.HUControlServlet
                        </servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>HUControlServlet</servlet-name>
                <url-pattern>/UMI/servlet/HUControlServlet</url-pattern>
        </servlet-mapping>
        <security-constraint>
                <web-resource-collection>
                        <web-resource-name>Protected
Area</web-resource-name>
                        <!-- Define the context-relative URL(s) to be
protected -->
        
<url-pattern>/jsp/security/protected/*</url-pattern>
                        <!-- If you list http methods, only those
methods are protected -->
                        <http-method>DELETE</http-method>
                        <http-method>GET</http-method>
                        <http-method>POST</http-method>
                        <http-method>PUT</http-method>
                </web-resource-collection>
                <auth-constraint>
                        <!-- Anyone with one of the listed roles may
access this area -->
                        <role-name>tomcat</role-name>
                        <role-name>role1</role-name>
                </auth-constraint>
        </security-constraint>
</web-app>


Here is the stack trace I received when running my server based
application to access the servlet:

java.io.FileNotFoundException:
http://d1uap:4901/UMI/servlet/HUControlServlet/
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:27)
        at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at
sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java
:1240)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLC
onnection.java:1234)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:921)
        at
com.nielsenmedia.umi.ap.datacollection.test.homeunitsimulator.messages.H
UStatus.sendStatus(HUStatus.java:104)
        at
com.nielsenmedia.umi.ap.datacollection.test.homeunitsimulator.messages.H
UInitConn.sendStatus(HUInitConn.java:95)
        at
com.nielsenmedia.umi.ap.datacollection.test.homeunitsimulator.drivers.HU
Session.Process(HUSession.java:431)
        at
com.nielsenmedia.umi.ap.datacollection.test.homeunitsimulator.drivers.HU
Sim.main(HUSim.java:311)
Caused by: java.io.FileNotFoundException:
http://d1uap:4901/UMI/servlet/HUControlServlet/
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:1183)
        at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
        at
com.nielsenmedia.umi.ap.datacollection.test.homeunitsimulator.messages.H
UStatus.sendStatus(HUStatus.java:101)
        ... 3 more


Here is the localhost_access_log entry from the test that generated the
stack trace (servlet running on Tomcat 6.0.18).  As you can see, it is
generating an HTTP 404 error code:

10.38.164.58 - - [03/Sep/2009:13:53:42 -0400] "POST
/UMI/servlet/HUControlServlet/ HTTP/1.1" 404 1042


Can anyone please help?  Thanks

Karl Lataxes

Reply via email to