wood burning stoves*
The moose likes Struts and the fly likes UnavailableException: Cannot load a validator resource from '/WEB-INF/ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "UnavailableException: Cannot load a validator resource from Watch "UnavailableException: Cannot load a validator resource from New topic
Author

UnavailableException: Cannot load a validator resource from '/WEB-INF/

Ajay Reddy
Ranch Hand

Joined: Apr 08, 2005
Posts: 43
Hi there,
Thanks for taking the time to read my post.

I am trying to configure struts validation to my application.

And I keep getting the following stack trace when I startup Weblogic (8.1 SP2). ----

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 weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:1018)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:894)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:873)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:812)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3281)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3226)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3207)
at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:694)
at weblogic.servlet.internal.WebService.preloadResources(WebService.java:483)
at weblogic.servlet.internal.ServletInitService.resume(ServletInitService.java:30)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)


Your help is really appreciated.

Thanks,
PA

==================================================================================================

I am extending my action form with ValidatorForm as follows --

public class SubmitForm extends ValidatorForm {

}
============================================================

Here is part of my struts-config.xml

<struts-config>

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

<form-bean name="submitForm" type="com.emergis.onlinereporting.struts.SubmitForm" />

</form-beans>

<!-- Global forwards -->
<global-forwards>
<forward name="error" path="/error.jsp" />
</global-forwards>

<!-- ========== Action Mapping Definitions ============ -->
<action-mappings>

<action path="/submitAction" type="com.emergis.onlinereporting.struts.action.SubmitAction"
name="submitForm"
input="/Submit.jsp"
scope="request"
validate="true">
<forward name="success" path="/DisplaySubmit.jsp" />
<forward name="failure" path="/Submit.jsp" />
</action>

</action-mappings>

<!-- message resources -->
<message-resources parameter="com.ApplicationResources" null="false" />
<!-- Validator plug-in-->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>

============================================================

Here is my validation.xml file --

<form-validation>

<!-- ========== Default Language Form Definitions ===================== -->
<formset>

<form name="submitForm">
<field property="lastName"
depends="required">
<arg0 key="validateform.lastname"/>
</field>
<field property="address"
depends="required">
<arg0 key="validateform.address"/>
</field>
<field property="sex"
depends="required">
<arg0 key="validateform.sex"/>
</field>
<field property="age"
depends="required">
<arg0 key="validateform.age"/>
</field>
</form>

</formset>

</form-validation>

============================================================

I am using Struts Version 1.2.4.

Struts DTD --
http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd

Validator DTD --
http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd

============================================================

I found out that in validator.xml the list "arg" tags used to be arg0, arg1, arg2, or arg3. But it is replaced by

<arg position="0". But even after making this change, I still get the same error. Here is the change --

<form name="submitForm">
<field property="lastName"
depends="required">
<arg position="0" key="validateform.lastname"/>
</field>
<field property="address"
depends="required">
<arg position="0" key="validateform.address"/>
</field>
<field property="sex"
depends="required">
<arg position="0" key="validateform.sex"/>
</field>
<field property="age"
depends="required">
<arg position="0" key="validateform.age"/>
</field>
</form>
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
"AJ",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we strictly enforce. Pleaes re-read this policy and adjust your display name to comply. Thanks in advance and we look forward to seeing you around the Ranch.
Ajay Reddy
Ranch Hand

Joined: Apr 08, 2005
Posts: 43
Sorry about that. Did not read the naming policy.
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Are the files "validator-rules.xml" and "validation.xml" present in the WEB-INF folder of your web app?
Ajay Reddy
Ranch Hand

Joined: Apr 08, 2005
Posts: 43
Yes, the validation.xml and validation-rules.xml are in WEB_INF directory of my web app.
Steve Ziegler
Greenhorn

Joined: Jun 27, 2005
Posts: 2
Originally posted by Ajay Reddy:
Yes, the validation.xml and validation-rules.xml are in WEB_INF directory of my web app.


Heh..."WEB_INF" or "WEB-INF"? Hope your problem is simply a path typo.
Ajay Reddy
Ranch Hand

Joined: Apr 08, 2005
Posts: 43
Sorry, I have it as WEB-INF (just typo replying to the post). I can go to the jsp page (i.e. Submit.jsp) but when I click on the submit button I get
the error ---

UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'

Which is same as the one I get when I startup Weblogic.

Thanks once again.
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
I wonder if its a problem with the DTDs. The ValidatorResources class tries to register these DTDs.



To verify if this could be the problem, trying commenting/removing the DOCTYPE declaration from both the xml files.

Just a guess. Worth trying I feel.

EDIT: Making the assumption that the xml files are valid and well-formed.
[ June 29, 2005: Message edited by: Sheldon Fernandes ]
Prasanth Pillai
Ranch Hand

Joined: Oct 16, 2006
Posts: 52
hi ajay,

is this issue resolved?

regards,
prasanth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UnavailableException: Cannot load a validator resource from '/WEB-INF/