• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that. Did not read the naming policy.
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are the files "validator-rules.xml" and "validation.xml" present in the WEB-INF folder of your web app?
 
Ajay Reddy
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the validation.xml and validation-rules.xml are in WEB_INF directory of my web app.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ajay,

is this issue resolved?

regards,
prasanth
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic