openejb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Remote EJB not accessible from TomEE 1.0.0 and TomEE 1.0.1-SNAPSHOT
Date Tue, 21 Aug 2012 17:19:34 GMT
Hi,

Can you share the logs?

- Romain
Le 21 août 2012 18:32, "dablomatique" <info@dabla.be> a écrit :

> Hello,
>
> I'm trying to make my Tomcat 6 + OpenEJB 3.1.4 project (almost identical to
> this setup:
>
> http://dablomatique.wordpress.com/2012/01/31/building-collapsed-ear-through-maven-for-weblogic-tomcat-with-openejb-aka-tomee/
>
> http://dablomatique.wordpress.com/2012/01/31/building-collapsed-ear-through-maven-for-weblogic-tomcat-with-openejb-aka-tomee/
> ) run on TomEE 1.0.1-SNAPSHOT.
>
> Everything works fine after some minor modifications, except the fact that
> I
> cannot invoke my deployed EJB's remotely.
>
> Here is the client code:
>
> @Test
>     public void test() throws Exception
>     {
>         Properties props = new Properties();
>
>
> props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
>         props.put(Context.PROVIDER_URL,"http://127.0.0.1:8081/tomee/ejb");
> // http://127.0.0.1:8081/openejb/ejb
>         Context ctx = new InitialContext(props);
>         System.out.println("ctx: " + ctx);
>         listContext(ctx, "");
>         Object ref = ctx.lookup("PersonEJB");
>         System.out.println("ref: " + ref);
>         PersonEJBRemote remote =
> (PersonEJBRemote)PortableRemoteObject.narrow(ref,PersonEJBRemote.class);
>         System.out.println("remote: " + remote);
>         PersonDetail result = remote.findByUserId("TestUser1");
>         System.out.println(result);
>     }
>
>     // http://denistek.blogspot.be/2008/08/list-jndi-names.html
>     /**
>     * Recursively exhaust the JNDI tree
>     */
>     private static final void listContext(Context ctx, String indent) {
>     try {
>        NamingEnumeration list = ctx.listBindings("");
>        while (list.hasMore()) {
>            Binding item = (Binding) list.next();
>            String className = item.getClassName();
>            String name = item.getName();
>            System.out.println("" + indent + className + " " + name);
>            Object o = item.getObject();
>            if (o instanceof javax.naming.Context) {
>         listContext((Context) o, indent + " ");
>            }
>        }
>     } catch (NamingException ex) {
>        ex.printStackTrace();
>     }
>     }
>
> When I runt this client against my Tomcat 6 + OpenEJB 3.1.4 server, then it
> works and i see following output from JNDI listing:
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running PersonEJBClient
> ctx: javax.naming.InitialContext@74341960
> java.lang.String .
> javax.naming.Context openejb
>  org.apache.openejb.core.ivm.naming.BusinessRemoteReference
> ConfigurationInfoBus
> inessRemote
>  org.apache.openejb.core.ivm.naming.BusinessRemoteReference
> DeployerBusinessRemo
> te
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference AssignmentEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference
> RequestTimerTaskEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference PersonEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference
> RequestProcessorEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference PasswordEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference ResponseEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference SignalEJB
> org.apache.openejb.core.ivm.naming.ObjectReference MEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference RequestEJB
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference RequestMDBSender
> org.apache.openejb.core.ivm.naming.BusinessRemoteReference UserEJB
> org.apache.openejb.core.ivm.naming.IntraVmJndiReference RequestMDB
> ref: proxy=org.apache.openejb.client.StatelessEJBObjectHandler@61542a75
> remote: proxy=org.apache.openejb.client.StatelessEJBObjectHandler@61542a75
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.388 sec
>
> Results :
>
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
>
>
> But when I run the same client against TomEE 1.0.0 or TomEE 1.0.1-SNAPSHOT,
> then I only see those JNDI listings + the remote invocation fails (as the
> remote EJB isn't found):
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running PersonEJBClient
> ctx: javax.naming.InitialContext@74341960
> java.lang.String .
> javax.naming.Context openejb
>  org.apache.openejb.core.ivm.naming.BusinessRemoteReference
> DeployerBusinessRemote
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.275 sec
> <<< FAILURE!
>
> Results :
>
> Tests in error:
>   test(PersonEJBClient)
>
> Of course I change the provider URL according if I use TomEE or Tomcat with
> OpenEJB (see comment in client test code).
>
> Now I'm wondering why TomEE doesn't expose the Remote EJB's through JNDI?
>
> Snippet from EJB code:
>
> @Stateless(name="PersonEJB",mappedName="PersonEJB")
> public class PersonEJB implements PersonEJBLocal, PersonEJBRemote {
> }
>
> @Local
> public interface PersonEJBLocal extends PersonEJBRemote {
> }
>
> @Remote
> public interface PersonEJBRemote {
>         public PersonDetail findByUserId(final String userId) throws
> Exception;
>         public PersonDetail activate(final PersonDetail person) throws
> Exception;
>         public PersonDetail deactivate(final PersonDetail person) throws
> Exception;
>         public PersonDetail changePassword(final PersonDetail person)
> throws
> Exception;
>         public PersonDetail create(final PersonDetail entity) throws
> Exception;
>         public void delete(final Person entity) throws Exception;
>         public PersonDetail update(final PersonDetail entity) throws
> Exception;
> }
>
> If this would work, then everything would be fine on TomEE, which is a
> great
> solution by the way :)
>
> Thanks for the support.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Remote-EJB-not-accessible-from-TomEE-1-0-0-and-TomEE-1-0-1-SNAPSHOT-tp4656954.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message