Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

panugu

Programmer
Jun 23, 2005
4
CA
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 --

Validator 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>
 
Not sure if I have a concrete answer for you, but I would look here:
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>

To me, that error is saying it can't find it at all. I would fiddle with the /'s

but I just dug up on a few websites on google, the translation is bad, but there may also be a bug with accessing dtd's on the net from within your files?

An example being this:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
Also check here for further details:

HTH
Andrew
 
Thanks Andrew, I'll try if that will give me a positive result.

Thanks,
Prasanna.
 
Sorry for not getting back sooner.

I tried every thing I could think of but did not work. I played with the <set-property> tag's. I installed latest version of validation jar file.

Finally, I gave up and I am still using the validating in my ActionForm class.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top