|
From: Matt R. <ma...@ra...> - 2004-04-27 19:45:20
|
I figured out what the issue is - but don't know how to fix it. If I
put the validatorFactory into my "applicationContext.xml", then
everything works as expected. But if I put it into
"action-servlet.xml", then it doesn't work. It would be nice if it were
able to be in both places. If it can't be, it should probably be
documented and explained.
Matt
> -----Original Message-----
> From: Keith Donald [mailto:kd...@cs...]=20
> Sent: Tuesday, April 27, 2004 12:27 PM
> To: 'Matt Raible'
> Subject: FW: [Springframework-developer] [Commons Validator]=20
> Error on Startup
>=20
>=20
> Hey Matt,
>=20
> I fixed the .tld problem.
>=20
> The other one is interesting. I need to verify
> beanOfTypeIncludingAncestors() is working properly - it=20
> should catch any beans that implement=20
> ValidatorFactory.class...but apparently it's not. Your=20
> config looks right to me.
>=20
> I will try to reproduce it as soon as all possible (I'm=20
> really busy today-tommorow though:(). If you need it now,=20
> try changing "ValidatorFactory.class" below in the=20
> getValidatorResources() method to=20
> "DefaultValidatorFactory.class" and see if that clears it up.=20
> Hell, I can do that temporarily for you if you like. =20
> That'll at least give me a good idea if=20
> beanOfTypeIncludingAncestors is working properly.
>=20
> Thanks,
> Keith
> =20
> Keith Donald
> Software Architect
> kd...@cs...
> 321-676-2923 x403
> =20
> =20
>=20
>=20
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...]
> On Behalf Of Matt Raible
> Sent: Tuesday, April 27, 2004 12:23 PM
> To: spr...@li...
> Subject: RE: [Springframework-developer] [Commons Validator]=20
> Error on Startup
>=20
>=20
> Doh - spoke to soon. It seems like the following is failing in the
> JavaScriptValidatorTag:
>=20
> private ValidatorResources getValidatorResources() {
> ListableBeanFactory lbf =3D WebApplicationContextUtils
> =20
> .getRequiredWebApplicationContext(pageContext.getServletContext());
> ValidatorFactory factory =3D (ValidatorFactory)=20
> BeanFactoryUtils
> .beanOfTypeIncludingAncestors(lbf,
> ValidatorFactory.class, true, true);
> return factory.getValidatorResources();
> }
>=20
> I'm getting the following error now:
>=20
> org.springframework.beans.factory.NoSuchBeanDefinitionExceptio
> n: No unique bean of type=20
> [org.springframework.validation.commons.ValidatorFactory] is
> defined: Expected single bean but found 0
> =09
> org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeI
> ncludingAn
> cestors(BeanFactoryUtils.java:147)
> =09
> org.springframework.validation.commons.taglib.JavascriptValida
> torTag.get
> ValidatorResources(JavascriptValidatorTag.java:773)
> =09
> org.springframework.validation.commons.taglib.JavascriptValida
> torTag.doS
> tartTag(JavascriptValidatorTag.java:346)
> =09
> org.apache.jsp.scripts.validator_jsp._jspx_meth_html_javascrip
> t_0(valida
> tor_jsp.java:78)
> =09
> org.apache.jsp.scripts.validator_jsp._jspService(validator_jsp
> .java:55)
> =09
>=20
> Maybe my validatorFactory syntax is wrong?
>=20
> <bean id=3D"validatorFactory"=20
> class=3D"org.springframework.validation.commons.DefaultValidator
> Factory"=20
> init-method=3D"init">
> <property name=3D"resources">
> <list>
> =09
> <value>WEB-INF/validator-rules.xml</value>
> <value>WEB-INF/validation.xml</value>
> </list>
> </property>
> </bean>
>=20
> BTW, I also had to change "spring-commons-validator.tld" to=20
> *not* require
> formName:
>=20
> <attribute>
> <name>formName</name>
> <required>false</required>
> <rtexprvalue>true</rtexprvalue>
> </attribute>
>=20
> This is how Struts does it and its necessary to make a=20
> standalone JavaScript/JSP work.
>=20
> Thanks,
>=20
> Matt
>=20
> > -----Original Message-----
> > From: Matt Raible [mailto:li...@ra...]
> > Sent: Tuesday, April 27, 2004 9:26 AM
> > To: 'spr...@li...'
> > Subject: RE: [Springframework-developer] [Commons Validator]
> > Error on Startup
> >=20
> >=20
> > Thanks Keith - problem fixed!
> >=20
> > Matt
> >=20
> > > -----Original Message-----
> > > From: spr...@li...
> > > [mailto:spr...@li...]
> > > On Behalf Of Keith Donald
> > > Sent: Tuesday, April 27, 2004 8:30 AM
> > > To: spr...@li...
> > > Subject: RE: [Springframework-developer] [Commons=20
> Validator] Error=20
> > > on Startup
> > >=20
> > >=20
> > > ValidatorFactory is now a interface -=20
> DefaultValidatorFactory is the
> > > implementation. Daniel made it an interface to be a bit more=20
> > > flexible for those who had custom validation-xml loading=20
> > > requirements.
> > >=20
> > > Keith
> > >=20
> > > -----Original Message-----
> > > From: spr...@li...
> > > [mailto:spr...@li...]
> > > On Behalf Of Matt Raible
> > > Sent: Tuesday, April 27, 2004 2:51 AM
> > > To: spr...@li...
> > > Subject: [Springframework-developer] [Commons Validator] Error on
> > > Startup
> > >=20
> > >=20
> > > I grabbed a fresh checkout from CVS tonight, expecting that the
> > > commons validator stuff still worked. Unfortunately,=20
> (from what I=20
> > > can tell) it does not. Here's the error I get on startup:
> > >=20
> > > ERROR - FrameworkServlet.initServletBean(207) | Context
> > > initialization failed=20
> > > org.springframework.beans.factory.BeanDefinitionStoreException
> > > : Error registering bean with name 'va lidatorFactory'
> > > defined in resource [/WEB-INF/action-servlet.xml] of
> > > ServletContext: Validation of b
> > > ean definition with name failed; nested exception is=20
> > > org.springframework.beans.factory.support.BeanD
> > > efinitionValidationException: No public constructor in class=20
> > > [interface org.springframework.validati=20
> > > on.commons.ValidatorFactory]=20
> > > org.springframework.beans.factory.support.BeanDefinitionValida
> > > tionExcept
> > > ion: No public constructor i
> > > n class [interface=20
> > > org.springframework.validation.commons.ValidatorFactory]
> > > at=20
> > > org.springframework.beans.factory.support.RootBeanDefinition.v
> > > alidate(Ro
> > > otBeanDefinition.
> > > java:334)
> > > at=20
> > > org.springframework.beans.factory.support.DefaultListableBeanF
> > > actory.reg
> > > isterBeanDefiniti
> > > on(DefaultListableBeanFactory.java:194)
> > > at=20
> > > org.springframework.beans.factory.xml.DefaultXmlBeanDefinition
> > > Parser.loa
> > > dBeanDefinition(D
> > > efaultXmlBeanDefinitionParser.java:214)
> > > at=20
> > > org.springframework.beans.factory.xml.DefaultXmlBeanDefinition
> > > Parser.reg
> > > isterBeanDefiniti
> > > ons(DefaultXmlBeanDefinitionParser.java:152)
> > > at=20
> > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.
> > > registerBe
> > > anDefinitions(Xml
> > > BeanDefinitionReader.java:161)
> > > at=20
> > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.
> > > loadBeanDe
> > > finitions(XmlBean
> > > DefinitionReader.java:127)
> > >=20
> > > ----------------------------------------
> > >=20
> > > Here's my config:
> > >=20
> > > <bean id=3D"validatorFactory"
> > > class=3D"org.springframework.validation.commons.ValidatorFactory"
> > > init-method=3D"init">
> > > <property name=3D"resources">
> > > <list>
> > > =09
> > > <value>WEB-INF/validator-rules.xml</value>
> > > <value>WEB-INF/validation.xml</value>
> > > </list>
> > > </property>
> > > </bean>
> > >=20
> > > <bean id=3D"beanValidator"
> > > class=3D"org.springframework.validation.commons.BeanValidator">
> > > <property name=3D"validatorFactory"><ref
> > > local=3D"validatorFactory"/></property>
> > > </bean>
> > >=20
> > > Any ideas?
> > >=20
> > > Thanks,
> > >=20
> > > Matt
> > >=20
> > >=20
> > >=20
> > >=20
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: The Robotic Monkeys at=20
> ThinkGeek
> > > For a limited time only, get FREE Ground shipping on all=20
> orders of=20
> > > $35 or more. Hurry up and shop folks, this offer expires=20
> April 30th!
> > > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297
> > >=20
> > > _______________________________________________
> > >=20
> > > Springframework-developer mailing list
> > > Spr...@li...
> > >=20
> > https://lists.sourceforge.net/lists/listinfo/s>
> pringframework-developer
> > >=20
> > >=20
> > >=20
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: The Robotic Monkeys at=20
> ThinkGeek
> > > For a limited time only, get FREE Ground shipping on all=20
> orders of=20
> > > $35 or more. Hurry up and shop folks, this offer expires=20
> April 30th!
> > > http://www.thinkgeek.com/freeshipping/?cpg=12297
> > >=20
> > > _______________________________________________
> > > Springframework-developer mailing list
> > > Spr...@li...
> > >=20
> > https://lists.sourceforge.net/lists/listinfo/s>
> pringframework-developer
> > >=20
> >=20
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.net email is sponsored by: The Robotic Monkeys at=20
> ThinkGeek For a limited time only, get FREE Ground shipping=20
> on all orders of $35 or more. Hurry up and shop folks, this=20
> offer expires April 30th!=20
> http://www.thinkgeek.com/freeshipping/?cpg=12297
>=20
> _______________________________________________
> Springframework-developer mailing list=20
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
|