weblogic7+jbuiler7初学者bean互相调用问题求教(在线求教)

u_u_u 2002-11-11 04:52:16
我的环境是weblogic7+jbuiler7,调用的次序如下:
client->session bean->entity bean->db
问题处在session bean->entity bean环节,
主体代码如下(省略了系统自动生成的代码,编译发布成功):

import cmpdemo.*;

public class HelloBean2Bean implements SessionBean {
public java.lang.String SayHello()
{
try
{
Tab01 tab = getTab01Home().findByPrimaryKey("abcdefg");
return new String(tab.getName());
}
catch(Exception e) { throw new EJBException(e); }
}

private Context getInitialContext() throws Exception {
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
}

return new InitialContext(properties);
}
catch(Exception e) {
throw e;
}
}

private Tab01Home getTab01Home()
{
InitialContext initCtx = null;
try
{
Context ctx = getInitialContext();
Object ref = ctx.lookup("Tab01");
return (Tab01Home)ref;
}
catch(Exception e) { throw new EJBException( e); }
}
}

客户端代码为自动生成代码执行时出错(entity bean Tab01单独用自动生成客户端测试没有问题),信息如下:
E:\bea\jdk131_03\bin\javaw -classpath "D:\Dep\J2EE\EJB\jbproject\HelloDemo2\classes;E:\bea\weblogic700\server\lib\weblogic_sp.jar;E:\bea\weblogic700\server\lib\weblogic.jar;D:\Dep\J2EE\EJB\jbproject\CMPDemo\classes;E:\bea\jdk131_03\jre\lib\i18n.jar;E:\bea\jdk131_03\jre\lib\jaws.jar;E:\bea\jdk131_03\jre\lib\rt.jar;E:\bea\jdk131_03\jre\lib\sunrsasign.jar;E:\bea\jdk131_03\lib\dt.jar;E:\bea\jdk131_03\lib\htmlconverter.jar;E:\bea\jdk131_03\lib\tools.jar" hellodemo2.HelloBean2TestClient1
-- Initializing bean access.

-- Succeeded initializing bean access.

-- Execution time: 4484 ms.

-- Calling create()

-- Succeeded: create()

-- Execution time: 47 ms.

-- Return value from create(): hellodemo2.HelloBean2Bean_6xtxps_EOImpl_WLStub@2cb585.

-- Calling SayHello()

java.rmi.RemoteException: EJB Exception: ; nested exception is:
javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'app/ejb/CMPMoudle.jar#Tab01/local-home' Resolved: 'app/ejb' Unresolved:'CMPMoudle.jar#Tab01' ; remaining name 'CMPMoudle.jar#Tab01/local-home']; Link Remaining Name: 'java:app/ejb/CMPMoudle.jar#Tab01/local-home'

Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'app/ejb/CMPMoudle.jar#Tab01/local-home' Resolved: 'app/ejb' Unresolved:'CMPMoudle.jar#Tab01' ; remaining name 'CMPMoudle.jar#Tab01/local-home']; Link Remaining Name: 'java:app/ejb/CMPMoudle.jar#Tab01/local-home'

。。。。省略

...全文
23 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
u_u_u 2002-11-12
  • 打赏
  • 举报
回复
help!
u_u_u 2002-11-11
  • 打赏
  • 举报
回复
ejb-jar文件如下:
<?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>
<enterprise-beans>
<session>
<display-name>HelloBean2</display-name>
<ejb-name>HelloBean2</ejb-name>
<home>hellodemo2.HelloBean2Home</home>
<remote>hellodemo2.HelloBean2</remote>
<ejb-class>hellodemo2.HelloBean2Bean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type></session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>HelloBean2</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

1,221

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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