Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.beans.factory.BeanCreationExce ption: why this error occurs help.. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.beans.factory.BeanCreationExce ption: why this error occurs help..

    could you please tell me why this error is occuring very urgent

    org.springframework.beans.factory.BeanCreationExce ption:
    Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFac toryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory


    applicationContext-hybernate.xml

    <?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="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource" ref ="dataSource"/>
    <property name="mappingResources">
    <list>
    <value>com/beans/user.hbm.xml</value>
    <value>com/beans/Phone_Map.hbm.xml</value>
    </list>
    </property>

    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    </props>
    </property>
    </bean>


    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location"><value>/WEB-INF/jdbc.properties</value></property>
    </bean>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"><value>${jdbc.driverClassNa me}</value></property>
    <property name="url"><value>${jdbc.url}</value></property>
    <property name="username"><value>${jdbc.username}</value></property>
    <property name="password"><value>${jdbc.password}</value></property>
    </bean>


    <!-- Hibernate SessionFactory -->



    <bean id="openSessionInView" class="org.springframework.orm.hibernate3.support. OpenSessionInViewFilter">
    <property name="sessionFactoryBeanName"><ref local="sessionFactory"/></property>
    </bean>


    <bean id="userbo" class="com.business.userboimpl">
    <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>

    ---------------------------------------------------------------------------
    trailapp-servlet.xml
    <?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="userboimpl" class="com.business.userboimpl"/>
    <bean id="logonvalidator" class="com.controllers.uservalidator"/>
    <bean id="logonForm" class="com.controllers.usercontroller">
    <property name="sessionForm"><value>true</value></property>
    <property name="commandName"><value>user</value></property>
    <property name="commandClass"><value>com.beans.user</value></property>
    <property name="validator"><ref bean="logonvalidator"/></property>
    <property name="formView"><value>logon</value></property>
    <property name="successView"><value>mainpage</value></property>
    <property name="ibi"><ref local="userboimpl"/></property>
    </bean>


    <bean id="registerForm" class="com.controllers.Registerdata_Phone_Mapcontr oller">
    <property name="sessionForm"><value>true</value></property>
    <property name="commandName"><value>phone_map</value></property>
    <property name="commandClass"><value>com.beans.Phone_Map</value></property>
    <property name="formView"><value>success</value></property>
    <property name="successView"><value>mainpage</value></property>
    </bean>


    <bean id="mainForm" class="com.controllers.Mainpagecontroller">
    <property name="sessionForm"><value>true</value></property>
    <property name="formView"><value>mainpage</value></property>
    <property name="successView"><value>mainpage</value></property>
    </bean>


    <bean id="messageSource" class="org.springframework.context.support.Resourc eBundleMessageSource">
    <property name="basename"><value>messages</value></property>
    </bean>




    <!-- you can have more than one handler defined -->
    <bean id="urlMapping"
    class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="urlMap">
    <map>
    <entry key="/logon.htm">
    <ref bean="logonForm"/>
    </entry>
    <entry key="/success.htm">
    <ref bean="registerForm"/>
    </entry>
    <entry key="/mainpage.htm">
    <ref bean="mainForm"/>
    </entry>

    </map>
    </property>
    </bean>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="viewClass"><value>org.springframework.web.se rvlet.view.JstlView</value></property>
    <property name="prefix"><value>/WEB-INF/jsp/</value></property>
    <property name="suffix"><value>.jsp</value></property>
    </bean>
    </beans>


    </beans>

    --------------------------------------------------------------------------------user.hbm.xml
    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


    <hibernate-mapping>

    <class name="com.beans.user" table="USER">

    <id name="id" column="id">
    <generator type="string" class="guid"/>
    </id>
    <property name="username">
    <column name="USERNAME"/></property>
    <property name="password">
    <column name="PASSWORD"/></property>

    </class>

    </hibernate-mapping>
    -----------------------------------------------------------------------------Phone_Map.hbm.xml
    <?xml version="1.0" encoding="UTF-8"?>



    <hibernate-mapping>

    <class name="com.beans.Phone_Map" table="phone_map">

    <id name="rec_id" column="rec_id" type="int">
    <generator class="guid"/>
    </id>
    <property name="min_" column="min_" type="int"/>
    <property name="mob" column="mob" type="int"/>
    <property name="mdn" column="mdn" type="int"/>
    </class>


    </hibernate-mapping>


    urgent help required.......................

  • #2
    Looks like you haven't added SLF4J (Simple Logging Facade for Java) which I think hibernate has a dependency on.

    http://www.slf4j.org/

    Comment


    • #3
      well .. for me it looks like this line:
      org/slf4j/LoggerFactory
      is the key.

      Did you include slf4j into your dependencies ??
      And do you take care that it is part of your WEB-INF/lib directory during deployment as well ??

      Comment

      Working...
      X