日期:2014-05-18  浏览次数:20729 次

spring整合问题
加上
<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>  


<property   name= "mappingDirectoryLocations ">  
<list>  
<value> com/zy/pojos/Uzser.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>

</props>  
</property>  
</bean>  
这些就出现Servlet   action   is   not   available异常,去掉这些action就可正常调用
web.xml己经加上   <context-param>
<param-name> contextConfigLocation </param-name>
<param-value> /WEB-INF/applicationContext.xml </param-value>
</context-param>
<servlet>
<servlet-name> SpringContextServlet </servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>

------解决方案--------------------
把控制台上打印出来的异常打出来
------解决方案--------------------
<?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>
<pr