IDE: ECLIPSE  JDK1.6  TOMCAT 5.5
hibernate 3.3.1 + spring 2.5.5 + struts 2.0.11  整合,spring.xml(applicationContext.xml)文件如下:<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="dateSource" class="class org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@192.168.1.102:1521:ORCL"></property>
<property name="username" value="tracy"></property>
<property name="password" value="tracy"></property>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dateSource" ref="dateSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>

</list>
</property>
</bean>

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
<property name="cacheQueries">
<value>true</value>
</property>
</bean>

</beans> 
web.xml如下<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring.xml</param-value>
</context-param>

<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>

<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>


<filter>
<filter-name>encoding</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>

<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>

</web-app>我的lib目录
启动tomcat时报错:2011-3-15 16:19:05 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2011-3-15 16:19:05 org.apache.catalina.core.StandardContext start
严重: Context [/firstProject] startup failed due to previous errors
16:19:05,250  INFO [/firstProject]:653 - Shutting down log4j
2011-3-15 16:19:05 org.apache.coyote.http11.Http11BaseProtocol startweb.xml中去掉<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring.xml</param-value>
</context-param>时,不在报错这是怎么回事啊,Jar 文件冲突 还是怎么的?

解决方案 »

  1.   

    你先把图片传到你的CSDN相册里面,然后引用那个链接。
      

  2.   

    http://hi.csdn.net/space-5819690-do-album-picid-763734-goto-down.html
      

  3.   

    先把你的spring的xml文件重命名为:applicationContext.xml
    然后确定你在web.xml正确引用了applicationContext.xml。
      

  4.   

    在web这样引用是正确的吗 ?<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
      

  5.   

    你可以去看一下我在这个帖子里面3L的回复。http://topic.csdn.net/u/20110121/23/8ad99257-410f-44f8-be16-34758dc55a37.html
    那是一个简单的整合。
      

  6.   

    你要是这样配置,applicationContext.xml直接放到web-inf的根目录下面就行。
      

  7.   

    嗯  是  允许了  在 输入完整地址下面我 把把输入条中的内容改成了 http://hi.csdn.net/space-5819690-do-album-picid-763734-goto-down.html