Solved

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

Posted on 2008-10-07
4
10,714 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 92
Fibonacci challenge 11 109
Permutation and Combination 9 71
Core Java. What output will be and why ? 6 66
Introduction Many of the most common information processing tasks require sorting data sets.  For example, you may want to find the largest or smallest value in a collection.  Or you may want to order the data set in numeric or alphabetical order. …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now