Re: Wicket + Spring 3 + Hibernate

2010-04-15 Thread Mauro Ciancio
Take out the 'default-autowire="byName"' from your beans.xml
and it will work.

Cheers!

On Thu, Apr 15, 2010 at 12:21 PM, Steven Haines  wrote:
> Sorry for the spam, I found the root cause of the problem - I guess there is 
> some kind of circular dependency in Spring/Hibernate that appeared when I 
> integrated the app with Wicket... I dont full understand, but I changed 
> application context XML file to wire by name instead of type and the problem 
> went away:
>
>        xmlns="http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:context="http://www.springframework.org/schema/context";
>       xmlns:util="http://www.springframework.org/schema/util";
>       xsi:schemaLocation="http://www.springframework.org/schema/beans
>        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>        http://www.springframework.org/schema/context
>        http://www.springframework.org/schema/context/spring-context-3.0.xsd
>        http://www.springframework.org/schema/util 
> http://www.springframework.org/schema/util/spring-util-3.0.xsd";>
>
> I appreciate your responses and I hope that someone can find my couple days 
> of troubleshooting helpful :)
>
> Thanks
> Steve
>
>
>
>
> ----- Original Message 
> From: Steven Haines 
> To: users@wicket.apache.org
> Sent: Thu, April 15, 2010 11:14:49 AM
> Subject: Re: Wicket + Spring 3 + Hibernate
>
> I posted a few lines from the error, but here is the complete stack trace. My 
> initial searches on this pointed to a circular dependency caused by 
> autowiring, which may or may not be the case - when I removed the 
> default-autowire parameter from my beans node then the error changed to state 
> that the bean needs a sessionFactory (because I removed it.) So note sure if 
> I took a step forward or back.
>
> If you are interested I created a sample project that produces the error, I 
> can zip it up and mail it to you (but dont want to spam the whole list with 
> an attachment...
>
> Thanks
> Steve
>
> Stack Trace:
>
> Apr 15, 2010 11:05:11 AM org.apache.catalina.core.StandardContext 
> listenerStart
> SEVERE: Exception sending context initialized event to listener instance of 
> class org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
> creating bean with name 'messageDao' defined in file 
> [/Users/scadmin/Downloads/apache-tomcat-6.0.20/webapps/wicketspringhibernateexample/WEB-INF/classes/com/informit/dao/HibernateMessageDaoImpl.class]:
>  Unsatisfied dependency expressed through bean property 'sessionFactory': : 
> Error creating bean with name 'sessionFactory' defined in class path resource 
> [applicationContext.xml]: Unsatisfied dependency expressed through bean 
> property 'eventListeners': : Error creating bean with name 
> 'transactionManager' defined in class path resource [applicationContext.xml]: 
> Cannot resolve reference to bean 'sessionFactory' while setting bean property 
> 'sessionFactory'; nested exception is 
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
> creating bean with name 'sessionFactory': FactoryBean which is currently in 
> creation returned null from getObject; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'transactionManager' defined in class path resource 
> [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' 
> while setting bean property 'sessionFactory'; nested exception is 
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
> creating bean with name 'sessionFactory': FactoryBean which is currently in 
> creation returned null from getObject; nested exception is 
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
> creating bean with name 'sessionFactory' defined in class path resource 
> [applicationContext.xml]: Unsatisfied dependency expressed through bean 
> property 'eventListeners': : Error creating bean with name 
> 'transactionManager' defined in class path resource [applicationContext.xml]: 
> Cannot resolve reference to bean 'sessionFactory' while setting bean property 
> 'sessionFactory'; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
> creating bean with name 'sessionFactory': FactoryBean which is currently in 
> creation returned null from getObject; 

Re: Wicket + Spring 3 + Hibernate

2010-04-15 Thread Steven Haines
Sorry for the spam, I found the root cause of the problem - I guess there is 
some kind of circular dependency in Spring/Hibernate that appeared when I 
integrated the app with Wicket... I dont full understand, but I changed 
application context XML file to wire by name instead of type and the problem 
went away:

http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:context="http://www.springframework.org/schema/context";
   xmlns:util="http://www.springframework.org/schema/util";
   xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-3.0.xsd";>

I appreciate your responses and I hope that someone can find my couple days of 
troubleshooting helpful :)

Thanks
Steve




- Original Message 
From: Steven Haines 
To: users@wicket.apache.org
Sent: Thu, April 15, 2010 11:14:49 AM
Subject: Re: Wicket + Spring 3 + Hibernate

I posted a few lines from the error, but here is the complete stack trace. My 
initial searches on this pointed to a circular dependency caused by autowiring, 
which may or may not be the case - when I removed the default-autowire 
parameter from my beans node then the error changed to state that the bean 
needs a sessionFactory (because I removed it.) So note sure if I took a step 
forward or back.

If you are interested I created a sample project that produces the error, I can 
zip it up and mail it to you (but dont want to spam the whole list with an 
attachment...

Thanks
Steve

Stack Trace:

Apr 15, 2010 11:05:11 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of 
class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'messageDao' defined in file 
[/Users/scadmin/Downloads/apache-tomcat-6.0.20/webapps/wicketspringhibernateexample/WEB-INF/classes/com/informit/dao/HibernateMessageDaoImpl.class]:
 Unsatisfied dependency expressed through bean property 'sessionFactory': : 
Error creating bean with name 'sessionFactory' defined in class path resource 
[applicationContext.xml]: Unsatisfied dependency expressed through bean 
property 'eventListeners': : Error creating bean with name 'transactionManager' 
defined in class path resource [applicationContext.xml]: Cannot resolve 
reference to bean 'sessionFactory' while setting bean property 
'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'transactionManager' defined in class path resource 
[applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' 
while setting bean property 'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'sessionFactory' defined in class path resource 
[applicationContext.xml]: Unsatisfied dependency expressed through bean 
property 'eventListeners': : Error creating bean with name 'transactionManager' 
defined in class path resource [applicationContext.xml]: Cannot resolve 
reference to bean 'sessionFactory' while setting bean property 
'sessionFactory'; nested exception is
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'transactionManager' defined in class path resource 
[applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' 
while setting bean property 'sessionFactory'; nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject
at 
org.springframework.

Re: Wicket + Spring 3 + Hibernate

2010-04-15 Thread Steven Haines
nested exception is 
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error 
creating bean with name 'sessionFactory': FactoryBean which is currently in 
creation returned null from getObject
at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1308)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:825)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:754)
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:685)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1134)
... 40 more
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: 
Error creating bean with name 'sessionFactory': FactoryBean which is currently 
in creation returned null from getObject
at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:157)
at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:244)
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 53 more
Apr 15, 2010 11:05:11 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext






- Original Message 
From: Sigmar Muuga 
To: users@wicket.apache.org; Steven Haines 
Sent: Thu, April 15, 2010 11:09:50 AM
Subject: Re: Wicket + Spring 3 + Hibernate

What error? Next time post the stack :)

On Thu, Apr 15, 2010 at 5:47 PM, Steven Haines  wrote:

> Hi,
>
> I am at a point where I need to upgrade my application from Spring 2.5.6 to
> Spring 3.0.1.RELEASE. I have a working application and when I update Spring,
> I see the following exception on deployment:
>
> Caused by:
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'sessionFactory': FactoryBean which is currently in
> creation returned null from getObject
>at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:157)
>at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
>at
> org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)
>
>
> I've simplified my Hibernate configuration to:
>
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
>
>
>
> key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect
>validate
>
>
>
>
>com.mycompany.model
>
>
>
>
> Finally, here is the dependency list in Maven for my Spring and Hibernate
> libraries with wicket.version=1.4.7 and spring.version=3.0.1.RELEAS

Re: Wicket + Spring 3 + Hibernate

2010-04-15 Thread Sigmar Muuga
What error? Next time post the stack :)

On Thu, Apr 15, 2010 at 5:47 PM, Steven Haines  wrote:

> Hi,
>
> I am at a point where I need to upgrade my application from Spring 2.5.6 to
> Spring 3.0.1.RELEASE. I have a working application and when I update Spring,
> I see the following exception on deployment:
>
> Caused by:
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'sessionFactory': FactoryBean which is currently in
> creation returned null from getObject
>at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:157)
>at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
>at
> org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)
>
>
> I've simplified my Hibernate configuration to:
>
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
>
>
>
> key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect
>validate
>
>
>
>
>com.mycompany.model
>
>
>
>
> Finally, here is the dependency list in Maven for my Spring and Hibernate
> libraries with wicket.version=1.4.7 and spring.version=3.0.1.RELEASE:
>
>org.apache.wicket
>wicket-spring
>${wicket.version}
>
>
>org.springframework
>org.springframework.context
>${spring.version}
>
>
>org.springframework
>org.springframework.core
>${spring.version}
>
>
>org.springframework
>org.springframework.web
>${spring.version}
>
>
>org.springframework
>org.springframework.web.servlet
>${spring.version}
>
>
>org.springframework
>org.springframework.beans
>${spring.version}
>
>
>org.springframework
>org.springframework.oxm
>${spring.version}
>
>
>org.springframework
>org.springframework.orm
>${spring.version}
>
>
>javax.servlet
>servlet-api
>${servlet-api.version}
>provided
>
>
>org.hibernate
>hibernate-core
>3.3.2.GA
>
>
>javax.persistence
>persistence-api
>1.0
>
>
>org.hibernate
>hibernate-annotations
>3.4.0.GA
>
>
>
> I have successfully integrated Spring 3 and Hibernate in a RESTful web
> service and I have successfully integrated Wicket 1.4.7 with Spring 2.5.6
> and Hibernate, but I am seeing errors specifically with Wicket and Spring 3
> with Hibernate. Has anyone successfully integrated the three technologies?
>
> Any suggestions?
>
> Thanks!
> Steve
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>