毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

javax.naming.NameNotFoundException: FirstEjbBean not bound

更新时间:2012-6-6:  来源:毕业论文

1.环境:
myeclipse6.0+jboss-4.2.2.GA
2.jboss可以正常启动和关闭
3.我已经把%JBOSS_HOME%\client\*Jar加到客户端类中。
遇到问题:

javax.naming.NameNotFoundException: FirstEjbBean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.mxf.ejb.FirstEjbClient.main(FirstEjbClient.java:22)

4.我的代码如下:
--接口
package com.mxf.ejb;
public interface FirstEjb {
public String sayHello(String str);
}

--接口实现Bean
package com.mxf.ejb;
import javax.ejb.Remote;
import javax.ejb.Stateless;
@Remote
@Stateless
public class FirstEjbBean implements FirstEjb {
public String sayHello(String str) {
return "您好!"+str;
}
}

--客户端
package com.mxf.ejb;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class FirstEjbClient {
public static void main(String[] args) {
try {
InitialContext itx = new InitialContext();
FirstEjb firstEjb = (FirstEjb)itx.lookup("FirstEjbBean/remote"); ---执行到这里报错
String str=firstEjb.sayHello("remain");
System.out.println(str);
} catch (NamingException e) {
e.printStackTrace();
} }}
 
@Remote 
@Stateless 
这里要明确指定。
@Remote(FirstEjb.class)
@Stateless(FirstEjb.class) 

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。