Announcement Announcement Module
Collapse
No announcement yet.
Spring/Struts integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring/Struts integration

    I'm having a problem integrating Spring 2.5 and Struts 1.3. The application was written in Struts and has many, many actions defined. I am trying to bring Spring into the picture. I have not seen this particular posting in the Spring forum, either.

    I have followed, carefully, the directions to integrate Spring and Struts given by George Franciscus in his article on IBM DeveloperWorks (since this is my first thread I am not allowed to post the link to the article titled "Get a better handle on Struts actions, with Spring").

    In my web.xml file we have an action servlet defined :

    <code>
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    ... more
    </servlet>
    </code>

    In one of many Struts config files we have :

    <code>
    <action-mappings>
    ...
    <action path="/logon"
    type="org.springframework.web.struts.DelegatingAct ionProxy"
    validate="false">

    <forward name="success" path="/news.do" redirect="true" />
    <forward name="uw-success" path="/showWorkQueue.do" redirect="true" />
    <forward name="admin-success" path="/agencyList.do" redirect="true" />
    <forward name="ins-success" path="/insPolicySearch.do" redirect="true" />
    <forward name="payroll-success" path="/showWorkQueue.do" redirect="true" />

    <forward name="self" path="/logon.do" redirect="true" />
    <forward name="fail" path="/jsp/common/LogonMessage.jsp"/>
    <forward name="pw_old" path="/jsp/common/PasswordOld.jsp"/>
    </action>
    ... more
    </action-mappings>

    <!-- And down near the bottom of the Struts config file... -->

    <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn"/>

    </code>

    In my action-servlet.xml file I have only one bean to proxy (for the action above) :

    <code>
    <beans xmlns="....springframework.org/schema/beans"
    xmlns:xsi="....w3.org/2001/XMLSchema-instance"
    xmlns:aop="....springframework.org/schema/aop"
    xmlns:tx="....springframework.org/schema/tx"
    xsi:schemaLocation="....springframework.org/schema/beans
    yadda-yadda-yadda...
    >
    <bean name="/logon"
    class="com.big.equotes.common.actions.LogonAction"/>
    </beans>
    </code>

    When I start Tomcat 6 I get the following stack trace :

    <code>
    SEVERE: Servlet /eQuotes threw load() exception
    javax.servlet.UnavailableException
    at org.apache.struts.action.ActionServlet.initModuleP lugIns(ActionServlet.java:880)
    at org.apache.struts.action.ActionServlet.init(Action Servlet.java:359)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1172)
    at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:992)
    at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4058)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4371)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:627)
    at org.apache.catalina.startup.HostConfig.deployDescr iptors(HostConfig.java:553)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:488)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1149)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)

    </code>

    Does anybody have any idea why I am seeing this and what I should do about it?

    Thanks,

    Clark

  • #2
    This isn't the correct forum for this question. This forum is for the Spring Integration (message bus) project.

    You'll probably have better luck in the "Web" forum.

    -mike

    Comment


    • #3
      actual help

      Originally posted by mpilone View Post
      This isn't the correct forum for this question. This forum is for the Spring Integration (message bus) project.

      You'll probably have better luck in the "Web" forum.

      -mike
      Which proves how spectacularly misnamed this project is. Google "spring integration" and see what you get.

      Now to help instead of scolding the OP.

      I wrote a blog post on using Struts1 with Spring 2.5. You don't need that annoying un-dry (wet?) multiple declaration of your actions.
      Hope it will help you.

      Comment


      • #4
        That's a great blog post. Please *do* be sure to post a link to that in the web forum

        Comment


        • #5
          Thanks

          Thank you, everybody.

          I discovered that my problem had to do with the ContextLoaderPlugIn class not being found (although Tomcat did not report that in my stack trace until I added something else to the Struts config file!).

          Gene, I liked your blog post. Thank you.

          I will be sure to post my future questions in the web forum.

          -clark

          Comment

          Working...
          X