tomcat6.0中调用Weblogic11中的EJB服务

1.Tomcat环境引用WeblogicEJB客户端jar文件
a.在D:\Oracle\Middleware\wlserver_10.3\server\lib目录中执行:
java-jar../../../modules/com.bea.core.jarbuilder_1.6.0.0.jar
如果是其他版本,需要将1.6.0.0替换为对应的版本号。
在执行上面的命令后,将在D:\Oracle\Middleware\wlserver_10.3\server\lib
目录生成一个wlfullclient.jar文件
b.将文件wlfullclient.jar放到tomcat安装的指定目录
例如:E:\cmtang\software\apache-tomcat-6.0.29\lib
c.重新启动tomcat生效
2.BME工程引用EJB工程APIjar文件
acService工程导出jar文件,BME工程引用
3.BME工程中,在spring配置文件中配置EJB
配置内容直接用的acConsole中的内容
a.BME\src\main\resources\bme.user.service.xml
配置文件如下:
<?xmlversion="1.0"encoding="UTF-8"?>
<beansxmlns="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"xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/utilhttp://www.springframework.org/schema/util/spring-util-2.0.xsd
http://www.springframework.org/schema/jeehttp://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
<util:propertiesid="jndienvironment"
location="classpath:jndi-env.properties"></util:properties>
<jee:jndi-lookupid="projectManagement"jndi-name="jndi/jndiname"
cache="true"lookup-on-startup="true"
proxy-interface="xxx"
environment-ref="jndienvironment">
</jee:jndi-lookup>

</beans>

b.配置域参数
BME\src\main\resources\jndi-env.properties
内容如下:
java.naming.factory.initial=weblogic.jndi
.WLInitialContextFactory
java.naming.provider.url=t3://localhost:7021
java.naming.security.principal=weblogic
java.naming.security.credentials=welcome1

4.部署EJB工程
将acService工程部署在Weblogic服务中
5.部署BME测试
测试步骤3中配置好的EJB对象是否正常加载。
将lookup-on-startup属性设置成true启动服务没有出错即表示加载EJB成功。

小结:测试过程中出现过许多错误,多数是jar包引用的问题。关键在于确定调用weblogic中EJB对象是需要哪些客户端jar文件,也就是步骤1

自己去找jar文件导入工程测试的话如大海捞针,没什么效果而且会出现很多冲突的问题。

猜你喜欢

转载自eap777.iteye.com/blog/1342302