Announcement Announcement Module
Collapse
No announcement yet.
error creating bean 'sessionfactory' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error creating bean 'sessionfactory'

    I migrated to hibernate3 and spring 1.2RC2 but when I try to start up my server I get the following error:

    Code:
    [11/05/05 8:58:36:245 CEST] 3d3f51ee DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Creating shared instance of singleton bean 'sessionFactory'
    [11/05/05 8:58:36:355 CEST] 3d3f51ee Environment   I org.hibernate.cfg.Environment  Hibernate 3.0.3
    [11/05/05 8:58:36:355 CEST] 3d3f51ee Environment   I org.hibernate.cfg.Environment  hibernate.properties not found
    [11/05/05 8:58:36:355 CEST] 3d3f51ee Environment   I org.hibernate.cfg.Environment  using CGLIB reflection optimizer
    [11/05/05 8:58:36:355 CEST] 3d3f51ee Environment   I org.hibernate.cfg.Environment  using JDK 1.4 java.sql.Timestamp handling
    [11/05/05 8:58:37:136 CEST] 3d3f51ee HbmBinder     I org.hibernate.cfg.HbmBinder  Mapping class: be.xxx.common.vo.Holiday -> p501holi
    [11/05/05 8:58:37:214 CEST] 3d3f51ee LocalSessionF I org.springframework.orm.hibernate3.LocalSessionFactoryBean  Building new Hibernate SessionFactory
    [11/05/05 8:58:37:214 CEST] 3d3f51ee Configuration I org.hibernate.cfg.Configuration  processing extends queue
    [11/05/05 8:58:37:230 CEST] 3d3f51ee Configuration I org.hibernate.cfg.Configuration  processing collection mappings
    [11/05/05 8:58:37:230 CEST] 3d3f51ee Configuration I org.hibernate.cfg.Configuration  processing association property references
    [11/05/05 8:58:37:230 CEST] 3d3f51ee Configuration I org.hibernate.cfg.Configuration  processing foreign key constraints
    [11/05/05 8:58:37:464 CEST] 3d3f51ee ConnectionPro I org.hibernate.connection.ConnectionProviderFactory  Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
    [11/05/05 8:58:38:402 CEST] 3d3f51ee WSRdbDataSour I DSRA8203I: Database product name : DB2 UDB for AS/400
    [11/05/05 8:58:38:402 CEST] 3d3f51ee WSRdbDataSour I DSRA8204I: Database product version : 05.02.0000 V5R2m0
    [11/05/05 8:58:38:402 CEST] 3d3f51ee WSRdbDataSour I DSRA8205I: JDBC driver name  : AS/400 Toolbox for Java JDBC Driver
    [11/05/05 8:58:38:402 CEST] 3d3f51ee WSRdbDataSour I DSRA8206I: JDBC driver version  : 6.0
    [11/05/05 8:58:38:902 CEST] 3d3f51ee SettingsFacto I org.hibernate.cfg.SettingsFactory  RDBMS: DB2 UDB for AS/400, version: 05.02.0000 V5R2m0
    [11/05/05 8:58:38:902 CEST] 3d3f51ee SettingsFacto I org.hibernate.cfg.SettingsFactory  JDBC driver: AS/400 Toolbox for Java JDBC Driver, version: 6.0
    [11/05/05 8:58:38:902 CEST] 3d3f51ee DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory  Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,methodologyDatasource,sessionFactory]; root of BeanFactory hierarchy}
    [11/05/05 8:58:38:902 CEST] 3d3f51ee ContextLoader E org.springframework.web.struts.ContextLoaderPlugIn  Context initialization failed
    [11/05/05 8:58:38:917 CEST] 3d3f51ee ContextLoader E org.springframework.web.struts.ContextLoaderPlugIn  TRAS0014I: The following exception was logged org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/config/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException: null
    java.lang.NullPointerException
    	at java.util.Hashtable.put(Hashtable.java(Compiled Code))
    	at java.util.Properties.setProperty(Properties.java:129)
    	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:107)
    	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1509)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:678)
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:613)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1114)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:349)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:223)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:271)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:319)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
    	at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:352)
    	at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:295)
    	at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:224)
    	at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
    	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
    	at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    	at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
    	at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
    	at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
    	at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
    	at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
    	at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    	at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:870)
    	at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
    	at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
    	at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1277)
    	at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
    	at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:387)
    	at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:209)
    	at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:1005)
    	at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
    	at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
    	at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
    	at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
    	at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
    	at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
    	at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
    	at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
    	at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
    	at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
    	at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:128)
    	at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
    	at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
    	at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
    	at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
    	at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
    	at java.lang.reflect.Method.invoke(Method.java:386)
    	at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:105)
    	at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:97)
    .
                                     org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/config/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException: null
    java.lang.NullPointerException
    	at java.util.Hashtable.put(Hashtable.java(Compiled Code))
    	at java.util.Properties.setProperty(Properties.java:129)
    	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:107)
    	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1509)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054)
    .......
    I checked my DAO implementations, they use hibernate3 packages, so does my mapping file.

    this is my applicatonContext.xml (kept simple)

    Code:
     	<bean id="methodologyDatasource" class="org.springframework.jndi.JndiObjectFactoryBean">
     		<property name="jndiName">
     			<value>jdbc/methdodology</value>
     		</property>
     	</bean>
     	
     	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
     		<property name="dataSource">
     			<ref local="methodologyDatasource"/>
     		</property>
     		
     		<property name="mappingResources">
    			<list>
    				<value>be/xxx/common/dao/impl/iSeries/mapping/Holiday.hbm.xml</value>
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    	        <prop key="show_sql">true</prop>
    	        <prop key="dialect">org.hibernate.dialect.DB2400Dialect</prop>
    			<prop key="hibernate.query.substitutions">true 1, false 0</prop>
    
    			</props>
    		</property>
    	
    	</bean>
    what could go wrong here?

  • #2
    I found my problem.

    apparently the hibernateProperties are also changed in the version change

    instead of using show_sql you now have to use hibernate.show_sql, the same with dialect -> hibernate.dialect

    Comment

    Working...
    X