spring+struts+hibernate问题
<bean id= "dataSource "
class= "org.apache.commons.dbcp.BasicDataSource ">
<property name= "driverClassName ">
<value> com.mysql.jdbc.Driver </value>
</property>
<property name= "url ">
<value> jdbc:mysql://localhost:3306/test </value>
</property>
<property name= "username ">
<value> root </value>
</property>
<property name= "password ">
<value> 1234 </value>
</property>
</bean>
<!--LocalSessionFactoryBean 整合hibernate3时的类 -->
<bean id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean "
destroy-method= "close ">
<property name= "dataSource ">
<ref bean= "dataSource "/>
</property>
加载sessionFactory会出错,这些就出现Servlet action is not available异常,去掉这些sessionFactory就可正常调用
与struts整合, 如果控制台sessionFactory不会出错
------解决方案--------------------贴出控制台的报错信息
------解决方案--------------------public static void main(String args[]){
------解决方案-------------------- <?xml version= "1.0 " encoding= "UTF-8 "?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN " "http://www.springframework.org/dtd/spring-beans.dtd ">
<beans>
<!--hibernate property Configure -->
<bean id= "propertyConfigure "
class= "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer ">
<property name= "location ">
<value> WebRoot/WEB-INF/configure/hibernate.properties </value>
</property>
</bean>
<!-- dataSource Configure-->
<bean id= "dataSource "
class= "org.apache.commons.dbcp.BasicDataSource ">
<property name= "driverClassName ">
<value> ${hibernate.connection.driver_class} </value>
</property>
<property name= "url ">
<value> ${hibernate.connection.url} </value>
</property>
<property name= "username ">
<value> ${hibernate.connection.username} </value>
</property>
<property name= "password ">
<value> ${hibernate.connection.password} </value>
</property>
</bean>
<!-- SessionFactory Configure -->
<bean id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean "
destroy-method= "destroy ">
<property name= "dataSource ">
<ref local= "dataSource " />
</property>
<property name= "hibernateProperties ">
<props>
<prop key= "hibernate.dialect ">
${hibernate.dialect}
</prop>
<prop key= "hibernate.show_sql ">
${hibernate.show_sql}
</prop>