facebook

Got "Cannot find global ActionForward …" error w

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #230294 Reply

    DavidWang
    Member
      Operating System: Windows XP Pro SP 2
      Eclipse version: 3.1M7
      MyEclipse version: 3.8.4
      Other external plugins: Spring IDE for Eclipse 1.2.0
      JDK version: 1.4.2_04
      Application Server: JRun4 Updater 3

    Created my first Struts Tiles project following the steps described in the online tutorial http://www.laliluna.de/tutorial/first-tiles/first_struts_tiles_tutorial.pdf. Everything seemed to be perfect. However, after I have deployed the project to JRun4 and opened up the home page, http://localhost:8001/LibraryWeb/, I got the a javax.servlet.jsp.JspException exception saying “Cannot find global ActionForward for name welcome”.
    I then tried Tomcat. The same thing without any modification worked perfectly with Tomcat 5. But unfortunately, we have to use JRun4. Please help! 🙁
    The exception and source files are included below.

    exception stack trace[size=x-small]
    05/27 13:51:56 error Unhandled exception thrown from /index.jsp:9
    [1]javax.servlet.jsp.JspException: Cannot find global ActionForward for name welcome
    at org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:142)
    at jrun__index2ejspa._jspService(jrun__index2ejspa.java:63)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:447)
    at jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatcher.java:417)
    at jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:175)
    at jrun.servlet.file.FileServlet.service(FileServlet.java:306)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:249)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
    at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
    at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    [0]jrun.jsp.runtime.UncaughtPageException: Unhandled exception thrown from /index.jsp:9
    at jrun.jsp.runtime.Utils.handleException(Utils.java:57)
    at jrun.jsp.runtime.JRunPageContext.handlePageException(JRunPageContext.java:384)
    at jrun__index2ejspa._jspService(jrun__index2ejspa.java:71)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:447)
    at jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatcher.java:417)
    at jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:175)
    at jrun.servlet.file.FileServlet.service(FileServlet.java:306)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:249)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
    at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
    at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    [/size]

    /WEB-INF/web.xml

    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <servlet>
          <servlet-name>action</servlet-name>
          <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
          <init-param>
             <param-name>config</param-name>
             <param-value>/WEB-INF/struts-config.xml</param-value>
          </init-param>
          <init-param>
             <param-name>debug</param-name>
             <param-value>3</param-value>
          </init-param>
          <init-param>
             <param-name>detail</param-name>
             <param-value>3</param-value>
          </init-param>
          <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
          <servlet-name>action</servlet-name>
          <url-pattern>*.do</url-pattern>
       </servlet-mapping>
       <jsp-config>
           <taglib>
               <taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
               <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
           </taglib>
           <taglib>
               <taglib-uri>http://struts.apache.org/tags-html</taglib-uri>
               <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
           </taglib>
           <taglib>
               <taglib-uri>http://struts.apache.org/tags-logic</taglib-uri>
               <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
           </taglib>
           <taglib>
               <taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
               <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
           </taglib>
           <taglib>
               <taglib-uri>http://struts.apache.org/tags-nested</taglib-uri>
               <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
           </taglib>
           <taglib>
               <taglib-uri>http://struts.apache.org/tags-template</taglib-uri>
               <taglib-location>/WEB-INF/struts-template.tld</taglib-location>
           </taglib>
       </jsp-config>
    </web-app>
    

    /WEB-INF/struts-config.xml

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
        <data-sources />
        <form-beans />
        <global-exceptions />
        <global-forwards >
          <forward
             name="welcome"
             path="/welcome.do" />
          
    
        </global-forwards>
    
        <action-mappings >
          <action path="/welcome" type="com.testing.struts.action.WelcomeAction">
             <forward name="showWelcome" path="page.welcome" />
          </action>
          <action path="/bookList" type="com.testing.struts.action.BookListAction">
             <forward name="showBookList" path="page.booklist" />
          </action>
          <action path="/navigation" type="com.testing.struts.action.NavigationAction">
             <forward name="showNavigation" path="/jsp/navigation.jsp" />
          </action>
    
        </action-mappings>
    
        <controller
            processorClass="org.apache.struts.tiles.TilesRequestProcessor"
            bufferSize="4096" debug="0" />
        <message-resources
            parameter="com.testing.struts.ApplicationResources" />
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config"
                value="/WEB-INF/tiles-defs.xml" />
            <set-property property="moduleAware" value="true" />
            <set-property property="definitions-parser-validate"
                value="true" />
        </plug-in>
    </struts-config>
    

    /WEB-INF/tiles-defs.xml

    
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE tiles-definitions PUBLIC
    "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
    
    <tiles-definitions>
        <!-- Base Tiles Definition -->
        <definition name="base.definition" path="/jsp/siteLayout.jsp">
            <put name="header" value="/jsp/header.jsp" />
            <put name="navigation" value="/navigation.do" />
            <put name="footer" value="/jsp/footer.jsp" />
        </definition>
        <!-- Tiles Definition of welcome page -->
        <definition name="page.welcome" extends="base.definition">
            <put name="title" value="Welcome !" />
            <put name="body" value="/jsp/home.jsp" />
        </definition>
        <!-- Tiles Definition of BookList -->
        <definition name="page.booklist" extends="base.definition">
            <put name="title" value="Book list page" />
            <put name="body" value="/jsp/bookList.jsp" />
        </definition>
    </tiles-definitions>
    

    /jsp/siteLayout.jsp

    
    <%@ page language="java"%>
    
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html:html locale="true">
    <head>
    <html:base />
    <title><tiles:getAsString name="title" /></title>
    </head>
    <body>
    <table border="1" width="600" cellspacing="5">
        <tbody>
            <tr>
                <td colspan="2"><tiles:insert attribute="header" /></td>
            </tr>
            <tr>
                <td width="200"><tiles:insert attribute="navigation" /></td>
                <td width="400"><tiles:insert attribute="body" /></td>
            </tr>
            <tr>
                <td colspan="2"><tiles:insert attribute="footer" /></td>
            </tr>
        </tbody>
    </table>
    </body>
    </html:html>
    

    /index.jsp

    
    <%@ page language="java"%>
    
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
    
    <logic:forward name="welcome" />
    

    All other jsp files under /jsp folder contain only very simple static content. Java code in the Action classes’ execute() method are just simply doing forwarding: return mapping.findForward(“xxxx”);
    All required jar files and tld files are included.

    #230349 Reply

    Riyad Kalla
    Member

    Hmm so the problem is with your welcome forward, I would try and run this on Jetty or Resin or another app server, if it works there too then the problem is with JRun4, which means that you should THEN search the forums.java.sun.com site and google for “JRun4 Struts global-forward” and see if there is some funky loader problem going on.

    Also ti wouldn’t hurt to recheck your startup logs to make sure you aren’t getting a loader failure with some of the struts stuff.

    #230475 Reply

    DavidWang
    Member

    @support-rkalla wrote:

    Hmm so the problem is with your welcome forward, I would try and run this on Jetty or Resin or another app server, if it works there too then the problem is with JRun4, which means that you should THEN search the forums.java.sun.com site and google for “JRun4 Struts global-forward” and see if there is some funky loader problem going on.

    Also ti wouldn’t hurt to recheck your startup logs to make sure you aren’t getting a loader failure with some of the struts stuff.

    I’ve figured out what the problem is. It has nothing to do with MyEclipse. Basically, it’s because that the deployment descriptor (web.xml) is written following Servlet 2.4 specification but JRun4 only supports Servlet 2.3.

    One major difference between 2.4 and earlier versions is that XML Elements in 2.4 d. d. must be under namespace http://java.sun.com/xml/ns/j2ee, while earlier versions don’t have that requirement.

    I spent a lot of time to debug it and found out that somewhere in JRun4’s code, it’s assuming all the elements are under Namespace.NONAMESPACE. This assumption makes JRun4 unable to recognize elements in 2.4 d.d., which are in fact under the http://java.sun.com/xml/ns/j2ee namespace. It results in no servlet configured in web.xml getting initialized.

    I will forward this problem to JRun4’s support team. Thanks to support-rkalla for your response.

    #230483 Reply

    Riyad Kalla
    Member

    David,
    Fantastic find and followup, we really appreciate you posting them here for others to benefit from your reasearch.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Got "Cannot find global ActionForward …" error w

You must be logged in to post in the forum log in