Discussions

General J2EE: Cannot load a validator resource from '/WEB-INF/validator-rules

  1. hi all,
    before i add <plug-in ValidatorPlugIn ... everything works fine with tomcat 4.0.4, JDK 1.4.1.02,
     struts 1.2.4 and Hibernate and MS access. But when I add plug-in to use default validation
    error occurs.


    Apache Tomcat/4.0.4 - HTTP Status 503 - Servlet action is currently unavailable

    -----------------------------------------------------------

    type Status report

    message Servlet action is currently unavailable

    description The requested service (Servlet action is currently unavailable) is not currently available.
    ______________________________________
    in log file :
    2005-07-17 08:11:28 StandardWrapper[:action]: Marking servlet action as unavailable
    2005-07-17 08:11:28 StandardContext[]: Servlet threw load() exception
    javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
    at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:174)
    at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
    at org.apache.catalina.core.StandardService.start(StandardService.java:388)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

    ____________________________

    thanks.

    Threaded Messages (4)

  2. Servlet action is not available[ Go to top ]

    I am getting the same error the moment I add the validator plugin to the struts-config.xml file.
    Does it have to do with the placement of the plugin element?
    This is what I have in my struts-config.xml file -

    <?xml version="1.0" encoding="ISO-8859-1" ?>

    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd" >

    <struts-config>

      <!-- ========== Form Bean Definitions ================= -->
      <form-beans>

        <form-bean name="loginForm"
                        type="com.xxx.argenerator.LoginForm"/>
                        
        <form-bean name="arForm"
                        type="com.xxx.argenerator.ARForm"/>
        
      </form-beans>
     
      
      <!-- ============== Global exceptions ============== -->
      <global-exceptions>
            <exception type="com.xxx.argenerator.DatabaseException"
                        key="error.employee.databaseException"
                        scope="request"
                        path="/Error.jsp"/>
      </global-exceptions>
      
        <!-- ============== Global forwards ============== -->
      <global-forwards>
            <forward name="login" path="/Login.jsp"/>
            <forward name="error" path="/Error.jsp"/>
      </global-forwards>
      
      <!-- ========== Action Mapping Definitions ============ -->
      <action-mappings>

        <action path="/login"
                  type="com.xxx.argenerator.LoginAction"
                  name="loginForm"
                  validate="true"
                  input="/Login.jsp"
                  scope="request">
            <forward name="success" path="/setupAR.do"/>
        </action>
       
        <action path="/setupAR" forward="/SelectAR.jsp"/>
        
        <action path="/generateAR"
                type="com.xxx.argenerator.GenerateARAction"
                name="arForm"
                scope="request"
                validate="false">
            <forward name="success" path="/Confirmation.jsp"/>
        </action>
        
        <action path="/logout"
                  type="com.pacelabs.argenerator.LogoutAction" />

      </action-mappings>
      
      <!-- ========== Message Resources Definitions =================== -->

      <message-resources
        parameter="com.xxx.argenerator.ApplicationResources"/>
        
      <!-- ========== Struts Validator plugin =================== -->
      
      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames"
            value="/WEB-INF/validator-rules.xml,/WEB-INF/validations.xml"/>
      </plug-in>

    </struts-config>
  3. One Solution[ Go to top ]

    Hi all,
    I solved my problem as below:

    I already deleted validator plugin from struts blank then made my application, but when I wanted to add it again, It made error,
    now I use a struts blank without deleting its validator plugin then I add my pages to that, and it works fine.

    I hope this helps you.

    Thanks.
  4. My Solution[ Go to top ]

    I met the same problem and solved it:
    there is a bug in the source code of struts validator,I replace the commons-validator.jar file by the other one that worked fine,the exception disappeared!

    You can try it,I'm sure it work!

    Gook luck!
  5. Re: One Solution[ Go to top ]

    Hi mary malven, I'm suffering from same problem now.could u expline it indetails.i'm unable to find the problem where the excatly problem.and how to resovle this problem. i tried which you have posted early.still i got same problem. thanks in advance. prasad.p