Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB3 @Local deployment fails  RSS feed

 
Garlapati Ravi
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • 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.
 
Ronwaldo Cruz
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Sib Pete
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
thanks very much for clarification.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!