|
From: Matt R. <li...@ra...> - 2004-04-27 16:23:09
|
Doh - spoke to soon. It seems like the following is failing in the
JavaScriptValidatorTag:
private ValidatorResources getValidatorResources() {
ListableBeanFactory lbf =3D WebApplicationContextUtils
=20
.getRequiredWebApplicationContext(pageContext.getServletContext());
ValidatorFactory factory =3D (ValidatorFactory)
BeanFactoryUtils
.beanOfTypeIncludingAncestors(lbf,
ValidatorFactory.class, true, true);
return factory.getValidatorResources();
}
I'm getting the following error now:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
unique bean of type
[org.springframework.validation.commons.ValidatorFactory] is defined:
Expected single bean but found 0
=09
org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAn
cestors(BeanFactoryUtils.java:147)
=09
org.springframework.validation.commons.taglib.JavascriptValidatorTag.get
ValidatorResources(JavascriptValidatorTag.java:773)
=09
org.springframework.validation.commons.taglib.JavascriptValidatorTag.doS
tartTag(JavascriptValidatorTag.java:346)
=09
org.apache.jsp.scripts.validator_jsp._jspx_meth_html_javascript_0(valida
tor_jsp.java:78)
=09
org.apache.jsp.scripts.validator_jsp._jspService(validator_jsp.java:55)
=09
Maybe my validatorFactory syntax is wrong?
<bean id=3D"validatorFactory"
class=3D"org.springframework.validation.commons.DefaultValidatorFactory" =
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>
BTW, I also had to change "spring-commons-validator.tld" to *not*
require formName:
<attribute>
<name>formName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
This is how Struts does it and its necessary to make a standalone
JavaScript/JSP work.
Thanks,
Matt
> -----Original Message-----
> From: Matt Raible [mailto:li...@ra...]=20
> Sent: Tuesday, April 27, 2004 9:26 AM
> To: 'spr...@li...'
> Subject: RE: [Springframework-developer] [Commons Validator]=20
> 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 Validator]=20
> > Error on Startup
> >=20
> >=20
> > ValidatorFactory is now a interface - DefaultValidatorFactory
> > is the implementation. Daniel made it an interface to be a=20
> > bit more flexible for those who had custom validation-xml=20
> > loading 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 can tell) it does not. Here's the error I get=20
> > on startup:
> >=20
> > ERROR - FrameworkServlet.initServletBean(207) | Context
> > initialization failed
> > org.springframework.beans.factory.BeanDefinitionStoreException
> > : Error registering bean with name 'va lidatorFactory'=20
> > 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"=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
> > <bean id=3D"beanValidator"
> > class=3D"org.springframework.validation.commons.BeanValidator">
> > <property name=3D"validatorFactory"><ref=20
> > 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
> > 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=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
> > 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
> > Spr...@li...
> >=20
> https://lists.sourceforge.net/lists/listinfo/s>
pringframework-developer
> >=20
>=20
|
|
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
|
|
From: Rob M. <Rob...@pe...> - 2004-04-27 20:09:16
|
Hey, Matt, I ran into something similar -- perhaps it is the issue you are facing. If you are running in a container that doesn't follow the Servlet 2.4 initialization order you will not be able to use the ContextLoaderListener. Instead, you'll need to use the ContextLoaderServlet and ensure that it loads before the DispatcherServlet. When I came across this it was manifested by a failed dependency -- that is, the reference I expected to be available wasn't in the context so configuration failed. HTH, Rob Matt Raible wrote: > 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 > |
|
From: Matt R. <li...@ra...> - 2004-04-30 09:45:23
|
I found that adding /WEB-INF/action-servlet.xml to my contextConfigLocation <context-param> solved my issue. Aren't listeners supposed to load before servlets? If not, I guess I'll have to use the Servlet. I'm on Tomcat 5.0.19. Thanks, Matt > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] > On Behalf Of Rob Moore > Sent: Tuesday, April 27, 2004 2:09 PM > To: spr...@li... > Subject: [Springframework-developer] Re: [Commons Validator] > Error on Startup > > > Hey, Matt, > > I ran into something similar -- perhaps it is the issue you > are facing. > If you are running in a container that doesn't follow the Servlet 2.4 > initialization order you will not be able to use the > ContextLoaderListener. Instead, you'll need to use the > ContextLoaderServlet and ensure that it loads before the > DispatcherServlet. When I came across this it was manifested > by a failed > dependency -- that is, the reference I expected to be > available wasn't > in the context so configuration failed. > > HTH, > > Rob > > Matt Raible wrote: > > 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 > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at > ThinkGeek For a limited time only, get FREE Ground shipping > on all orders of $35 or more. Hurry up and shop folks, this > offer expires April 30th! > http://www.thinkgeek.com/freeshipping/?cpg=> 12297 > > _______________________________________________ > > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Dmitriy K. <dko...@ru...> - 2004-04-30 13:11:07
|
I believe there is no guaranteed order in Servlet 2.3 spec, however this order is strictly enforced in 2.4 - listeners then servlets. Regards, Dmitriy. > Aren't listeners > supposed to load before servlets? If not, I guess I'll have to use the > Servlet. I'm on Tomcat 5.0.19. > > Thanks, |