读书人

把轻量级j2ee工程从jboss移栽到webs

发布时间: 2012-11-12 12:31:57 作者: rapoo

把轻量级j2ee工程,从jboss移植到websphere须注意事项
1、websphere数据源获取方式:
在web.xml加入数据源的引用,如(OracleDS数据源):
<resource-ref id="OracleDS_ResourceRef">
<res-ref-name>OracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

配置hibernate的数据源属性(一定得以java:comp/env方式引用数据源):
<bean id="dataSource" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="configLocation">
<value>
classpath:com/hc360/mmt/db/cfg/topicdb.cfg.xml
</value>
</property>
</bean>

2、如果在运行中出现错误,一般情况下都是因为jar包的原因,要不少包,要不包的版本不对。我在实际应用中,发现使用Hibernate的createQuery老是通不过,发现原来是少了antlr.jar包。

读书人网 >操作系统

热点推荐