You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mueller, Franz" <fr...@sapmarkets.com> on 2001/02/20 08:53:41 UTC

Problem: Struts under Tomcat 3.2.1

Hi,

we've encountered a strange problem using Struts (nightly build) under
Tomcat 3.2.1.

The situation (test case):

we do have three Actions: A1, A2 and A3. 

A1 inserts an object in the session-context under a wellknown key and
forwards to A2.
A2 reads the object from the session-context and forwards to A3.
A3 reads the object again and forwards to a JSP.

Simple enough. 

The strange part occurs, when Tomcat is started up and this chain is
executed for the first
time.

What happens is: A1 and A2 works as expected but when executing A3 the
session id has changed.
(This happens most of the time under the described circumstances. 
A few times it works as expected).

The same scenario works perfectly well under Tomact 4.0 b1. 
It seems to be rather a Tomcat 3.2.1 then a Struts problem ?

I'm placing the major parts of he test case at the end of this mail.

Any help is appreciate,

Best regards, fm
                           
-------------------------------
Configuration file:

    <action    path="/a1"
               type="prototype.action.A1Action">
      <forward name="go_for_a2"     path="/a2.do" />
    </action>
    <action    path="/a2"
               type="prototype.action.A2Action">
      <forward name="go_for_a3"     path="/a3.do" />
    </action>
    <action    path="/a3"
               type=".prototype.action.A3Action">
      <forward name="go_for_ui"     path="/demo.jsp" />
    </action>

---------------------------
Source A1:

public final class A1Action extends Action {

    public static final String TEST = "session.test.me";

    public ActionForward perform(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws IOException, ServletException {


       HttpSession session = request.getSession();
       String s = "Still alive";
       session.setAttribute(A1Action.TEST, s);
        
       System.out.println("A1Action (" + session.getId() + ")=" + s);
        
       return (mapping.findForward("go_for_a2"));
    }

---------------------------------------------
Source A2:

public final class A2Action extends Action {

    public ActionForward perform(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws IOException, ServletException {

        HttpSession session = request.getSession();
        String s = (String)session.getAttribute(A1Action.TEST);
        
        System.out.println("A2Action (" + session.getId() + ")=" + s);

        return (mapping.findForward("go_for_a3"));
    }
}

---------------------------------------------
Source A3

public final class A3Action extends Action {

    public ActionForward perform(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws IOException, ServletException {

	HttpSession session = request.getSession();
            String s = (String)session.getAttribute(A1Action.TEST);
        
            System.out.println("A3Action (" + session.getId() + ")=" + s);

	return (mapping.findForward("go_for_ui"));
    }
}


RE: Problem: Struts under Tomcat 3.2.1

Posted by Christian Billen <cb...@mail.com>.
Thanks, I actually got a more recent build from today and cleaned the
directory.  It now works properly.

-----Original Message-----
From: mmuchnik@iname.net [mailto:mmuchnik@iname.net]On Behalf Of Maya
Muchnik
Sent: Tuesday, February 20, 2001 11:12 AM
To: struts-user@jakarta.apache.org
Subject: Re: Problem: Struts under Tomcat 3.2.1


Maybe you need to remove struts-example directory and startup Tomcat again.

Christian Billen wrote:

> Hello,
>
> I am trying to run the struts-example.war from the 20010216 nightly build
in
> my tomcat 3.2.1
>
> On initialization I can see it initializing properly (reading User from
xml
> file and all) and I can even bring the main page in the browser
> http://localhost/struts-example
>
> If I try to click the Register link in the example app: (which does
> http://localhost/struts-example/editRegistration.do?action=Create)
>
> I get a nice 500 error and a stack trace:
>
> Error: 500
> Location: /struts-example/editRegistration.do
> Internal Servlet Error:
>
> java.lang.ClassCastException: javax.servlet.ServletException
>         at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:354)
>         at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:78
> 6)
>         at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:732)
>         at
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java:166)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
>
> Any clue on what I could have configured wrong? my struts.jar is NOT in my
> classpath
> I have also added the "AddHandler jserv-servlet .do" to my tomcat.conf
file
>
> Thanks for your help,
>
> Christian Billen




Re: Problem: Struts under Tomcat 3.2.1

Posted by Maya Muchnik <mm...@pumatech.com>.
Maybe you need to remove struts-example directory and startup Tomcat again.

Christian Billen wrote:

> Hello,
>
> I am trying to run the struts-example.war from the 20010216 nightly build in
> my tomcat 3.2.1
>
> On initialization I can see it initializing properly (reading User from xml
> file and all) and I can even bring the main page in the browser
> http://localhost/struts-example
>
> If I try to click the Register link in the example app: (which does
> http://localhost/struts-example/editRegistration.do?action=Create)
>
> I get a nice 500 error and a stack trace:
>
> Error: 500
> Location: /struts-example/editRegistration.do
> Internal Servlet Error:
>
> java.lang.ClassCastException: javax.servlet.ServletException
>         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:354)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:78
> 6)
>         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:732)
>         at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> (Ajp12ConnectionHandler.java:166)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
>
> Any clue on what I could have configured wrong? my struts.jar is NOT in my
> classpath
> I have also added the "AddHandler jserv-servlet .do" to my tomcat.conf file
>
> Thanks for your help,
>
> Christian Billen


Re: Problem: Struts under Tomcat 3.2.1

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Maya Muchnik wrote:

> Whose is the file "jsdk.jar"? Is it the new for Tomcat > 3.1?
>

No, it's actually old ... it was the servlet 2.0 classes from the old "Java Server
Development Kit".  Anyone who ever used Apache JServ is likely to have this file
hanging around, and it will cause problems if it is on your classpath.

Craig



Re: Problem: Struts under Tomcat 3.2.1

Posted by Maya Muchnik <mm...@pumatech.com>.
Whose is the file "jsdk.jar"? Is it the new for Tomcat > 3.1?

"Craig R. McClanahan" wrote:

>
> Could you double check that there is no "servlet.jar" or "jsdk.jar" file on your
> class path (except for the one that the Tomcat startup script adds), or in your
> system extensions directory ($JAVA_HOME/jre/lib/ext)?  This sounds like a class
> versioning conflict inside of Tomcat.
>
> If it is not this situation, please post a bug in our bug tracking system at:
>
>     http://nagoya.apache.org/bugzilla/
>
> Craig McClanahan


Re: Problem: Struts under Tomcat 3.2.1

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Christian Billen wrote:

> Hello,
>
> I am trying to run the struts-example.war from the 20010216 nightly build in
> my tomcat 3.2.1
>
> On initialization I can see it initializing properly (reading User from xml
> file and all) and I can even bring the main page in the browser
> http://localhost/struts-example
>
> If I try to click the Register link in the example app: (which does
> http://localhost/struts-example/editRegistration.do?action=Create)
>
> I get a nice 500 error and a stack trace:
>
> Error: 500
> Location: /struts-example/editRegistration.do
> Internal Servlet Error:
>
> java.lang.ClassCastException: javax.servlet.ServletException

Could you double check that there is no "servlet.jar" or "jsdk.jar" file on your
class path (except for the one that the Tomcat startup script adds), or in your
system extensions directory ($JAVA_HOME/jre/lib/ext)?  This sounds like a class
versioning conflict inside of Tomcat.

If it is not this situation, please post a bug in our bug tracking system at:

    http://nagoya.apache.org/bugzilla/

Craig McClanahan



RE: Problem: Struts under Tomcat 3.2.1

Posted by Christian Billen <cb...@mail.com>.
Hello,

I am trying to run the struts-example.war from the 20010216 nightly build in
my tomcat 3.2.1

On initialization I can see it initializing properly (reading User from xml
file and all) and I can even bring the main page in the browser
http://localhost/struts-example

If I try to click the Register link in the example app: (which does
http://localhost/struts-example/editRegistration.do?action=Create)

I get a nice 500 error and a stack trace:

Error: 500
Location: /struts-example/editRegistration.do
Internal Servlet Error:

java.lang.ClassCastException: javax.servlet.ServletException
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:354)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:78
6)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:732)
	at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:166)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)


Any clue on what I could have configured wrong? my struts.jar is NOT in my
classpath
I have also added the "AddHandler jserv-servlet .do" to my tomcat.conf file

Thanks for your help,

Christian Billen