facebook

Cannot find ActionMappings or ActionFormBeans collection

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #258617 Reply

    noonoosh
    Member

    Dear Friends,
    I use myEclipse 5 GA with eclipse 3.2 on tomcat 5.0.
    I create a very simple web project adding struts capabilities to it.I modify the struts-config file add an action , action form , 2 jsp pages . all automatically . I just modify the action and add the return mapping.forward to it.when I deploy it to tomcat and run it I get Cannot find ActionMappings or ActionFormBeans collection
    error.Is it a bug in myEclipse ? I did not configure anything with hand , all configuration automatically by the myeclipse.

    please answer me.I read the related messages on this topic but they did not solve my problem,

    regards
    Noonoosh

    #258691 Reply

    Riyad Kalla
    Member

    Noonoosh,
    Can you post your web.xml file, struts-config.xml file and the URL you are using to access your page?

    Also please use the “code” button below to wrap your code in code blocks so they maintain formatting.

    #258797 Reply

    noonoosh
    Member

    Thanx for the reply here are my codes:
    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>0</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
    </web-app>

    struts-config.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
    
    <struts-config>
      <data-sources />
      <form-beans >
        <form-bean name="loginForm" type="com.irisaco.struts.form.LoginForm" />
    
      </form-beans>
    
      <global-exceptions />
      <global-forwards />
      <action-mappings >
        <action
          attribute="loginForm"
          input="/login.jsp"
          name="loginForm"
          path="/login"
          scope="request"
          type="com.irisaco.struts.action.LoginAction">
          <forward name="success" path="/hello.jsp" />
        </action>
    
      </action-mappings>
    
      <message-resources parameter="com.irisaco.struts.ApplicationResources" />
    </struts-config>

    LoginAction:

    /*
     * Generated by MyEclipse Struts
     * Template path: templates/java/JavaClass.vtl
     */
    package com.irisaco.struts.action;
    
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import com.irisaco.struts.form.LoginForm;
    
    /** 
     * MyEclipse Struts
     * Creation date: 09-20-2006
     * 
     * XDoclet definition:
     * @struts.action path="/login" name="loginForm" input="/login.jsp" scope="request" validate="true"
     * @struts.action-forward name="success" path="/hello.jsp"
     */
    public class LoginAction extends Action {
        /*
         * Generated Methods
         */
    
        /** 
         * Method execute
         * @param mapping
         * @param form
         * @param request
         * @param response
         * @return ActionForward
         */
        public ActionForward execute(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response) {
            LoginForm loginForm = (LoginForm) form;
            if(loginForm.getUserName().equals("nfl"))// TODO Auto-generated method stub
                return mapping.findForward("success");
                
            return null;
        }
    }

    login.jsp”

    <%@ page language="java"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
     
    <html> 
        <head>
            <title>JSP for LoginForm form</title>
        </head>
        <body>
            <html:form action="login.do">
                userName : <html:text property="userName"/><html:errors property="userName"/><br/>
                <html:submit/><html:cancel/>
            </html:form>
        </body>
    </html>

    URL : http://localhost:8081/demo1/login.jsp

    best regards

    #258819 Reply

    Riyad Kalla
    Member

    This code actually all looks fine, can you export your project to a ZIp file (File > Export) and email it to support@genuitec.com ATTN Riyad and I’ll have a look at it.

    Also include a link to this thread so I know why I’m getting the attachment.

    #258851 Reply

    Riyad Kalla
    Member

    Noonoosh,
    I got your project and imported it, deployed it, then ran tomcat, went to http://localhost:8080/demo1/login.jsp, entered a name and hit Submit and everything worked (I got a blank page, but I didn’t see any mapping error anywhere).

    You might want to make sure your Tomcat setup is correct or that your deployment is correct if you are getting a action mapping problem.

    #259078 Reply

    noonoosh
    Member

    Dear Riyad,
    I get the error immediatly after I enter the url : http://localhost:8081/demo1/login.jsp .I can not see the login.jsp page to enter anything.
    By the way , what kind I configuration should I use ? I did not change the default tomcat configuration.

    I use tomcat 5.0

    regards
    noonoosh

    #259079 Reply

    Riyad Kalla
    Member

    Noonoosh,
    For a real quick test, try download Tomcat 5.5.17 from the Tomcat site (get the ZIP) version. Now unzip it to a new dir, then setup your MyEclipse connector to point at it. Redeploy your project and run it, did it work? That’s what I did on my end.

    #259080 Reply

    noonoosh
    Member

    I just tested it with tomcat 4 and get the error again
    I get this error in my tomcat log :

      2006-09-23 07:28:10 StandardContext[/demo1]: Servlet /demo1 threw load() exception
      javax.servlet.UnavailableException: Parsing error processing resource path
      at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:1035)
      at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1012)
      at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
      at javax.servlet.GenericServlet.init(GenericServlet.java:212)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:888)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:776)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3363)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3586)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:774)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:548)
      at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:260)
      at org.apache.catalina.core.StandardHost.install(StandardHost.java:741)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:512)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:354)
      at org.apache.catalina.startup.HostConfig.run(HostConfig.java:804)
      at java.lang.Thread.run(Thread.java:534)

    I will test it with tomcat 5.5 too.
    thanx

    #259081 Reply

    noonoosh
    Member

    I started it with tomcat 5.5 and get this error :

      SEVERE: Servlet /demo1 threw load() exception
      javax.servlet.UnavailableException: Parsing error processing resource path
      at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:1035)
      at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1012)
      at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
      at javax.servlet.GenericServlet.init(GenericServlet.java:211)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
      at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
      at org.apache.catalina.core.StandardService.start(StandardService.java:450)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

    and

    HTTP Status 404 – /demo1/

    ——————————————————————————–

    type Status report

    message /demo1/

    description The requested resource (/demo1/) is not available.

    ——————————————————————————–

    Apache Tomcat/5.5.17

    #259095 Reply

    Riyad Kalla
    Member

    Unfortunately I’m not sure where to help you with this. When I recieved your project, I opened it and deployed it and everything worked. I suppose you could try walking through the tutorial again line by line and see if you made some mistake somewhere?

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: Cannot find ActionMappings or ActionFormBeans collection

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