Celeste,

In my case, in order to get Struts 1.1 to work in a JRun 3.1 system I
wrote one simple class, and plugged that class into the system by
specifying the class name in the web.xml file. The complete class was
included in my last email. All the class does is set the Action
Servlet's context class loader, then it starts the Action Servlet as
normal.

My class is not a class loader itself, nor does it modify the Struts
source code or require a rebuild of the struts.jar file. Yes, this is a
workaround, but I would not call it a "hack". You can completely
document the problem with its solution in a few comments in the web.xml
file to prevent confusion in the future.

If you are still confused, send me a message off-list with more
specific questions.

Steve

Steve Fyfe
CNI Corporation
Milford NH 03055

[EMAIL PROTECTED]

>>> "Haseltine, Celeste" <[EMAIL PROTECTED]> Tuesday, November
05, 2002 7:24:43 PM >>>
Steve, 

I'm a little confused.  Your first item was just a change in the JRUN
3.1
web.xml file, correct?  Or are you creating your own JRUN 3.1 action
class
loader to correctly preload the action class?  And the second item
regarding
the "public void init" method (as seen below), is this a modification
to the
Struts source code, and a local rebuild of the struts.jar file?  If so,
I
wanted to avoid this step, and use Struts 1.1b2 as is.  To me a
modification
of the struts source code is just a "hack" workaround that will end up
confusing the people who come after me on on this project.  

public void init(javax.servlet.ServletConfig sc) 
                        throws javax.servlet.ServletException {
                Thread.currentThread().setContextClassLoader(
                                this.getClass().getClassLoader());
                super.init(sc);
        }
}

Let me know if I misunderstood you. If there is a better way to get
Struts
1.1b2 working under JRUN 3.1, I will reconsider my decision to start
our new
project in Struts 1.02.  But I have to come up with a way that does
NOT
involve an "obscure" or "hack" work around, so that when I move onto
the
next project, and leave these guys to maintain this, they can rebuild
the
system without someone remembering that something "unusual" had to be
done
to get the project restored onto the server.  And modifying the Struts
source code is NOT an acceptable option for us.  What happened to our
partner who was based in the World Trade Center taught us a lesson the
hard
way, when it comes to reinstalling your web apps on new hardware, and
getting them up and running again.

Thanks for any additional insight/advice you can offer.

Celeste Haseltine, PE
MTL, Inc
Dallas, TX 


-----Original Message-----
From: Steve Fyfe [mailto:sdf@;cnicorp.com] 
Sent: Tuesday, November 05, 2002 1:52 PM
To: [EMAIL PROTECTED] 
Subject: Re: Steps to Get JRUN 3.1 and Struts 1.1b2 working


>As promised, I am posting the steps I took to get Struts 1.1b2
working
in
>JRUN 3.1.  I only got the example application working, I did not
bother to
>get the other web apps bundled with Struts 1.1b2 working.  So I can't
>guarantee that I found EVERY problem in getting Struts 1.1b2 working
in JRUN
>3.1. As you can see, the steps necessary to get Struts 1.1b2 working
are
>such that you cannot run any 1.02 Struts apps on the same physical
server in
>JRUN 3.1.  

I cannot comment on all the steps you went through, but I do know that
I was able to get my Struts application to load and run from the
standard WEB-INF folders. So in my case, it should be possible to
share
the machine with Struts 1.0.2 based webapps.

I avoided the classloader problems by using the following code to
initialize the Action Servlet's context class loader at startup:

/**
 * Inserts initialization code into the beginning of the
ActionServlet.
 * <p>
 * For JRun 3.1, replace the class specified for the ActionServlet in
web.xml with
 * the full name of this class.
 */
public class Struts11JrunAdaptor extends
org.apache.struts.action.ActionServlet {
        
        /**
         * Before running the code in the standard Struts v1.1
ActionServlet, initialize
         * the thread's classloader. This problem is fixed in JRun v4,
so only use this
         * module on JRun v3.1.
         *
         * @param sc ServletContext for the current servlet
         * @throws ServletException If thrown by the super class.
         */     
        public void init(javax.servlet.ServletConfig sc) 
                        throws javax.servlet.ServletException {
                Thread.currentThread().setContextClassLoader(
                                this.getClass().getClassLoader());
                super.init(sc);
        }
}

I'm using JRun 3.1 on Win XP with JDK 1.3

I did this a while ago, so I may be overlooking some other critical
configuration detail. Your milage may vary :-)

Steve Fyfe
CNI Corporation
Milford NH 03055

[EMAIL PROTECTED] 


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to