Solved

how to configure a certain JNDI-Name with EJB3 Annotations (the JEE way)

Posted on 2008-10-07
4
10,749 Views
Last Modified: 2013-11-24
If II annotate my session bean like that:

@Stateless ( name="UserFacadeBean", mappedName="UserFacadeRemote/remote")
public class UserFacadeBean implements UserFacadeLocal, UserFacadeRemote {
}

and deploy it in Webglogic 10, i get access to the remote interface with:

JNDI_NAME = "UserFacadeRemote/remote#" + UserFacadeRemote.class.getName();
userFacade = (UserFacadeRemote) new InitialContext().lookup(JNDI_NAME);

that works fine, but is there an alternative (beyond unsing ejb.jar.xml) to define
a jndi name with annotations, without the full qualified classname of the remote interface?

so I want to have something like:
 new InitialContext().lookup("mySimpleName");



thanks
manolis





 

0
Comment
Question by:mafentakis
  • 3
4 Comments
 
LVL 4

Expert Comment

by:Mr_It
ID: 22719028
In JBoss you can specify this in the vendor specific jboss.xml deployment descriptor or by using annotations in the bean class:
@RemoteBinding(jndiBinding="mySimpleName") for remote EJB interfaces or
@LocalBinding(jndiBinding="mySimpleName") for local EJB interfaces

I don't know if there is an annotations counterpart in WebLogic, but I'm sure the JNDI name for an EJB can be specified in the weblogic-ejb-jar.xml deployment descriptor as well. I guess you have to declare the bean in there and probably use the 'jndi-name' or 'local-jndi-name' element.
0
 

Author Comment

by:mafentakis
ID: 22739245
@Mr_It:

Thanks for your answer, but as i wrote i want the "J2EE Way" and not the custom Solution.


regards
manolis
0
 
LVL 4

Expert Comment

by:Mr_It
ID: 22740470
Yes I should better read titles ;-)
0
 
LVL 4

Accepted Solution

by:
Mr_It earned 50 total points
ID: 22740911
The mappedName element is not required to be supported by all implementations. Any use of this element is non-portable. The weblogic implementation happens to implement this using the fully qualified classname.

I don't think there is a standard way to do this...

Regards


0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows 10 and JDK 7 7u85 4 53
How to write an English digest paper 6 72
mysql jsp example issue 32 48
Select statement in @Query (JPA Repository) - SpringMVC 2 13
What is Waterfall Model? Waterfall model is the classic Software Development Life Cycle method practiced in software development process. As the name "waterfall" describes, this development is flowing downwards steadily like waterfall, i.e., procee…
Introduction This question got me thinking... (http://www.experts-exchange.com/questions/28707487/GLOBALS.html) Why shouldn't we use Globals? This is a simple question without a simple answer.  How do you explain these concepts to a programmer w…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question