struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frost, Gary [IT]" <Gary.Fr...@ssmb.com.au>
Subject Validator in struts 1.1
Date Mon, 02 Dec 2002 07:54:06 GMT
Hi, I'm trying to get the validator to work, and I must be doing something
wrong, coz when I look at the debug output of the webapp I see the following
message

2002-12-02 18:31:05,744  INFO [main]
org.apache.struts.validator.ValidatorPlugIn[] - Loading validation rules
file from '/WEB-INF/config/validator-rules.xml'
2002-12-02 18:31:05,772 DEBUG [main]
org.apache.commons.digester.Digester.sax[] -
setDocumentLocator(org.apache.crimson.parser.Parser2$DocLocator@354749)
2002-12-02 18:31:05,773 DEBUG [main]
org.apache.commons.digester.Digester.sax[] - startDocument()
2002-12-02 18:31:05,789 DEBUG [main]
org.apache.commons.digester.Digester.sax[] - resolveEntity('-//Apache
Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN',
'http://jakarta.apache.org/commons/dtds/validator_1_0.dtd')
2002-12-02 18:31:06,149 ERROR [main] org.apache.commons.digester.Digester[]
- Parse Fatal Error at line 4 column -1: External entity not found:
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd".
java.net.UnknownHostException: jakarta.apache.org
	at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3035)
	at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2723)
	at
org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1154)
	at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:488)
	at org.apache.crimson.parser.Parser2.parse(Parser2.java:304)
	at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
	at org.apache.commons.digester.Digester.parse(Digester.java:1561)
	at
org.apache.commons.validator.ValidatorResourcesInitializer.initialize(Valida
torResourcesInitializer.java:256)
	at
org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.ja
va:224)
	at
org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:167)
	<snip>

I.e. from what I see here its trying to go externally to resolve the dtd...

I was using 1.1Beta2, and though maybe that it was a bug that has been
corrected, so I grabbed the latest nightly build (20021201), I copied all
the jar files into my WEB_INF/lib directory, and they certainly seem to be
loading ok, I checked and confirmed that the validator_1_0.dtd is in the
commons-validator.jar (it does).

I looked in the Catalina.out from Tomcat 4, and saw quite a few
		ContextConfig[/webatlas]: Scanning library JAR files
		ContextConfig[/webatlas]:
tldConfigJar(/WEB-INF/lib/standard.jar): Processing entry
'META-INF/sql-rt.tld'
		XmlMapper: Set locator :
org.apache.xerces.readers.DefaultEntityHandler@4cc588
		Resolve: -//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
		  Using alternate DTD
/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd
		Notation: WEB-JSPTAGLIB.1_2 -//Sun Microsystems, Inc.//DTD
JSP Tag Library 1.2//EN null
		ContextConfig[/webatlas]:
tldConfigJar(/WEB-INF/lib/standard.jar): Processing entry 'META-INF/c.tld'

		And the same for struts.jar (i.e. 
		ContextConfig[/webatlas]:
tldConfigJar(/WEB-INF/lib/struts.jar): Processing entry
'META-INF/tlds/struts-nested.tld'
		XmlMapper: Set locator :
org.apache.xerces.readers.DefaultEntityHandler@3adc56
		Resolve: -//Sun Microsystems, Inc.//DTD JSP Tag Library
1.1//EN http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd
		  Using alternate DTD
/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd)

But nothing for validator.jar in that section (even though near the top of
the output was a line
	WebappLoader[/webatlas]: Deploy JAR
/WEB-INF/lib/commons-validator.jar to
/home/gf06866/projects/webATLAS/dist/war/WEB-INF/lib/commons-validator.jar

So it seems that it is picking up the jar ok...!!

I confirmed that my struts.xml was loading the validator in the plugin
correctly, it reads
	<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
		<set-property property="pathnames"
	
value="/WEB-INF/config/validator-rules.xml,
	
/WEB-INF/config/logon/validator.xml"/>
	</plug-in>

And the two validator files are reference the correct DOC_TYPE, they (both)
read
	<!DOCTYPE form-validation PUBLIC
	"-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN"
	"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">

The net result is that obviously the validator isn't configuring properly,
and so when I go to my login page (which I have set up a very simple
'required' test for the user name, I get the error message


		[Exception in:/WEB-INF/jsps/tiles/logon/logon.jsp] null
java.lang.NullPointerException
	at
org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptVa
lidatorTag.java:309)
	at org.apache.jsp.logon$jsp._jspService(logon$jsp.java:573)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)

	<snip>

Any clues on what's going on?

Thanks
Gary


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message