运行Stateless,Remote EJB时候报javax.naming.NameNotFoundException: FirstEjbBean not bound解决办法
发布时间:2010-06-14 17:13:42 文章来源:www.iduyao.cn 采编人员:星星草
运行Stateless,Remote EJB时候报javax.naming.NameNotFoundException: FirstEjbBean not bound
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();
}
}
}
------解决方案--------------------
用main函数应该不可以吧,做成web应用,放到jboss里就好了。
------解决方案--------------------
@Remote
@Stateless
这里要明确指定。
@Remote(FirstEjb.class)
@Stateless(FirstEjb.class)
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
jboss不能部署项目
我的jboss可以正常启动,但是部署项目时报出大量错误... 请高手帮忙解决下这是怎么回事... 感激不尽 我的j...
-
错误: javax.naming.NameNotFoundException: StatfulEjbBean not bound
刚学Jboos用的是Myeclipse,刚写第一个程序就不会了。运行...
-
jboss出错了,求解。在线等。
操作系统,solaris10 x86 ,启动jboss报错。日志如下。
求解,在线等。
# sh /export/home/jboss/jboss-...
-
JBOSS Incomplete Deployment listing 问题?
运行JBOSS出下列信息:
16:44:01,953 ERROR [URLDeploymentScanner] Incomplete Deplo...
-
JBOSS 5 简单的EJB3.0 热布署没有问题 如里先布署再启动就 NullPointerException
JBOSS 5 简单的EJB3.0 热布署没有问题
但是...
-
Jboss6.0.0 final版能否进行目录布署
请教一下,Jboss6.0.0 final版能否进行目录布署,我用eclipse + jboss进行开发时,每次修改页面或...
-
规则引擎与工作流的区别在于?
小弟想请教一下各位达人,规则引擎与工作流的区别在于什么地方?权限?角色?还是其它什么地方?
还有一些问题...
-
更新Jboss_Root\server\default\MyApp.war下的文件,项目重新启动后,效果和没改前一样。
需求:
1,MyApp.war(文件夹名)项目放到Jbo...
-
jboss发布项目出错
删除项目JBOSS能正常启动
11:42:06,968 ERROR [AbstractKernelController] Error installing to Parse: name...
-
jboss + eclipse 如何设置才能不重启服务就能自动编译jsp
jboss + eclipse 如何设置才能不重启服务就能自动编译jsp
现有我每次...