Eclipse中EJB的调用时报错了,高手们,有谁知道原因及解决方法啊。谢谢了。

hangchangc 2004-12-09 11:28:26
错误信息:
javax.naming.NameNotFoundException: Unable to resolve 'LeaveAccessHome' Resolved: '' Unresolved:'LeaveAccessHome' ; remaining name 'LeaveAccessHome'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.ssess.client.SessionCMPClient.getHome(SessionCMPClient.java:27)
at com.ssess.client.SessionCMPClient.testBean(SessionCMPClient.java:50)
at com.ssess.client.SessionCMPClient.main(SessionCMPClient.java:67)
原代码如下:
public class SessionCMPClient {

private com.ssess.session.LeaveAccessHome getHome()
throws NamingException {
Object objref = getContext().lookup("LeaveAccessHome");
Object obj = PortableRemoteObject.narrow(objref,LeaveAccessHome.class);
System.out.println("abc");
return ((com.ssess.session.LeaveAccessHome) obj);
}
private InitialContext getContext() throws NamingException {
Hashtable props = new Hashtable();

props.put(
InitialContext.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(InitialContext.PROVIDER_URL, "t3://127.0.0.1:7001");

// This establishes the security for authorization/authentication
// props.put(InitialContext.SECURITY_PRINCIPAL,"username");
// props.put(InitialContext.SECURITY_CREDENTIALS,"password");

InitialContext initialContext = new InitialContext(props);
return initialContext;
}
public void testBean() {

try {
com.ssess.session.LeaveAccess myBean = getHome().create();
System.out.println("text :"+myBean.nextValue("text"));
//--------------------------------------
//This is the place you make your calls.
//System.out.println(myBean.callYourMethod());

} catch (RemoteException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
SessionCMPClient test = new SessionCMPClient();
test.testBean();

}
...全文
90 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cjc8279 2004-12-11
  • 打赏
  • 举报
回复
原因:jndi绑定出错,LeaveAccessHome,你看看部署文件中jndi名和lookup参数是不是一致
hangchangc 2004-12-09
  • 打赏
  • 举报
回复
UP
马行空牛耕田 2004-12-09
  • 打赏
  • 举报
回复
javax.naming.NameNotFoundException
EJB部署有问题吧

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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