Could not resolve placeholder 'hibernate.driverClassName'

yqy3504 2011-12-16 09:45:57
将Tomcat下的SSH架构的项目移植到weblogic下,tomcat下是可以运行的

在weblogic下部署项目

部署成功,登陆页面点击登录报错No bean named 'sessionFactory' is defined

然后我在weblogic.xml下加入
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

再在weblogic下部署,部署失败,并报错
weblogic.application.ModuleException: :org.springframework.beans.factory.BeanDefinitionStoreException:Invalid bean definition with name 'dataSource' defined in file [D:\SDK\Workspace\Workspace fo MyEclipse\PersonnelPro\WebRoot\WEB-INF\classes\applicationContext-common.xml]: Could not resolve placeholder 'hibernate.driverClassName'

我的applicationContext-common.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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd ">


<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:hibernate.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName"
value="${hibernate.driverClassName}">
</property>
<property name="url"
value="${hibernate.url}">
</property>
<property name="username" value="${hibernate.username}"></property>
<property name="password" value="${hibernate.password}"></property>
<!-- 最大活动连接数 -->
<property name="maxActive" value="100"></property>
<!-- 最大可空闲连接数 -->
<property name="maxIdle" value="30"></property>
<!-- 最大可等待连接数 -->
<property name="maxWait" value="500"></property>
<!-- 默认的提交方式(如果不需要事务可以设置成true,在实际应用中一般设置为false,默认为false) -->
<property name="defaultAutoCommit" value="true"></property>
</bean>


<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>

<property name="hibernateProperties">
<props>
<!-- <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop> -->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>


<value>com/personnel/model/Message.hbm.xml</value>
<value>com/personnel/model/Organization.hbm.xml</value>
<value>com/personnel/model/User.hbm.xml</value>
</list>
</property>
</bean>

<!-- 事务配置 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>


<tx:advice id="advice">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="*" read-only="false"
propagation="SUPPORTS" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="point"
expression="execution(* com.personnel.service.*.*(..))" />
<aop:advisor advice-ref="advice" pointcut-ref="point" />
</aop:config>


<!-- 定义BeanNameAutoProxyCreator-->
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- 指定对满足哪些bean name的bean自动生成业务代理 -->
<property name="beanNames">
<!-- 下面是所有需要自动创建事务代理的bean-->
<list>
<value>mgr</value>
</list>
<!-- 此处可增加其他需要自动创建事务代理的bean-->
</property>
<!-- 下面定义BeanNameAutoProxyCreator所需的事务拦截器-->
<property name="interceptorNames">
<list>
<!-- 此处可增加其他新的Interceptor -->
<value>transactionInterceptor</value>
</list>
</property>
</bean>


</beans>


我的web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


<!-- 监听 -->

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>


<!-- -过滤器 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gbk</param-value>
</init-param>
</filter>
<filter>
<filter-name>pathfilter</filter-name>
<filter-class>com.personnel.filter.FilterServlet</filter-class>
</filter>
<filter-mapping>
<filter-name>pathfilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

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

<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>

<!-- fck配置 -->
<servlet>
<servlet-name>ConnectorServlet</servlet-name>
<servlet-class>
net.fckeditor.connector.ConnectorServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>ConnectorServlet</servlet-name>
<url-pattern>/fckeditor/editor/filemanager/connectors/*</url-pattern>
</servlet-mapping>


<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>


...全文
891 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
oxcow 2011-12-17
  • 打赏
  • 举报
回复
你的 <value>classpath:hibernate.properties</value>文件里有
声明hibernate.driverClassName这个属性没?

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧