论坛首页 入门技术论坛

jboss-4.2.0GA+ejb3问题

浏览 2206 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-06-05  
run -c default
控制台看到发布EJB成功
09:44:04,046 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jbo
ss.ejb3.stateless.StatelessContainer
09:44:04,078 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=count
er.jar,name=CounterBean,service=EJB3 with dependencies:
09:44:05,406 INFO  [EJBContainer] STARTED EJB: com.jboss.ejb3.CounterBean ejbNam
e: CounterBean

09:44:05,687 INFO  [EJB3Deployer] Deployed: file:/E:/jboss-4.2.0.GA/server/all/d
eploy/counter.jar
客户端调用代码


import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import com.jboss.ejb3.RemoteCounter;

public class Client {

public Client() {
super();
// TODO Auto-generated constructor stub
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Context ctx = null;
try
{

ctx = new InitialContext();
RemoteCounter counter = (RemoteCounter) ctx.lookup("counter/remote");
System.out.println(counter);
counter.add(10);
System.out.println("当前的number:" + counter.getNumber());

}
catch (NamingException e)
{
e.printStackTrace();
}
}

}

运行客户端产生如下异常,其中第一句打印远程对象实例,好象成功
jboss.j2ee:jar=counter.jar,name=CounterBean,service=EJB3
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy0.add(Unknown Source)
at Client.main(Client.java:28)
Caused by: java.lang.Exception: Can not make remoting client invocation due to not being connected to server.
at org.jboss.remoting.Client.invoke(Client.java:1555)
at org.jboss.remoting.Client.invoke(Client.java:530)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
... 2 more



各位请帮忙,这里先谢了!
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics