• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

EJB 2.1. entity bean : How to use remote interface JNDI lookup object ?

 
Ranch Hand
Posts: 48
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jboss 7.1.1
EJB 2.1


Hi,

Though it may seem strange but in one of the application i work on still uses EJB 2.1 entity beans.

While looking at the deployment log, seems like each Entity bean is registered using both remote-home and remote interfaces.

java:app/EJBApp/Entity!com.abc.remote.Remote
java:app/EJBApp/Entity!com.abc.remote.RemoteHome


Using the remote-home's JNDI lookup i was able to get the EJBObject proxy and subsequently create and use the entity.

But what about the remote interface JNDI lookup ? Reason i am asking is that one needs to create an entity before use it. That said, how to use the object that i get from remote interface JNDI lookup ? Note that the class of the returned object says its "com.sun.proxy.$Proxy13" type.

The JNDI location i am using "java:app/EJBApp/Entity!com.abc.remote.Remote"

- Rakesh

 
Bartender
Posts: 1381
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I remember (by the way, only in theory, because I've never used EJB 2.1 entity myself) you should use HomeRemote to create or get an instance of your entity,
and then using accessor methods to set and get properties. I don't rember EJB 2.1 entity to have a remote interface.

Log trace you posted seems to indicate that your appserver is actually using *new* EJB 3.x portable naming convention. I think that appservers that support both 2.1 and 3.1 EJBs internally treat all EJBs as if they were EJB 3.x (I saw something similar in a project of mine where I have both 3.x and 2.x session beans: the actual JNDI name is in 3.x format). I wonder if java:app/EJBApp/Entity!com.abc.remote.Remote and java:app/EJBApp/Entity!com.abc.remote.RemoteHome are indeed the very same mapping.

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rakesh,

I have a similar problem. Can you please tell me first how were you able to look up with java:app? I am not able to look up using this. I have the ejb jar under the application EAR.

I was able to lookup in the below manner. However, moving ahead it gets stuck in the EJB local receiver error and I am stuck at this point.

You will get a proxy object similar to what you got before. Please suggest how did you get to access the home objects after using java:app?

context.lookup("ejb:/<package>//XXBean!<package>.XXLocalHome");
(com.sun.proxy.$Proxy15) Proxy for remote EJB StatelessEJBLocator
 
Anand Bansal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I finally found the solution.

Entity beans 2.X are not supported in the lightweight configuration of JBoss AS 7 onwards. We have to use the use the standalone-full configuration or standalone-full-ha configuration for entity beans deployment in AS7.
Start the server using the standalone full.xml and and you'll see the entity beans being bound to JNDI:
17:27:31,762 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named XXXBean in deployment unit subdeployment "XXXEJB.jar" of deployment "XXXEAR.ear" are as follows:

java:global/XXXEAR/XXXXEJB/<ejb bean name>!<package name><ejb local home>
java:app/XXXXEJB/<ejb bean name>!<package name><ejb local home>
java:module/<ejb bean name>!<package name><ejb local home>
java:global/XXXEAR/XXXXEJB/<ejb beanname>!<package name><ejb local>
java:app/XXXXEJB/<ejb bena name>!<package name><ejb local>
java:module/<ejb bean name>!<package name><ejb local>

The JNDI should be looked up by the java:global binding :
java:global/XXXEAR/XXXXEJB/<ejb beanname>!<package name><ejb local home>.
It works good..!!
 
Sheriff
Posts: 22817
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for sharing your solution
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic