Return-Path: X-Original-To: apmail-openejb-users-archive@www.apache.org Delivered-To: apmail-openejb-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B04D9DCA3 for ; Tue, 21 Aug 2012 16:32:23 +0000 (UTC) Received: (qmail 76401 invoked by uid 500); 21 Aug 2012 16:32:23 -0000 Delivered-To: apmail-openejb-users-archive@openejb.apache.org Received: (qmail 76384 invoked by uid 500); 21 Aug 2012 16:32:23 -0000 Mailing-List: contact users-help@openejb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openejb.apache.org Delivered-To: mailing list users@openejb.apache.org Delivered-To: moderator for users@openejb.apache.org Received: (qmail 91084 invoked by uid 99); 21 Aug 2012 15:34:00 -0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=NORMAL_HTTP_TO_IP,SPF_NEUTRAL,URI_HEX,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Date: Tue, 21 Aug 2012 08:33:34 -0700 (PDT) From: dablomatique To: users@openejb.apache.org Message-ID: <1345563214241-4656954.post@n4.nabble.com> Subject: Remote EJB not accessible from TomEE 1.0.0 and TomEE 1.0.1-SNAPSHOT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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.