我的不是一个web应用,是两个ejb,是一个ejb调用远程的ejb。我增加了 <ejb-ref> <ejb-ref-name>CarbinRemote</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <home>carbin.CarbinRemoteHome</home> <remote>carbin.CarbinRemote</remote> <ejb-link>Carbin</ejb-link> </ejb-ref>但是部署的时候提示我 Deployment failed on Server myserver weblogic.management.DeploymentException: Exception:weblogic.management.ApplicationException: activate failed for TravelAgentBean Module: TravelAgentBean Error: Exception activating module: EJBModule(TravelAgentBean,status=PREPARED) Unable to deploy EJB: TravelAgentBean from TravelAgentBean.jar:weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'Carbin' declared in the ejb-ref or ejb-local-ref 'CarbinRemote' in the application module 'TravelAgentBean.jar' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.我现在糊涂了,到底能不能调用?如果能应该怎样写呢?
<ejb-ref-description>
<ejb-ref-name>CarbinRemote</ejb-ref-name> //ejb-jar里面的那句
<jndi-name>你用外部test调用该ejb的jndi名称<jndi-name>
<ejb-ref-description>
快点结贴,我要拿来做第五条三角裤,还差1元了。
我的CrabinBean就是cmp的,现在CrabinBean和TravelAgentBean不在一个工程里,CrabinBean已经成功部署,并且知道他的jndi是CarbinRemote,现在要在TravelAgentBean里面调用它。您说的,“把你的TravelAgentBean也作成相应的托管”是什么意思?我的TravelAgentBean是无状态的sessionbean.to serf():
weblogic-ejb-jar.xml中没有“ejb-ref-description”这一项,errors提示:element type "ejb-ref-description" must be declared.
我的weblogic-ejb-jar.xml内容如下,要在那里加“ejb-ref-description”?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TravelAgentBean</ejb-name>
<jndi-name>TravelAgentBean</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
不在同一个工程?呵呵,是不是说错了
不在同一个工程不可能调的到
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd"> //这个非常重要
<weblogic-web-app>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/EjbRef1</ejb-ref-name>
<jndi-name>TestEJB</jndi-name>
</ejb-reference-description>
</reference-descriptor>
<context-root>WebModule1</context-root>
</weblogic-web-app>把本地的ejb/ejbref1映射到系统的TestEJB上了。不懂可以看//这个非常重要那行的那个dtd,文件。下载一个,仔细读读。
<ejb-ref>
<ejb-ref-name>CarbinRemote</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>carbin.CarbinRemoteHome</home>
<remote>carbin.CarbinRemote</remote>
<ejb-link>Carbin</ejb-link>
</ejb-ref>但是部署的时候提示我
Deployment failed on Server myserver
weblogic.management.DeploymentException:
Exception:weblogic.management.ApplicationException: activate failed for TravelAgentBean
Module: TravelAgentBean Error: Exception activating module: EJBModule(TravelAgentBean,status=PREPARED)
Unable to deploy EJB: TravelAgentBean from TravelAgentBean.jar:weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'Carbin' declared in the ejb-ref or ejb-local-ref 'CarbinRemote' in the application module 'TravelAgentBean.jar' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.我现在糊涂了,到底能不能调用?如果能应该怎样写呢?
只有create ejb和import ejb阿?import之后也不能给两个ejb建立联系阿?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<display-name>TravelAgentBean</display-name>
<enterprise-beans>
<session>
<ejb-name>TravelAgentBean</ejb-name>
<home>travelagentejb.TravelAgentHome</home>
<remote>travelagentejb.TravelAgent</remote>
<ejb-class>travelagentejb.TravelAgentBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/Carbin</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>carbin.CarbinRemoteHome</home>
<remote>carbin.CarbinRemote</remote>
<!--<ejb-link>../CarbinEJB/CarbinEJB.jar#Carbin</ejb-link>-->//这一行不知道要不要加上
</ejb-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>TravelAgentBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>然后在weblogic-ejb-jar.xml中加入 <reference-descriptor>,如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TravelAgentBean</ejb-name>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/Carbin</ejb-ref-name>
<jndi-name>CarbinRemote</jndi-name>
</ejb-reference-description>
</reference-descriptor>
<jndi-name>TravelAgentBean</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>部署程中,但是test却出现错误,提示:
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Environment not found on thread ]
...