当前位置: 代码迷 >> JBoss >> 异常: javax.naming.NameNotFoundException: StatfulEjbBean not bound
  详细解决方案

异常: javax.naming.NameNotFoundException: StatfulEjbBean not bound

热度:11032   发布时间:2013-02-26 00:00:00.0
错误: javax.naming.NameNotFoundException: StatfulEjbBean not bound
刚学Jboos用的是Myeclipse,刚写第一个程序就不会了。运行Jboos客户端是出现此异常,请问是我程序错了还是Jboss安的不对啊?
jndi.properties
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost
客户端程序:
package com.qqq.ejb;

import javax.naming.InitialContext;

public class FirstEjbClient {
public static void main(String args[]) throws Exception {
InitialContext context = new InitialContext();
FirstEjb firstEjb = (FirstEjb) context.lookup("FirstEjbBean/remote");
String s = firstEjb.saySome("张三");
System.out.println(s);

}
}
服务端程序:
package com.qqq.ejb;

public interface FirstEjb {
public String sySome(String name);
}

package com.qqq.ejb;

import javax.ejb.Remote;
import javax.ejb.Stateless;

@Stateless
@Remote
public class FirstEjbBean implements FirstEjb {

public String sySome(String name) {

return "你好"+name;
}

}

------解决方案--------------------------------------------------------
jboss是哪个版本的,有没有试试4.2
------解决方案--------------------------------------------------------
你的EJB类少了一个bond的标签
  相关解决方案