JBOSS部署EJB3小测试程序的问题
先声明,本人初学ejb3,问的问题白痴,别拍.
补充一点,问题为100分,如果谁帮我解决,追加100分。
因为我担心这个帖子也会无下文,之前有四个人发过同样的问题。
http://topic.csdn.net/u/20080526/02/1DE6F4F8-B084-4D09-A067-C19CE13CFFBC.html
http://topic.csdn.net/u/20080911/19/D5342302-8887-4DE9-8CDA-38501D262400.html
http://topic.csdn.net/u/20081106/10/326AD298-1BA5-44B5-91CD-EDBC79671D5F.html
http://topic.csdn.net/u/20090115/18/D4D3E1E1-E232-4C5F-90C6-EFED53824D62.html
我的目的:
http://blog.sina.com.cn/s/blog_5f5fff010100cmc0.html
这篇帖子里讲述了如何用myeclipse+jboss来配置运行第一个Ejb3的程序,我想完全按照它的步骤做然后做一个测试用例
java编译运行环境正常,jboss版本是4.0.5.GA解压版,myeclipse是6.5
出的错误:
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.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.feiyu.ejb.FirstEjbClient.main(FirstEjbClient.java:12)
主要代码:
=====================>
接口FirstEjb
package com.feiyu.ejb;public interface FirstEjb { public String saySomething(String name);}
package com.feiyu.ejb;import javax.ejb.Remote;import javax.ejb.Stateless;@Stateless@Remotepublic class FirstEjbBean implements FirstEjb { public String saySomething(String name) { return "Hello, " + name; }}
package com.feiyu.ejb;import javax.naming.InitialContext;import javax.naming.NamingException;public class FirstEjbClient { public static void main(String args[]) { try { InitialContext context = new InitialContext(); FirstEjb firstEjb = (FirstEjb) context.lookup("FirstEjbBean/remote"); String s = firstEjb.saySomething("xiesisi"); System.out.println(s); } catch (NamingException e) { e.printStackTrace(); } }}
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactoryjava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfacesjava.naming.provider.url=localhost