当前位置: 技术问答>java相关
Jbuilder7与webshpere集成,jndi的问题,在线等待。。。。。。。。。。。。。。。。
来源: 互联网 发布时间:2015-10-13
本文导语: 各位看官请看这段代码,这是jbuilder中自动生产的客户端代码, try { //get naming context Context ctx = getInitialContext(); //look up jndi name Object ref = ctx.lookup("Enterprise1"); ...
各位看官请看这段代码,这是jbuilder中自动生产的客户端代码,
try {
//get naming context
Context ctx = getInitialContext();
//look up jndi name
Object ref = ctx.lookup("Enterprise1");
//cast to Home interface
enterprise1Home = (Enterprise1Home) PortableRemoteObject.narrow(ref, Enterprise1Home.class);
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded initializing bean access.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
}
e.printStackTrace();
}
}
文件执行到这儿输出的是"Failed initializing bean access."),请问这是为何?
Object ref = ctx.lookup("Enterprise1");为什么找不到jndi_name?
这是jetace_in.xml文件,这是有jbuilder生产的:
0
STATELESS_SESSION
myejb.Enterprise1Home
myejb.Enterprise1
myejb.Enterprise1Bean
Enterprise1
thinks a lot!
try {
//get naming context
Context ctx = getInitialContext();
//look up jndi name
Object ref = ctx.lookup("Enterprise1");
//cast to Home interface
enterprise1Home = (Enterprise1Home) PortableRemoteObject.narrow(ref, Enterprise1Home.class);
if (logging) {
long endTime = System.currentTimeMillis();
log("Succeeded initializing bean access.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
}
e.printStackTrace();
}
}
文件执行到这儿输出的是"Failed initializing bean access."),请问这是为何?
Object ref = ctx.lookup("Enterprise1");为什么找不到jndi_name?
这是jetace_in.xml文件,这是有jbuilder生产的:
0
STATELESS_SESSION
myejb.Enterprise1Home
myejb.Enterprise1
myejb.Enterprise1Bean
Enterprise1
thinks a lot!
|
你的EJB是否发布了?
|
Object ref = ctx.lookup("myejb/Enterprise1");