File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator Error" Watch "Struts Validator Error" New topic
Author

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"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validations.xml"/>
<set-property property="stopOnFirstError" value="false"/>
</plug-in>

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
ml'
at org.apache.struts.validator.ValidatorPlugIn.init(Lorg.apache.struts.action.ActionServlet;Lorg.apache.struts.config.
ModuleConfig V(ValidatorPlugIn.java:172)
at org.apache.struts.action.ActionServlet.initModulePlugIns(Lorg.apache.struts.config.ModuleConfig V(ActionServlet.ja
va:869)
at org.apache.struts.action.ActionServlet.init()V(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(Ljavax.servlet.ServletConfig V(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run()Ljava.lang.Object;(ServletStubImpl.java:1018)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.
PrivilegedAction Ljava.lang.Object;(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.secu
rity.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction Ljava.lang.Object;(SecurityManager.java:118)
at weblogic.servlet.internal.ServletStubImpl.createServlet()Ljavax.servlet.Servlet;(ServletStubImpl.java:894)
at weblogic.servlet.internal.ServletStubImpl.createInstances()V(ServletStubImpl.java:873)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Lweblogic.servlet.internal.RequestCallback V(ServletStubI
mpl.java:812)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(Ljava.lang.String V(WebAppServletContext.java:3281)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets()V(WebAppServletContext.java:3226)
at weblogic.servlet.internal.WebAppServletContext.preloadResources()V(WebAppServletContext.java:3207)
at weblogic.servlet.internal.HttpServer.preloadResources()V(HttpServer.java:694)
at weblogic.servlet.internal.WebService.preloadResources()V(WebService.java:483)
at weblogic.servlet.internal.ServletInitService.resume()V(ServletInitService.java:30)
at weblogic.t3.srvr.SubsystemManager.resume()V(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume()V(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run([Ljava.lang.String I(T3Srvr.java:361)
at weblogic.Server.main([Ljava.lang.String V(Server.java:32)
>


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
Hello

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

regards


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

Joined: May 15, 2006
Posts: 180
Originally posted by Dhananjay Inamdar:
value="/WEB-INF/validator-rules.xml,/WEB-INF/validations.xml"/>
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
ml'


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,
Roshani


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

Regards
Dhananjay
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)

regards
[ 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: http://aspose.com/file-tools
 
subject: Struts Validator Error