Two Laptop Bag*
The moose likes Struts and the fly likes Problems with Struts 1.3.8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems with Struts 1.3.8" Watch "Problems with Struts 1.3.8" New topic

Problems with Struts 1.3.8

rahul khanna
Ranch Hand

Joined: Sep 14, 2005
Posts: 48
Hi All,
I am trying to develop a application using struts 1.3.8. I am getting a error when I am using the validation file. Looking around forums , it looks as if this has to do with the version of the validator jar or digester.jar
Follwing is the list of jars I have :

- antlr-2.7.2.jar
- commons-beanutils-1.7.0.jar
- commons-chain-1.1.jar
- commons-digester-1.8.jar
- commons-logging-1.0.4.jar
- commons-validator-1.3.1.jar
- jstl-1.0.2.jar
- jstl-1.0.2.jar
- struts-core-1.3.8.jar
- struts-taglib-1.3.8.jar
- struts-tiles-1.3.8.jar

I have also tried commons-validator-1.3.0.jar and commons-validator.jar but they don't work. Earlier I was getting errors with tiles and had to try all sorts of COMBINATIONS to get the above wroking set , only to get stuck with validator.
If I remove the lines ...

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/conf/struts/validation/validator-rules.xml,/WEB-INF/conf/struts/validation/validation-myproject.xml"/>

The code works fine .
Surprisingly , it should work with the default set of jars downloaded from the apache site but it doesn't. Probably because of the tomcat. I am using Tomcat 5.5.23.

I get two different stack traces with different versions of validator files.

and with commons-validator-1.3.1.jar I get :

SEVERE: Parse Error at line 15 column 41: Element type "arg0" must be declared.
org.xml.sax.SAXParseException: Element type "arg0" must be declared.
at org.apache.commons.digester.Digester.parse(
at org.apache.commons.validator.ValidatorResources.<init>(
at org.apache.struts.validator.ValidatorPlugIn.initResources(
at org.apache.struts.validator.ValidatorPlugIn.init(
at org.apache.struts.action.ActionServlet.initModulePlugIns(
at org.apache.struts.action.ActionServlet.init(
at javax.servlet.GenericServlet.init(
at org.apache.catalina.core.StandardWrapper.loadServlet(
at org.apache.catalina.core.StandardWrapper.load(
at org.apache.catalina.core.StandardContext.loadOnStartup(
at org.apache.catalina.core.StandardContext.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployDirectory(
at org.apache.catalina.startup.HostConfig.deployDirectories(
at org.apache.catalina.startup.HostConfig.deployApps(
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardHost.start(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardEngine.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.catalina.startup.Bootstrap.start(
at org.apache.catalina.startup.Bootstrap.main(
10-Jul-2007 21:10:58 org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 16 column 69: Element type "arg1" must be declared.
org.xml.sax.SAXParseException: Element type "arg1" must be declared.

Thanks in advance.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem here is that in Struts 1.3 and above, the validator-rules.xml file is contained in the struts-core-1.3.x.jar file, and is not provided separately like it was before. With Struts 1.3 and above, your plugin entry should look like this:

As you can see, this references the validator-rules.xml file in the org.apache.struts.validator package, which exists inside the struts-core-1.3.x.jar file.

Consultant, Sima Solutions
rahul khanna
Ranch Hand

Joined: Sep 14, 2005
Posts: 48
Hi Merill,

Thanks for the reply .What you said is correct in a way .Even if the validor-rules is kept oustside and is reference from struts-config in a way that I have done , it will pick it up. Though it is redundant and is not advisable I guess..

I have fixed the issue. The problem was with my validation-myproject.xml file.

It had entries like ..

<form name="myForm">
<field property="userName" depends="required,maxlength">
<arg0 key="myForm.userName"/>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<arg2 name="mask" key="${var:mask}" resource="false"/>
<field property="userPassword" depends="required">
<arg0 key="myForm.password"/>

I changed lines like
<arg0 key="myForm.password"/>


<arg key="myForm.password"/>

and it worked..
i,e arg0,arg1 and arg2 were replaced with arg.

Why did I write it like arg0,1,2 in first place ??
Well, I had copied one of my old code.. which was working fine with struts 1.1, it bonked with 1.3.8 because of this error.
Hope it helps someone.
subject: Problems with Struts 1.3.8
Similar Threads
exception while trying to use <data-sources>
Exception while loading the validation.xml in strusts
Attribute "value" must be declared for element type "property"???
An Error Occured while starting tomcat