9 Replies Latest reply: Dec 4, 2007 1:34 PM by gavin cai RSS

call a remote EJB

Roberto Perencio Newbie

hi everybody
i have a problem trying to lookup an EJB from a standalone client, using the queue example of JBoss.
I do this:

ic = new InitialContext();
fe = (Interface)ic.lookup("/JndiName");


in jndi.properties i set the server url properly in this way:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://hostname:1099

I get this excpetion:
 [java] java.lang.reflect.UndeclaredThrowableException
 [java] at $Proxy0.getUtenteByID(Unknown Source)
 [java] at org.jboss.example.jms.queue.QueueExample.example(QueueExample
.java:73)
 [java] at org.jboss.example.jms.common.ExampleSupport.run(ExampleSuppor
t.java:58)
 [java] at org.jboss.example.jms.queue.QueueExample.main(QueueExample.ja
va:115)
 [java] Caused by: java.lang.Exception: Can not make remoting client invocat
ion due to not being connected to server.
 [java] at org.jboss.remoting.Client.invoke(Client.java:611)
 [java] at org.jboss.remoting.Client.invoke(Client.java:599)
 [java] at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(Inv
okeRemoteInterceptor.java:55)
 [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv
ocation.java:101)
 [java] at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(Cl
ientTxPropagationInterceptor.java:61)
 [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv
ocation.java:101)
 [java] at org.jboss.aspects.security.SecurityClientInterceptor.invoke(S
ecurityClientInterceptor.java:55)
 [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv
ocation.java:101)
 [java] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInte
rceptor.java:77)
 [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv
ocation.java:101)
 [java] at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(Stateles
sRemoteProxy.java:102)


Any suggestion?

  • 1. Re: call a remote EJB
    Ron Sigal Master

    Hi Bob,

    I'm not sure what I'm looking at here. The JBossMessaging Queue example itself doesn't have anything to do with EJB's - it's a pure jms example. So maybe you adapted it to do something other than produce and consume a message? If so, can you give some more information?

    Does the unmodified Queue example run for you?

  • 2. Re: call a remote EJB
    Perry Rhodan Newbie

    Hello,

    i have exactly the same problem in my standalone java-client. Same exception, when i try to call a method of a remote-ejb.

    Error occurrs only since and with jboss 4.20CR1 "official released" Version. Before we used a svn-checkout of 4.20 from around November 06, and this version didn't make this problem.

    using following initial-context settings:

    public static Context getInitialContext()
     throws javax.naming.NamingException {
     Properties env = new Properties();
     env.put(Context.INITIAL_CONTEXT_FACTORY,
     "org.jnp.interfaces.NamingContextFactory");
     env
     .put(Context.URL_PKG_PREFIXES,
     "org.jboss.naming:org.jnp.interfaces");
     env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
     env.put(Context.SECURITY_PRINCIPAL, "admin");
     env.put(Context.SECURITY_CREDENTIALS, "admin");
     env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
     "org.jboss.security.jndi.JndiLoginInitialContextFactory");
    
     return new InitialContext(env);
    
     }


    Ejb-reference lookup seems to be ok, but when i try to call a concrete method of the ejb-reference, jboss throws error above.

    Any idea ?

  • 3. Re: call a remote EJB
    Perry Rhodan Newbie

    It seems for me like a problem with the DEFAULT the classpath and/or included jars, which ECLIPSE 3.2 per default sets for the test-client.

    If i manually add all necessary jars of jboss to my test client project, then programm will run ok. But if i let eclipse determine the classpath (via Button "default"), the above error will thrown.

    Remember: This misbehaivor only occurs with jboss 4.20CR1 release of march 07, NOT with svn-checkout of november 06.

  • 4. Re: call a remote EJB
    cai li Newbie

    I met with this problem while using JBossAOP 1.3 Libraries provided by JBossIDE-1.5-ALL. Removing the libraies and add those jars in ${jboss.home}/client, it works. Not sure which jar causes this problem, maybe jboss-aspect-library-jdk50.jar

  • 5. Re: call a remote EJB
    Ron Sigal Master

    The exception


    java.lang.Exception: Can not make remoting client invocation due to not being connected to server


    is thrown when org.jboss.remoting.Client.invoke() is called before Client.connect() is called. This restriction exists in Remoting versions 2.0.0 and above, but not before. The current version of org.jboss.aspects.remoting.InvokeRemoteInterceptor, which comes with JBossAS 4.2, calls Client.connect(), but the version that comes with JBossAS 4.0.5 does not.

    InvokeRemoteInterceptor is found in jboss-4.2.0.GA/server/default/deploy/jboss-aop-jdk50.deployer/jboss-aspect-library-jdk50.jar and jboss-4.2.0.GA/client/jboss-aspect-jdk50-client.jar. Make sure you're using the correct versions of these jars.

    -Ron

  • 6. Re: call a remote EJB
    Perry Rhodan Newbie

    It seems, only version 1.3 of jboss-aspect-library-jdk50.jar comes bundled with actual jboss-ide 2.0.0Beta2. See eclipse-plugin org.jboss.ide.jdt.aop.core_1.2.0.Beta2 in ECLIPS_HOME/plugins-folder ...

  • 7. Re: call a remote EJB
    Ron Sigal Master

    I've posted a note on the jboss-ide forum,

    http://www.jboss.com/index.html?module=bb&op=viewtopic&t=109025&start=-10,

    about using a newer version of jboss-aspect-library-jdk50.jar in their next release.

    -Ron

  • 8. Re: call a remote EJB
    Xie Deping Newbie

    copy \jboss-4.2.0.GA\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aspect-library-jdk50.jar
    to
    \JBossIDE\eclipse\plugins\org.jboss.ide.eclipse.jdt.aop.core_1.2.0.Beta2\

    then ,it's OK.

  • 9. Re: call a remote EJB
    gavin cai Newbie

    up.
    i meet the same problem .my env:JBOSS 2.0 BETA2 +JBOSS4.2.2
    but in Jboss4.2.2GA ok.