Hi,
I have a web application and I was used to use JDBC and every thing was working perfectly.
Now I wanted to use hibernate and the problem is right after adding /WEB-INF/applicationContext-hibernate.xml in context param of my web.xml my application doesn't get deployed and I get no error what so ever.
First I need to know why it doesn't get deployed so I would appreciate your input on this matter also I need to know how JBoss doesn't show any error message when it can't deploy my application, perhaps I have to turn on something to show me the message.
here is my /WEB-INF/applicationContext-hibernate.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="dataSourceH" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/MYDB"/>
<property name="username" value="user"/>
<property name="password" value="password"/>
</bean>
<bean id="sessionFactoryH" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>Test.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.connection.pool_size">5</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
</entry>
</map>
</property>
<property name="dataSource">
<ref bean="dataSourceH"/>
</property>
</bean>
<bean id="testHibernate" class="test.hibernate.TestHibernate">
<property name="sessionFactory" ref="sessionFactoryH"/>
</bean>
</beans>
Here is my web.xml:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>test</display-name>
<description>Test application</description>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext-hibernate.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>SpringTest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>ContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringTest</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
<!-- Redirects to "index.html" for dispatcher handling -->
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
|