You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Barry <ba...@sympatico.ca> on 2001/07/06 08:36:19 UTC

Trouble trying to port from JServ

Hi all,

I hope someone can help me with a problem. I'm sorry if this is a stupid
newbie question but I've been working on this for days with no success. I
have been through all the documentation too.

I am trying to port my web application from JServ to Tomcat/mod_jk and am
having trouble configuring Tomcat to use the same URL for servlets that I
used with JServ. Unfortunately changing the URL of my servlets is not an
option because hundreds of external sites already link to these URLs.

The URL I am currently using for all servlets is
http://www.mydomain.com/int/MyServlet. Unfortunately under Tomcat my
servlets only work at the URL http://www.mydomain.com/int/servlet/MyServlet.
I think I've configured it correctly but it still won't work. I just see the
following from stdout:

2001-07-06 01:49:23 - Ctx( /int ): 404 R( /int + /MyServlet + null) null


Below are my conf files. I've tried several variations on them with no
success.

I have the following settings in server.xml:
<Context path="/int"
    docBase="/opt/dev/website/int"
    crossContext="false"
    debug="0"
    reloadable="true" >
</Context>

/opt/dev/website/int is the directory that contains all my servlet classes.
It also contains WEB-INF/classes which is actually a symbolic link back to
/opt/dev/website/int. I am not using JSP.

web.xml contains the following:
<servlet-mapping>
    <servlet-name>
        invoker
    </servlet-name>
    <url-pattern>
        /*
    </url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>
        invoker
    </servlet-name>
    <url-pattern>
        /servlet/*
    </url-pattern>
</servlet-mapping>
...

I thought this should cause all files in /int to be handled by the invoker.

Finally mod_jk.conf contains the following:

Alias /int "/opt/dev/website/int"
<Directory "/opt/dev/website/int">
    Options Indexes FollowSymLinks
</Directory>
JkMount /int/* ajp12
<Location "/int/WEB-INF/">
    AllowOverride None
    deny from all
</Location>
<Location "/int/META-INF/">
    AllowOverride None
    deny from all
</Location>

Under this configuration the URL http://www.mydomain.com/int/MyServlet
always returns 404 - Page not found. But
http://www.mydomain.com/int/servlet/MyServlet returns the correct servlet
response.

Sorry dump all these configuration files on you but I wanted to provide as
much info as possible. Can someone kindly explain how I can continue to use
the same url (http://www.mydomain.com/int/MyServlet) with Tomcat? What am I
doing wrong?

I am using Tomcat 3.2.2 and Apache 1.3.20.

Any and all replies are much appreciated.

Thank you,

Barry
barryf@sympatico.ca


Re: Trouble trying to port from JServ

Posted by anil <an...@server.awcoldstream.on.ca>.
Hi Barry,

If you want all your servlets served through the my.domain.com/int,  On the
server.xml  change
        <RequestInterceptor
            className="org.apache.tomcat.request.InvokerInterceptor"
            debug="0" prefix="/servlet/" />

        <RequestInterceptor
            className="org.apache.tomcat.request.InvokerInterceptor"
            debug="0" prefix="/int/" />


then I guess on your web.xml has to have
    <servlet>
        <servlet-name>
           LogIn
        </servlet-name>
        <servlet-class>
            ca.on.cad.utilities.MyServlet
        </servlet-class>
    </servlet>

that should do the trick. downside of this is all your contex are prefix with
/int/. I guess this way
http://your.domain./int/MyServlet should work.


anil


Barry wrote:

> Hi all,
>
> I hope someone can help me with a problem. I'm sorry if this is a stupid
> newbie question but I've been working on this for days with no success. I
> have been through all the documentation too.
>
> I am trying to port my web application from JServ to Tomcat/mod_jk and am
> having trouble configuring Tomcat to use the same URL for servlets that I
> used with JServ. Unfortunately changing the URL of my servlets is not an
> option because hundreds of external sites already link to these URLs.
>
> The URL I am currently using for all servlets is
> http://www.mydomain.com/int/MyServlet. Unfortunately under Tomcat my
> servlets only work at the URL http://www.mydomain.com/int/servlet/MyServlet.
> I think I've configured it correctly but it still won't work. I just see the
> following from stdout:
>
> 2001-07-06 01:49:23 - Ctx( /int ): 404 R( /int + /MyServlet + null) null
>
> Below are my conf files. I've tried several variations on them with no
> success.
>
> I have the following settings in server.xml:
> <Context path="/int"
>     docBase="/opt/dev/website/int"
>     crossContext="false"
>     debug="0"
>     reloadable="true" >
> </Context>
>
> /opt/dev/website/int is the directory that contains all my servlet classes.
> It also contains WEB-INF/classes which is actually a symbolic link back to
> /opt/dev/website/int. I am not using JSP.
>
> web.xml contains the following:
> <servlet-mapping>
>     <servlet-name>
>         invoker
>     </servlet-name>
>     <url-pattern>
>         /*
>     </url-pattern>
> </servlet-mapping>
> <servlet-mapping>
>     <servlet-name>
>         invoker
>     </servlet-name>
>     <url-pattern>
>         /servlet/*
>     </url-pattern>
> </servlet-mapping>
> ...
>
> I thought this should cause all files in /int to be handled by the invoker.
>
> Finally mod_jk.conf contains the following:
>
> Alias /int "/opt/dev/website/int"
> <Directory "/opt/dev/website/int">
>     Options Indexes FollowSymLinks
> </Directory>
> JkMount /int/* ajp12
> <Location "/int/WEB-INF/">
>     AllowOverride None
>     deny from all
> </Location>
> <Location "/int/META-INF/">
>     AllowOverride None
>     deny from all
> </Location>
>
> Under this configuration the URL http://www.mydomain.com/int/MyServlet
> always returns 404 - Page not found. But
> http://www.mydomain.com/int/servlet/MyServlet returns the correct servlet
> response.
>
> Sorry dump all these configuration files on you but I wanted to provide as
> much info as possible. Can someone kindly explain how I can continue to use
> the same url (http://www.mydomain.com/int/MyServlet) with Tomcat? What am I
> doing wrong?
>
> I am using Tomcat 3.2.2 and Apache 1.3.20.
>
> Any and all replies are much appreciated.
>
> Thank you,
>
> Barry
> barryf@sympatico.ca