I am using webflow for the first time and I am trying to set up JSR-303 Bean Validation. According to the documentation:
http://static.springsource.org/spring-webflow/docs/2.3.x/reference/htmlsingle/spring-webflow-reference.html#view-validate
I need to add a validator to my flow-builder-services.
I do this and I get the following error in my source:
cvc-complex-type.3.2.2: Attribute 'validator' is not allowed to appear in element 'webflow:flow-builder-services'.
When I run the app I get the following error:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [webflowContext.xml]
Offending resource: class path resource [spring-servlet.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from class path resource [webflowContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'validator' is not allowed to appear in element 'webflow:flow-builder-services'.
It seems the flow config is set up correctly I can navigate from my welcome page to my second page in my flow just fine.
I am using Spring-3.0.5, Spring-Webflow-2.3.0
Any help would be much appreciated.
Thanks
Found the answer to this myself.
Make sure to use
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
in the declaration statement.
The manual and the ebooks I was using showed
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
Hope that helps someone.
Related
Im trying to follow the guide for Hybris123 version 19.05, but when creating new services I get a problem where the spring framework does not recognize my service.
I tried to change the neme of the variable but honestly Im not sure what to do.
The errorIm getting is "org.springframework.beans.FatalBeanException: Context hybris Global Context Factory couldn't be created correctly due to, Error creating bean with name 'applicationEventMulticaster': Unsatisfied dependency expressed through method 'setAllDecorators' parameter 0; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [concerttours.service.impl.DefaultBandService] for bean with name 'defaultBandService' defined in class path resource [concerttours-spring.xml]; nested exception is java.lang.ClassNotFoundException"
The code Im using in spring is:
<alias name = "defaultBandService" alias = "DefaultBandService"/>
<bean id = "defaultBandService" class = "concerttours.service.impl.DefaultBandService" >
<property name = "bandDAO" ref = "bandDAO" />
</bean>
And when I use the IDE for looking a file with the name DefaultBandService it recognizethe service that Im trying to use but the spring framework does not. In the service tried to use a spring Tag like component but it didnt work.
I expect spring to recgonize the bean and let me run the hybris server
Use your IDE to look for the class(i.e DefaultBandService).
Check the package of the class(most probably the first line of the file).
Make sure that the package is specified correctly in your spring xml File.
Make sure that the class is in the same extension as the Spring file. If it is not, then a dependency needs to be added in extensioninfo.xml.
Run "ant clean all" and start the Server again.
In trying to create a demo Spring-MVC application, I'm running into an issue on startup:
ConversionNotSupportedException: Failed to convert property value of type org.apache.commons.dbcp.BasicDataSource to required type org.apache.tomcat.dbcp.dbcp2.BasicDataSource for property dataSource; nested exception is java.lang.IllegalStateException: Cannot convert value of
type [org.apache.commons.dbcp.BasicDataSource] to required type [org.apache.tomcat.dbcp.dbcp2.BasicDataSource] for property dataSource: no matching
editors or conversion strategy found
My question is, why does Tomcat think it needs to convert the BasicDataSource when it's defined in the applicationContext.xml file as
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
I can't see where it's getting that from...
I took the Captain-Kirk approach to solving this problem: I changed the parameters of the situation. Instead of trying to figure out why my new demo application, I copied an existing app then slowly changed and deleted things so that I got to my demo application. A more laborious approach, for sure, but I achieved my results ultimately...
I have a spring configuration with a property placeholder directive attribute that is not being recognised. I have verified that the actual property can be resolved by creating a simple class that outputs the property:
<bean id="propTest" class="com.johnsands.unite.PropertyLogger">
<constructor-arg value="security.configuration"/>
<constructor-arg value="${security.configuration}"/>
</bean>
This simple bean outputs the given parameters, which it does just fine. But when I try to use that same property in an import, as in the following:
<import resource="${security.configuration}"/>
I get the following error.
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from ServletContext resource
[/WEB-INF/spring/root-context.xml]; nested exception is
java.lang.IllegalArgumentException: Could not resolve placeholder
'security.configuration' in string value "${security.configuration}"
This does not make sense as I have verified the property can be resolved. It also appears that the directive should be supported as spring is trying to resolve the placeholder but is not able to.
I'm working on an update version of grail-oauth-plugin that support last spring-oauth
My plugin version works good and I have implemented a workin oauth2 server.
But now I want to add a custom-grant defined like this
def doWithSpring = {
myTokenGranter(MyTokenGranter)
xmlns oauth:"http://www.springframework.org/schema/security/oauth2"
oauth.'authorization-server'( /* ... many definitions here ... */){
/* ... many definitions here ... */
oauth.'custom-grant'('token-granter-ref': "myTokenGranter")
}
}
But I get an exception telling me:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'myTokenGranter'
But the bean myTokenGranter is defined as you can see. And If I remove the custom-grant definition the project starts and I can access the myTokenGranter bean.
Looking to a fullstack trace I see that the exception occur in the spring oatuh2 server bean definition parse AuthorizationServerBeanDefinitionParser.java in the line where it try to find my bean
parserContext.getRegistry().getBeanDefinition(customGranterRef);
where customGranterRef = "myTokenGranter"
so I suspect there is a bug in Spring Ouath or in Grails BeanBuilder that does not let my "myTokenGranter" to be visible in the server parser. Or making some error in grails bean definition DSL.
Thank you for your interest.
Debugging the app more deeply I have found that the problem probably is in how grails BeanBuilder work in translating namespaced spring DSL.
If I debug the point where my bean is checked (in AuthorizationServerBeanDefinitionParser.java)
at row
parserContext.getRegistry().getBeanDefinition(customGranterRef);
if I check che result of
parserContext.getRegistry().getBeanDefinitionNames()
it show me only this beans
[org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalRequiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.annotation.internalPersistenceAnnotationProcessor
org.springframework.aop.config.internalAutoProxyCreator
org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0
org.springframework.transaction.interceptor.TransactionInterceptor#0
org.springframework.transaction.config.internalTransactionAdvisor
oauth2TokenGranter
oauth2AuthorizationCodeServices
oauth2AuthorizationRequestManager]
And not all other decleared beans...
The problem exist even if I move the ouath server declaration inside resources.xml, keeping my custom token granter bean declaration inside resources.groovy.
But the problem solves if I move the custom token bean declaration inside resources.xml.
I don't really know how the BeanBuilder DSL works, but it seems like the problem is there if there is a problem (your example works just fine in XML). Can you do it in two steps, so the bean definition for myTokenGranter is definitely available when the OAuth2 namepsace is handled?
Solved hacking Spring Security Oauth
see this commit
to use #autowired. in xml, i only need to included
<context:annotation-config /> ?
is there any other tag i need to put ? need to put componenet-scan ?
weird, i get error below
ERROR - ContextLoader.initWebApplicationContext(203) | Context initialization fa
iled
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'org.springframework.context.annotation.internalRequiredAnnotationProcess
or': Initialization of bean failed; nested exception is org.springframework.bean
s.InvalidPropertyException: Invalid property 'order' of bean class [org.springfr
amework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor]: No proper
ty 'order' found
Caused by:
org.springframework.beans.InvalidPropertyException: Invalid property 'order' of
bean class [org.springframework.beans.factory.annotation.RequiredAnnotationBeanP
ostProcessor]: No property 'order' found
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrap
perImpl.java:376)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
The <context:annotation-config /> option was introduced in Spring 2.5. Under the covers, this creates and configures a RequiredAnnotationBeanPostProcessor, and uses the order property of that. In Spring 2.0, RequiredAnnotationBeanPostProcessor exists, but has no order property.
My guess is that you have both Spring 2.5 and 2.0 on your classpath. The copy of 2.5 would have allowed you to use <context:annotation-config />, but then it used the 2.0 copy for RequiredAnnotationBeanPostProcessor.
This looks like a class path issue. Do you mix incompatible versions of different Spring jars, or are there multiple RequiredAnnotationBeanPostProcessor classes on your classpath?
Earlier versions of that class (up to 2.0.x) did not have an order property.