Hello,
I am learning Spring and I am trying to create a small app in STS that uses Spring MVC and Hibernate. I am running into a problem where the Hibernate SessionFactory is not getting created when run (on JBOSS 5). I thought I have all the libraries included but perhaps there are some missing ones that I am not aware of? Here is the error message:
Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate3.LocalSessionFactoryBean] for bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.LocalSessionFactoryBean
Here are the relative beans in my servlet-context.xml file:
Code:<!-- Connection to Database --> <beans:bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <beans:property name ="driverClassName" value="org.hsqldb.jdbcDriver" /> <beans:property name = "url" value="jdbc:hsqldb:C:\SpringProjects\MVCProj1\database" /> <beans:property name = "username" value="ryan" /> <beans:property name = "password" value="ryan" /> </beans:bean> <!-- Hibernate SessionFactory --> <beans:bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <beans:property name="dataSource" ref="datasource"></beans:property> <beans:property name="configLocation" value="classpath:hibernate.cfg.xml"></beans:property> <beans:property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"></beans:property> <beans:property name="hibernateProperties" > <beans:props> <beans:prop key="hibernate.dialect">hibernate.dialect=org.hibernate.dialect.HSQLDialect</beans:prop> <beans:prop key="hibernate.show_sql">true</beans:prop> </beans:props> </beans:property> </beans:bean>
Here is a screenshot of the project jars included:
sts.jpg
Any help for this newbie to Spring and Hibernate would be appreciated.


Reply With Quote
