problem connecting to EJB3
alexsbe Sep 3, 2007 6:02 AMHi ,
I am a newbie in EJB3, and I tried for days to deploy an EJB
I have jboss 4.0.5 installed on red hat. where I want to deploy my EJB.
The start logs of jboss for the deployement are ok
ex I have : default remote binding has jndiName of LoginEAR/LoginEJB3Bean/remote
SO i think that evrything is ok...
Here is the code for the client side :
public static void main(String[] args) { try { Properties properties = new Properties(); properties.put(Context.PROVIDER_URL, "adresse_IP:1099"); properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); properties.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces"); return new InitialContext(properties); Context context = getContext(); String jndiName = "LoginEAR/LoginEJB3Bean/remote"; LoginEJB3 loginEJB3 = (LoginEJB3)context.lookup(jndiName); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
Here is the error log I had :
2007-09-03 11:26:13 DEBUG [SecurityAssociation/:143] Using ThreadLocal: false 2007-09-03 11:26:13 DEBUG [Client/:514] invoke called, but our invoker is disconnected, discarding and fetching another fresh invoker for: InvokerLocator [socket://127.0.0.1:3873/] 2007-09-03 11:26:13 DEBUG [SocketClientInvoker/:275] connect called for: org.jboss.remoting.transport.socket.SocketClientInvoker@b66cc Exception in thread "main" org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection. at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:267) at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143) at org.jboss.remoting.Client.invoke(Client.java:525) at org.jboss.remoting.Client.invoke(Client.java:488) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102) at $Proxy0.login(Unknown Source)
I added this command on the launch jboss start
-Djava.rmi.server.hostname=adresseIPserver"
I have read that it can solve this problem
But now I have this error
Exception in thread "main" org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection. at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:267) at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143) at org.jboss.remoting.Client.invoke(Client.java:525) at org.jboss.remoting.Client.invoke(Client.java:488) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102) at $Proxy0.login(Unknown Source)
I really don't know what I did wrong. this application work fine with the same server installed on windows.