geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Is there any reason to use @Remote for session bean...
Date Sat, 18 Aug 2007 23:34:37 GMT

On Aug 17, 2007, at 3:51 AM, Tomasz Mazan wrote:

>
> ..if there's no global jndi context and I can't get SBean within my
> standalone java application client?
> In addition - there's no chance to run old EJB2 application with  
> remote
> client on Geronimo 2.0. May I'm wrong - so, please help me to  
> understand
> this "feature".

EJB 1.1, EJB 2.x and EJB 3.0 standalone clients do work.

To connect to the server using the default settings:

             Properties props = new Properties();
             props.put("java.naming.factory.initial",  
"org.apache.openejb.client.RemoteInitialContextFactory");
             props.put("java.naming.provider.url", "foo://127.0.0.1:"  
+ port);
             InitialContext context = new InitialContext(props);

The JNDI Names for each bean are printed in INFO in the  
OpenEJB.startup log cagetory, which you can enable by adding this:

   log4j.logger.OpenEJB.startup=INFO

..to your var/log/server-log4j.properties file

The output should look similar to the following:

INFO - Assembling app: /Users/dblevins/work/openejb3/itests/openejb- 
itests-beans/target/classes
INFO - Jndi(name=client/tests/entity/cmp/BasicCmpHome)
INFO - Jndi(name=client/tests/entity/cmp/ComplexCmpHome)
INFO - Jndi(name=client/tests/entity/cmp/UnknownCmpHome)
INFO - Jndi(name=client/tests/entity/cmp2/BasicCmpHome)
INFO - Jndi(name=client/tests/entity/cmp2/ComplexCmpHome)
INFO - Jndi(name=client/tests/entity/cmp2/UnknownCmpHome)
INFO - Jndi(name=client/tests/entity/cmp/allowed_operations/EntityHome)
INFO - Jndi(name=client/tests/entity/cmp2/allowed_operations/EntityHome)
INFO - Jndi(name=client/tests/entity/cmp/EncBean)
INFO - Jndi(name=client/tests/entity/cmp2/EncBean)
INFO - Jndi(name=client/tests/entity/cmp/ContextLookupCmpBean)
INFO - Jndi(name=client/tests/entity/cmp/RMI-over-IIOP/EJBHome)
INFO - Jndi(name=client/tests/entity/cmp2/RMI-over-IIOP/EJBHome)
INFO - Jndi(name=client/tests/entity/cmr/oneToOne/PersonLocal)
INFO - Jndi(name=client/tests/entity/cmr/oneToOne/LicenseLocal)
INFO - Jndi(name=client/tests/entity/cmr/oneToMany/ArtistLocal)
INFO - Jndi(name=client/tests/entity/cmr/oneToMany/SongLocal)
INFO - Jndi(name=client/tests/entity/cmr/manyToMany/GameLocal)

There is an open issue (GERONIMO-2884) regarding the default jndi  
names you may want to check out if you names like "geronimo- 
deploymentUtil5840.tmpdir/FooBeanBusinessRemote.

Changing the format of the JNDI names is fine.  The only drawback is  
offical javaee 5 application-client.xml style clients will no longer  
be able to look up ejbs (well, not using the java:comp/env snytax  
anyway, they could still look them up as standalone applications  
do).  See the info on this page on how to reset the  
openejb.jndiname.format system variable:

   http://openejb.apache.org/jndi-names.html

The default value is "{deploymentId}/{interfaceClass}"

Hmmm... Looking at the code right now I see that its actually a bit  
tricky to set the "openejb.jndiname.format" property -- normally  
setting it as a system property would do the trick, but I see we're  
not checking to see if it was set before stuffing in the default.

If you want to change the format, let me know and I will show you a  
couple options.

-David




Mime
View raw message