Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Software development teams often use in-memory caches to improve performance. They want to speed up access to, or reduce load on, a backing store (database, file system, etc.) by keeping some or all of the data in memory.   You should implement a …
The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
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.

706 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

19 Experts available now in Live!

Get 1:1 Help Now