JBoss IDE 1.6 调试EJB3.0失败的问题。
新建了一个EJB 3.0 Project工程,开发了一个HelloBean:
-----Hello.java-----
public interface Hello {
public String hello();
}
-----HelloBean.java---------
import javax.ejb.Remote;
import javax.ejb.Stateless;
/**
*
* @author xiaq
*/
@Stateless
@Remote(Hello.class)
public class HelloBean implements Hello {
public String hello(){
System.out.println("hello()");
return "Hello,World!";
}
}
-----------这是一个测试类:HelloClient.java----------------
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.*;
/**
*
* @author xiaq
*/
public class HelloClient {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1099");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(props);
Hello hello = (Hello) ctx.lookup("com.xiaoqi.Hello");
System.out.println(hello.hello());
}
}
-----------------------------------------------
在IDE里启动了JBoss,但调试这个测试类时,报错:
Exception in thread "main" javax.naming.NameNotFoundException: com.xiaoqi.Hello 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:296)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
... ...
... ...
这到底是怎么回事啊?到现在没发现一个IDE比较好用的,郁闷死了。