|
|
Flex4 Spring Hibernate BlazeDS dpHibernate integration
Hello,
I have got an error when I try to integrate dpHibernate to my own framework.
This framework integrate Flex4+Spring/Hibernate+BlazeDS.
Now, I would like to use lazy loading, that's why I try to integrate dpHibernate.
When, I start Tomcat, I got this error :Code:
ERROR: org..web.context.ContextLoader - Context initialization failed
org..beans.factory.BeanCreationException: Error creating bean with name 'org..flex.remoting.RemotingDestinationExporter#0': Cannot resolve reference to bean '_messageBroker' while setting bean property 'messageBroker'; nested exception is org..beans.factory.NoSuchBeanDefinitionException: No bean named '_messageBroker' is defined
at org..beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org..beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org..beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)
at org..beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
at org..beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org..beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org..beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org..beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org..beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org..beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org..beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org..context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org..context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org..web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org..web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org..web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Config files :
web.xml
Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;!DOCTYPE web-app PUBLIC quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//ENquot; quot;dtd/web-app_2_5.dtdquot;gt;
lt;web-app gt;
lt;display-namegt;Spring BlazeDS Integration Sampleslt;/display-namegt; lt;context-paramgt; lt;param-namegt;contextConfigLocationlt;/param-namegt; lt;param-valuegt;
classpath:app-config.xml
classpath:dao-config.xml
lt;/param-valuegt; lt;/context-paramgt; lt;filtergt; lt;filter-namegt;openSessionlt;/filter-namegt; lt;filter-classgt;org..orm.hibernate3.support.OpenSessionInViewFilterlt;/filter-classgt; lt;init-paramgt; lt;param-namegt;singleSessionlt;/param-namegt; lt;param-valuegt;truelt;/param-valuegt; lt;/init-paramgt; lt;/filtergt; lt;filter-mappinggt; lt;filter-namegt;openSessionlt;/filter-namegt; lt;ucl-patterngt;/*lt;/ucl-patterngt; lt;/filter-mappinggt; lt;listenergt; lt;listener-classgt;org..web.context.ContextLoaderListenerlt;/listener-classgt; lt;/listenergt; lt;listenergt; lt;listener-classgt;flex.messaging.fromFlexSessionlt;/listener-classgt; lt;/listenergt; lt;servletgt; lt;servlet-namegt;flexlt;/servlet-namegt; lt;servlet-classgt;org..web.servlet.DispatcherServletlt;/servlet-classgt; lt;load-on-startupgt;1lt;/load-on-startupgt; lt;/servletgt; lt;servlet-mappinggt; lt;servlet-namegt;flexlt;/servlet-namegt; lt;ucl-patterngt;/messagebroker/*lt;/ucl-patterngt; lt;/servlet-mappinggt; lt;welcome-file-listgt; lt;welcome-filegt;index.htmllt;/welcome-filegt; lt;/welcome-file-listgt;
lt;/web-appgt;
app-config.xml
Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;beans xmlns=quot;schema/beansquot; xmlns:flex=quot;schema/flexquot; xmlns:security=quot;schema/securityquot; xmlns:xsi=quot;2001/XMLSchema-instancequot; xmlns:aop=quot;schema/aopquot; xmlns:context=quot;schema/contextquot; xmlns:tx=quot;schema/txquot; xmlns:util=quot;schema/utilquot; xsi:schemaLocation=quot;schema/aop schema/aop/spring-aop-2.5.xsd schema/beans schema/beans/spring-beans-2.5.xsd schema/context schema/context/spring-context-2.5.xsd schema/flex schema/flex/spring-flex-1.0.xsd schema/security schema/security/spring-security-2.0.4.xsd schema/tx schema/tx/spring-tx-2.0.xsd schema/util schema/util/spring-util-2.0.xsd quot;gt; lt;context:annotation-config/gt;
lt;context:component-scan base-package=quot;fr.schneider.lancidquot;/gt;lt;!-- MessageTemplate makes it easy to publish messages --gt;
lt;bean id=quot;defaultMessageTemplatequot; class=quot;org..flex.messaging.MessageTemplatequot; /gt; lt;bean id=quot;dpHibernateRemotingAdapterquot;
class=quot;org..flex.core.ManageableComponentFactoryBeanquot;gt;
lt;constructor-arg value=quot;org.dphibernate.adapters.RemotingAdapterquot; /gt;
lt;property name=quot;propertiesquot;gt;
lt;mapgt;
lt;entry key=quot;dpHibernatequot;gt;
lt;mapgt;
lt;entry key=quot;serializerFactoryquot; value=quot;org.dphibernate.serialization.SpringContextSerializerFactoryquot;/gt;
lt;/mapgt;
lt;/entrygt;
lt;/mapgt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;dataAccessServicequot; class=quot;org.dphibernate.services.SpringLazyLoadServicequot; autowire=quot;constructorquot;gt; lt;flex:remoting-destination /gt;
lt;/beangt;
lt;bean id=quot;hibernateSessionFilterquot; class=quot;org.dphibernate.filters.SpringHibernateSessionServletFilterquot; /gt;
lt;bean id=quot;dpHibernateSerializerquot; class=quot;org.dphibernate.serialization.HibernateSerializerquot; scope=quot;prototypequot;gt; lt;property name=quot;pageSizequot; value=quot;10quot;/gt;
lt;/beangt;
lt;bean id=quot;dpHibernateDeserializerquot; class=quot;org.dphibernate.serialization.HibernateDeserializerquot; scope=quot;prototypequot; /gt;
lt;/beansgt;
flex-config.xml
Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;beans xmlns=quot;schema/beansquot;
xmlns:flex=quot;schema/flexquot; xmlns:xsi=quot;2001/XMLSchema-instancequot;
xmlns:security=quot;schema/securityquot;
xsi:schemaLocation=quot;
schema/beans
schema/beans/spring-beans-3.0.xsd
schema/flex
schema/flex/spring-flex-1.0.xsdquot;gt;
lt;flex:message-brokergt;
lt;flex:remoting-service default-adapter-id=quot;dpHibernateRemotingAdapterquot; default-channels=quot;my-amf,my-secure-amfquot; /gt; lt;flex:message-service default-channels=quot;my-streaming-amf,my-longpolling-amf,my-polling-amfquot; /gt;
lt;/flex:message-brokergt;
lt;bean id=quot;defaultMessageTemplatequot; class=quot;org..flex.messaging.MessageTemplatequot; /gt;
lt;/beansgt;
I don't understand why i got this error, because lt;flex:message-brokergt; should instantiate _messageBroker.
If someone has got an idea, pleaz tell me. I'm looking for a solution for 2 days
Thanks in advance
I do some changes. I have deleted the file flex-config.xml.
This the new app-config.xml :Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;beans xmlns=quot;schema/beansquot; xmlns:flex=quot;schema/flexquot; xmlns:security=quot;schema/securityquot; xmlns:xsi=quot;2001/XMLSchema-instancequot; xmlns:aop=quot;schema/aopquot; xmlns:context=quot;schema/contextquot; xmlns:tx=quot;schema/txquot; xmlns:util=quot;schema/utilquot; xsi:schemaLocation=quot;schema/aop schema/aop/spring-aop-2.5.xsd schema/beans schema/beans/spring-beans-2.5.xsd schema/context schema/context/spring-context-2.5.xsd schema/flex schema/flex/spring-flex-1.0.xsd schema/security schema/security/spring-security-2.0.4.xsd schema/tx schema/tx/spring-tx-2.0.xsd schema/util schema/util/spring-util-2.0.xsd quot;gt; lt;context:annotation-config/gt;
lt;context:component-scan base-package=quot;fr.schneider.lancidquot;/gt;lt;!-- MessageTemplate makes it easy to publish messages --gt;
lt;bean id=quot;defaultMessageTemplatequot; class=quot;org..flex.messaging.MessageTemplatequot; /gt; lt;bean id=quot;dpHibernateRemotingAdapterquot;
class=quot;org..flex.core.ManageableComponentFactoryBeanquot;gt;
lt;constructor-arg value=quot;org.dphibernate.adapters.RemotingAdapterquot; /gt;
lt;property name=quot;propertiesquot;gt;
lt;mapgt;
lt;entry key=quot;dpHibernatequot;gt;
lt;mapgt;
lt;entry key=quot;serializerFactoryquot; value=quot;org.dphibernate.serialization.SpringContextSerializerFactoryquot;/gt;
lt;/mapgt;
lt;/entrygt;
lt;/mapgt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;dataAccessServicequot; class=quot;org.dphibernate.services.SpringLazyLoadServicequot; autowire=quot;constructorquot;gt; lt;flex:remoting-destination /gt;
lt;/beangt;
lt;!-- lt;bean id=quot;hibernateSessionFilterquot; class=quot;org.dphibernate.filters.SpringHibernateSessionServletFilterquot; /gt; --gt;
lt;bean id=quot;dpHibernateSerializerquot; class=quot;org.dphibernate.serialization.HibernateSerializerquot; scope=quot;prototypequot;gt; lt;property name=quot;pageSizequot; value=quot;10quot;/gt;
lt;/beangt;
lt;bean id=quot;dpHibernateDeserializerquot; class=quot;org.dphibernate.serialization.HibernateDeserializerquot; scope=quot;prototypequot; /gt; lt;flex:message-brokergt;
lt;flex:remoting-service default-adapter-id=quot;dpHibernateRemotingAdapterquot; default-channels=quot;my-amf,my-secure-amfquot; /gt; lt;flex:message-service default-channels=quot;my-streaming-amf,my-longpolling-amf,my-polling-amfquot; /gt;
lt;/flex:message-brokergt;
lt;/beansgt;
Now, I got an other error :
Code:
org..beans.factory.BeanCreationException: Error creating bean with name 'org..flex.remoting.RemotingDestinationExporter#0': Invocation of init method failed; nested exception is org..beans.factory.BeanCreationException: Error creating bean with name 'dpHibernateRemotingAdapter': FactoryBean threw exception on object creation; nested exception is java.lang.ExceptionInInitializerErrorNow, I can start Tomcat !
I change the bean definition
Code:
lt;bean id=quot;dpHibernateRemotingAdapterquot; class=quot;org..flex.core.ManageableComponentFactoryBeanquot;gt; lt;constructor-arg value=quot;org.dphibernate.adapters.RemotingAdapterquot; /gt; lt;property name=quot;propertiesquot;gt; lt;valuegt;{quot;dpHibernatequot; : { quot;serializerFactoryquot; : quot;org.dphibernate.serialization.SpringContextSerializerFactoryquot; }} lt;/valuegt; lt;/propertygt;
lt;/beangt;
And I add jackson-core-asl-1.0.0.jar to the project.
I hope this thread could help someone
Now, I m getting an other error when I try to retrieve data from the database, but its an other story |
|