刚学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的标签