• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB3 @Local deployment fails

 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing a weird problem


Above code works fine, if i just replace Remote with Local as below, deployment fails,



Error messages deployed on Weblogic 10.3 Console:

An error occurred during activation of changes, please see the log for details.
Exception preparing module: EJBModule(FirstEJB-server.jar) Unable to deploy EJB: FirstEJB from FirstEJB-server.jar: ***** ASSERTION FAILED *****
com.ejb3.ravi.server.FirstEJB_s4ytgm_FirstEJBInterfaceImpl cannot be cast to weblogic.ejb.container.internal.StatelessLocalObject



could you please suggest what's wrong in my code.
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if you try to remove the mappedName attribute inside the Stateless annotation?
 
Garlapati Ravi
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it works fine if i remove mappedName attribute, but how can i look up local ejb if there is no name, i can't find any name for my local EJB in JNDI tree
for Remote EJB, it is showing something related to my EJB name, but nothing for local EJB ? any idea why and how can i lookup local ejbs ?
 
Garlapati Ravi
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's an immature question, lately realised, local object is injected by container if we use @EJB, thanks for your time.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using Remote interface then use the attribute mappedName="something" with the @Stateless annotation and then for invocation, use the attribute mappedName="something" with @EJB annotation.

On the other hand, if you are using the Local interface then use the attribute name="something" with the @Stateless annotation and then for invocation, use the attribute beanName="something" with @EJB annotation

To summarize:
For Remote:
@Stateless(mappedName="ejb/bean") ...
@EJB(mappedName="ejb/bean") ...

For Local:
@Stateless(name="bean") ...
@EJB(beanName="bean")....

Hope that clears things up.
 
Garlapati Ravi
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks very much for clarification.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic