It's not a secret anymore!
The moose likes Struts and the fly likes Struts Validator Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator Error" Watch "Struts Validator Error" New topic

Struts Validator Error

Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
I am using struts 1.2.9 version.
I added the validator plugin in my struts config file.

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
<set-property property="stopOnFirstError" value="false"/>

For both validations.xml and validator-rules.xml I ma using validator_1_1_3.dtd.

For stuts-cpnfig.xml, I am using struts-config_1_2.dtd.

I have placed all thse dtds in WEB-INF/classes folder.

But when I try to deploy my application, i get the followng error:

<Oct 11, 2006 1:17:34 PM PDT> <Error> <HTTP> <BEA-101216> <Servlet: "ActionServlet" failed to preload on startup in Web applic
ation: "myapp".
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validations.x
at org.apache.struts.validator.ValidatorPlugIn.init(Lorg.apache.struts.action.ActionServlet;Lorg.apache.struts.config.
ModuleConfig V(
at org.apache.struts.action.ActionServlet.initModulePlugIns(Lorg.apache.struts.config.ModuleConfig V(ActionServlet.ja
at org.apache.struts.action.ActionServlet.init()V(
at javax.servlet.GenericServlet.init(Ljavax.servlet.ServletConfig V(
at weblogic.servlet.internal.ServletStubImpl$;(
PrivilegedAction Ljava.lang.Object;(
rity.acl.internal.AuthenticatedSubject; Ljava.lang.Object;(
at weblogic.servlet.internal.ServletStubImpl.createServlet()Ljavax.servlet.Servlet;(
at weblogic.servlet.internal.ServletStubImpl.createInstances()V(
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Lweblogic.servlet.internal.RequestCallback V(ServletStubI
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(Ljava.lang.String V(
at weblogic.servlet.internal.WebAppServletContext.preloadServlets()V(
at weblogic.servlet.internal.WebAppServletContext.preloadResources()V(
at weblogic.servlet.internal.HttpServer.preloadResources()V(
at weblogic.servlet.internal.WebService.preloadResources()V(
at weblogic.servlet.internal.ServletInitService.resume()V(
at weblogic.t3.srvr.SubsystemManager.resume()V(
at weblogic.t3.srvr.T3Srvr.resume()V(
at[Ljava.lang.String I(
at weblogic.Server.main([Ljava.lang.String V(

Please let me know where I am going wrong. I need to get this fixed urgently.

Just like you, struggeling to get the right solutions!<br /> <br />Sun Certified Java Programmer 1.5<br /> <br />Target - SCWCD
Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131

Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validations.xml'

check the paths
try without <set-property property="stopOnFirstError" value="false"/>

copy pls the DTD of each xml file


kill your pride, share your knowledge with all
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Originally posted by Dhananjay Inamdar:
I have placed all thse dtds in WEB-INF/classes folder.
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validations.x

Hi Dhananjay,

You have defined the path as ="/WEB-INF/validator-rules.xml" in the struts-config.
But actually i think you have placed them in WEB-INF/classes folder.
Obviously the server will not be able to find. Please change the locaiton of validator-rules.xml and validations.xml to /WEB-INF.

Plus i have never explicitly bothered about putting the DTDs anywhere in the app... The apps work fine for me.


Regards,<br />Roshani
Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
Roshani ,

I have placed all the xml files in WEB-INF.

Also, if your app is on a production box, where you do not have any internet access, then the app will not be able to search them on web.
We generally have web url for the dtds but that does not work on a production box. Hence I had to copy the dtds locally.
Dhananjay Inamdar
Ranch Hand

Joined: Jan 27, 2003
Posts: 130
Hey Manuel.

Unfortunately I still get the same error even after removing
<set-property property="stopOnFirstError" value="false"/>
from struts-config.xml

I have copied all dtds to WEB-INF/classes folder

Manuel Jordan
Ranch Hand

Joined: Sep 29, 2006
Posts: 131
hello Dhananjay

you are wrong, (you are confused)

first any validation.xml or file.dtd not should be in the WEB-INF/classes

its enough and they should be in WEB-INF/ , with your struts-config.xml for example

with dtd i meant that each file file have like a header saying what version of the dtd and xmk use like this,( for my struts-config.xml)

again the paths of your validations files shoul be located
in your struts-config.xml in this way for example (nothing about /clases)

same case for the tld files (defined in the web.xml)

[ October 12, 2006: Message edited by: Manuel Jordan ]
Prasanth Pillai
Ranch Hand

Joined: Oct 16, 2006
Posts: 52
hope your machine where you deployed the application is having internet connectvity. As you mentioned, you have the local copy of the DTD as well, right?

How did you refer the DTDs in your XML files?
If should be like

Also before deploying , it always a good idea just try to open the xml files in your browser. Most of the errors will occur because of malformed xml files. The browser will give the syntax errors if any.
I agree. Here's the link:
subject: Struts Validator Error
jQuery in Action, 3rd edition