-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4651149
By: macson
I used zk-3.0.1-20071114-freshly lib, my conf of spring is ok when i start tomcat.
when i upgrade to zk-3.0.1-20071129-freshly, i got a error .
----
10:06:23,640 ERROR ContextLoader:203 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'myTransactionManager' defined in ServletContext resource [/WEB-INF/conf/
spring/applicationContext.xml]: Cannot resolve reference to bean 'mySessionFacto ry' while setting bean property 'sessionFactory'; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name 'my SessionFactory' defined in ServletContext resource [/WEB-INF/conf/spring/applica
tionContext.xml]: Instantiation of bean failed; nested exception is org.springfr
amework.beans.factory.BeanDefinitionStoreException: Factory method [public stati c org.hibernate.SessionFactory org.zkoss.zkplus.hibernate.HibernateUtil.getSessi
onFactory()] threw exception; nested exception is java.lang.NullPointerException
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/conf/spri
ng/applicationContext.xml]: Instantiation of bean failed; nested exception is or
g.springframework.beans.factory.BeanDefinitionStoreException: Factory method [pu blic static org.hibernate.SessionFactory org.zkoss.zkplus.hibernate.HibernateUti
l.getSessionFactory()] threw exception; nested exception is java.lang.NullPointe rException Caused by:
org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [ public static org.hibernate.SessionFactory org.zkoss.zkplus.hibernate.HibernateU
til.getSessionFactory()] threw exception; nested exception is java.lang.NullPoin terException Caused by:
java.lang.NullPointerException
at org.zkoss.zkplus.hibernate.HibernateUtil.initSessionFactory(Hibernate
Util.java:100)
at org.zkoss.zkplus.hibernate.HibernateUtil.getSessionFactory(HibernateU
til.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:118)
at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:332)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:78
2)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:709)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:384)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3830)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
337)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
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:5
16)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2007-11-30 10:06:23 org.apache.catalina.core.StandardContext start
fatal: Error listenerStart
---------------------------
this is my spring conf:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="mySessionFactory" factory-method="getSessionFactory"
class="org.zkoss.zkplus.hibernate.HibernateUtil" lazy-init="true"/>
<bean id="myTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="allDAO" class="com.kingstargroup.util.AllDAO">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
</beans>
who can help me? thanks.
/macson
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4651207
By: henrichen
This is a bug brought in by adding new feature for allowing different Hibernate configuration file name.
I have post it to bug list. Please follow this bug traker.
http://sourceforge.net/tracker/index.php?func=detail&aid=1841417&group_id=152762
&atid=785191
It is a timing issue of when to construct the Hibernate SessionFactory. To work around in the mean time, try to add following in WEB-INF/zk.xml of your application and move the Spring's ContextLoaderListener to be after the ZK's DHtmlLayoutServlet in web.xml. See if it solves the issue.
<listener>
<description>Hibernate SessionFactory Lifecycle</description>
<listener-class>org.zkoss.zkplus.hibernate.HibernateSessionFactoryListener</li
stener-class>
</listener>
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4651230
By: macson
thanks henri's help.
I try to do it with your ad.
but it's always occured.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4651335
By: henrichen
The bug is fixed. You might have to wait the next Freshly release.
/henri
Asked: 2007-11-30 02:08:41 +0800
Seen: 161 times
Last updated: Nov 30 '07