项目是使用spring + hibernate +mvc 框架完成的,开发环境 eclipse,oracle,tomcat,生产是要使用websphere8.5服务器,在部署的时候遇到如下情况
1.jar包不支持
依赖包全部使用websphere自带
2.由于测试时在applicationContext.xml中配置如下
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url"
value="jdbc:oracle:thin:@LOCALHOST:1521:ORCL" />
<property name="username" value="sa" />
<property name="password" value="sa" />
</bean>而在实际部署中要求使用jndi dataSource 配置,在applicationContext.xml更改如下
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="MyProject" />
</bean>
web.xml中加入配置
<resource-ref>
<description>DataSource</description>
<res-ref-name>MyProject</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>运行后,发现不能访问数据库,需要配置websphere中的jdbc 数据源、安全认证
检索到资料
本文介绍了一个使用Spring+Hibernate+MVC框架的项目在从测试环境迁移到Websphere 8.5生产环境时遇到的问题及解决方法,包括调整数据源配置以适应容器管理和配置JNDI数据源。

5602

被折叠的 条评论
为什么被折叠?



