Announcement Announcement Module
Collapse
No announcement yet.
Problem with Hibernate sessionFactoryBean in application context initialization Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Hibernate sessionFactoryBean in application context initialization

    Can anybody help me, I'm stacked in this issue, I get the following exception

    Jul 13, 2010 7:46:02 PM org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry destroySingletons
    INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@b957ea: defining beans [dataSource,sessionFactory,genericHibernateDAO,tran sactionManager,org.springframework.aop.config.inte rnalAutoProxyCreator,org.springframework.transacti on.annotation.AnnotationTransactionAttributeSource #0,org.springframework.transaction.interceptor.Tra nsactionInterceptor#0,org.springframework.transact ion.config.internalTransactionAdvisor,activityDAO, assignedActivityDAO,customerDAO,expenseDAO,profess ionalDAO,projectDAO,subsystemDAO,countryDAO,activi tyAction,externalAction,internalAction,operatorAct ion,subsystemAction,vendorAction,profilePhoto,acti vityActionListing,externalActionListing,internalAc tionListing,operatorActionListing,profilePhotoActi onListing,subsystemActionListing,vendorActionListi ng,exceptionResolver]; root of factory hierarchy
    Jul 13, 2010 7:46:02 PM org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/ro-data.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1412)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:546)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:872)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:423)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3934)

    ... ETC ...

    This is ro-data.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>      
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx" 
           xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd      
               http://www.springframework.org/schema/aop
          	   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
          	   http://www.springframework.org/schema/tx
          	   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" >
    
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
    		<property name="driverClassName" value="org.postgresql.Driver" />
    		<property name="url" value="jdbc:postgresql://localhost:5432/ro" />
    		<property name="username" value="ro"/>
    		<property name="password" value="WinKclapwINk" />
    		<property name="initialSize" value="5" />
    		<property name="maxActive" value="50" />
    	</bean>
    	
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="mappingResources">
    			<list>
    				<value>/ro/model/Activity.hbm.xml</value>
    				<value>/ro/model/ActivityForecast.hbm.xml</value>
    				<value>/ro/model/AssignedActivity.hbm.xml</value>
    				<value>/ro/model/City.hbm.xml</value>
    				<value>/ro/model/Country.hbm.xml</value>
    				<value>/ro/model/Customer.hbm.xml</value>
    				<value>/ro/model/Expense.hbm.xml</value>
    				<value>/ro/model/Forecast.hbm.xml</value>
    				<value>/ro/model/Message.hbm.xml</value>
    				<value>/ro/model/Project.hbm.xml</value>
    				<value>/ro/model/State.hbm.xml</value>
    				<value>/ro/model/Subsystem.hbm.xml</value>
    				<value>/ro/model/User.hbm.xml</value>
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
    				<prop key="connection.autocommit">false</prop>
    				<prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
            		<prop key="cache.use_query_cache">false</prop>
    		        <prop key="cache.use_minimal_puts">false</prop>
    		        <prop key="max_fetch_depth">3</prop>
    		        <prop key="show_sql">true</prop>
    		        <prop key="format_sql">true</prop>
    		        <prop key="use_sql_comments">true</prop>
    		        <prop key="hbm2ddl.auto">create</prop>
    		        <prop key="current_session_context_class">thread</prop>		
    			</props>
    		</property>
    	</bean>
    	
    	<bean id="genericHibernateDAO" class="ro.dao.hibernate.GenericHibernateDAO" >
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>	
    	
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    	
    	<tx:annotation-driven />
    </beans>

  • #2
    Which user?

    I don't understand... Do you mean that the database management system user ro doesn't exist or that the User.hbm.xml User class doesn't exist? well I have created the database user and also the User class... I have tried several things and still doesn't work.

    Comment

    Working...
    X