刚学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 ejb01.client;import javax.naming.InitialContext;import cn.cnmis.ejb.FirstEJB;public class TestEJB {
public static void main(String[] args) throws Exception {
InitialContext context = new InitialContext();
FirstEJB fe = (FirstEJB)context.lookup("FirstEJBBean/remote");
System.out.println("--------"+fe.saySomething("你好,"));
}}
服务端程序:
package cn.cnmis.ejb;(接口)public interface FirstEJB {
public String saySomething(String word);
}package cn.cnmis.ejb;(实现)import javax.ejb.Remote;
import javax.ejb.Stateless;
@Stateless
@Remote
public class FirstEJBBean implements FirstEJB { public String saySomething(String word) {
return "你好," + word;
}
}
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 ejb01.client;import javax.naming.InitialContext;import cn.cnmis.ejb.FirstEJB;public class TestEJB {
public static void main(String[] args) throws Exception {
InitialContext context = new InitialContext();
FirstEJB fe = (FirstEJB)context.lookup("FirstEJBBean/remote");
System.out.println("--------"+fe.saySomething("你好,"));
}}
服务端程序:
package cn.cnmis.ejb;(接口)public interface FirstEJB {
public String saySomething(String word);
}package cn.cnmis.ejb;(实现)import javax.ejb.Remote;
import javax.ejb.Stateless;
@Stateless
@Remote
public class FirstEJBBean implements FirstEJB { public String saySomething(String word) {
return "你好," + word;
}
}
解决方案 »
- 怎么导出jar包,项目中有外部引用的jar包
- JasperCompileManager.compileReport(fis); 就报错了,不知原因。
- 如何给项目加入hibernate功能?
- 解释代码,return list(mapping, form, request, response);是返回什么?list吗?还是没有返回?
- 求助~~~
- struts2的问题
- 点击超链接 怎样获得该页面文本框的值作为参数跳转到另外一个页面
- 在ireport中页码显示的问题
- 50分求助(关于邮件入库)在线等~~急!!
- 新人小问题。调用webservice报错了。跪求解决方法 就80分了全送了
- weblogic报错,请大虾帮忙解决Exception in thread "AWT-EventQueue-0" java.lang
- 后通知怎么实现
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost\:1099
java.naming.factory.url.pkgs=org.jboss.naming
Exception in thread "main" javax.naming.NameNotFoundException: FirstEJBBean not bound
--- Packages waiting for a deployer ---
org.jboss.deployment.DeploymentInfo@7912d789 { url=file:/D:/java-tools/jboss-4.2.2.GA/server/default/deploy/testejb1.0 }
deployer: null
status: null
state: INIT_WAITING_DEPLOYER
watch: file:/D:/java-tools/jboss-4.2.2.GA/server/default/deploy/testejb1.0
altDD: null
lastDeployed: 1278508211638
lastModified: 1278508211633
mbeans:--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@7912d789 { url=file:/D:/java-tools/jboss-4.2.2.GA/server/default/deploy/testejb1.0 }
deployer: null
status: null
state: INIT_WAITING_DEPLOYER
watch: file:/D:/java-tools/jboss-4.2.2.GA/server/default/deploy/testejb1.0
altDD: null
lastDeployed: 1278508211638
lastModified: 1278508211633
mbeans:
13:10:11,848 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
13:10:11,893 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
13:10:11,918 INFO [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 30s:592ms