JBoss IDE 1.6 调试EJB3.0失败的问题。

xiao7cn xiao7cn 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
新建了一个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比较好用的,郁闷死了。
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
xiao7cn
Java EE 67,535 成员 225,843 内容