Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Accessing EJB s remote interface through seperate web application

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to call a session bean through a separate web application. If that session bean does not have references to any other beans it works fine. But when there is a call to another session bean in the first one (using @EJB annotation) it gives the following error:


Deploying application in domain failed; Error loading deployment descriptors for module [TestM] -- Cannot resolve reference Unresolved Ejb-Ref com.cp.interfaces.RCPInterfaceBean/ticketReservationBean@jndi: @null@com.cp.reservation.TicketReservationLocal@SReservationession@null
Deployment errort:
The module has note been deplokyed.


Following is the code i used



If somebody knows the reason for this please help me. Thanks in advance.
 
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandareka,

What application server are you using? Are RCPInterfaceBean and TicketReservationLocal on the same server? If not, you need to use either the DD or @EJB.mappedName to specify which server/ear the referenced EJB resides in (very rare scenario; typically all remote EJBs reside on the same server while clients reside on another). Alternatively you can use JNDI to connect to the remote server and do a look-up.

However, there are still a few application servers that require DDs/mapped name in addition to @EJB to work.

Regards,
Reza
 
Sandareka Fernando
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Reza,

Sorry for incomplete info.I'm using GlassFish V2 with netbeans6.1. Both EJB s reside in the same server. When the Both client .war and ejb.jar is in same EAR then this problem does not occur. It only arise when I use a separate web application as client (in netbeans) to access the EJB module. I tried with @EJB(mappedname="") also. But it didn't work.I'm not much familiar with using JNDI names and EJB references. So I'm not sure about the JNDI name I used in mappedname. Is it the same as the fully qualified path to the bean? or can it be different?

Do I have to add EJB reference to sun-web.xml of web application?

regards,
Sandareka.
 
Reza Rahman
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandareka,

I see, this should be easily solvable.

Try using @Remote instead of @Local. The alternative is to use the Sun DD. GlassFish does resolve cross-app EJBs, but they decided to not allow @EJB to resolve automatically for local EJBs. The rational was that this is not done often enough (which is true for the most part). Here is a reference that might help: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html.

Regards,
Reza
 
Sandareka Fernando
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Reza.. It's working now when i used @Remote instead of @local.

I have another small problem. I used @Local there since it is called inside the EJB module. Is that means I can not use any Local interfaces in my application (at least for internal references)? According to what i have designed, there are several more Local interfaces for EJBs. Is it OK (in terms of design perspective) if i change all those to Remote interfaces?
[ November 09, 2008: Message edited by: Sandareka Fernando ]
 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Reza,

I think it's a good thing that I found this thread, because I stumbled upon the same problem, with the latest version of NetBeans and GlassFish. Could you be so kind of showing me how a Descriptor for a web-app that invokes a Local Ejb would look like in GlassFish ?

I understand it's something like the following: (in web.xml)



But still it does not work. Do you know If I have to include the fully qualified names in these xml descriptors (like dot.com.NonRMILocal) or just the class name?

Then I invoke the Local Interface of my EJB from a web app deployed to the same server like this:



the moduleId of the deployed EJB is StateLessLocalBean

So, when I try to deploy my web-app I get the following Error:

Deploying application in domain failed; Error loading deployment descriptors for module [CallLocalEjbApp] -- Error: Unresolved <ejb-link>: StateLessLocalBean

Do you know What am I doing wrong? Could my descriptor be corrected?

Reza, You have helped me in the past, I hope you could give some insights this time around.
Thanks in advance,

Sincerely,

Jose
 
Reza Rahman
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jose,

I don't have code handy beyond the link posted above since this is rarely done. Please take a close look here: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html. They do have detailed examples, including inter-module local and remote EJB look-ups.

It is probably best to post on the GlassFish forums if you have problems after reading the FAQ and the GlassFish docs.

Regards,
Reza
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Reza,

Ok, I understand, I'm trying to figure it out by myself right now. So far, not so good, But I think I'll follow your advice: If nothing else can be done, I'll try and see what the guys at the Glassfish Forum have to say about that.

Take Care,
And
Good Luck !

Jose
 
Hey cool! They got a blimp! But I have a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic