Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8521969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:58:32+00:00 2026-06-11T06:58:32+00:00

I know roughly what this construction does: it creates a SomeType EJB and injects

  • 0

I know roughly what this construction does: it creates a SomeType EJB and injects the object into another EJB.

 @EJB(name="name1")
 SomeType someVariable

Now I have a class which starts like this: (I give all class-level annotations, even though I think only the @EJBs is relevant)

@Remote(SomeClass.class)
@Stateless(name="someName")
@EJBs({@EJB(name="name1",beanInterface=Type1.class),
       @EJB(name="name2",beanInterface=Type2.class)})
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionManagement(TransactionManagementType.CONTAINER)
public class X extends Y{ 
  //code

What do the @EJB s do here? They probably get or create the “name1” … objects from JNDI, but where do they put the result? I don’t see a .lookup call anywhere near, but the codebase is huge so I’m not very sure about this.

Bonus question: I presume the two @Transaction annotations simply repeat defaults?

UPDATE: Multiple persons claimed at this point that @EJBs is a proprietary extension. It is not. It is a core part of java EE5. See the JavaDoc for details.. It is simply a container for the individual @EJB annotations.

I believe everyone who claims these EJB annotations do a lookup. I just want to know what happens with the result of this lookup.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:58:34+00:00Added an answer on June 11, 2026 at 6:58 am

    The @EJB annotation (and @Resource, @WebServiceRef, etc.) serves two purposes:

    1. It declares a reference in the component namespace. For example, @EJB(name="myEJB") creates a reference java:comp/env/myEJB. If you annotate a field and do not specify a name, then it creates a reference java:comp/env/com.example.MyClass/myField.
    2. If the annotation is declared on a field or setter method, then the container performs injection when the component is created.

    How the reference is resolved varies, independent of whether the reference is being resolved for a lookup("java:comp/env/myEJB") or due to injection:

    1. If EE 6+ is used, the lookup attribute requires a JNDI lookup to resolve the target.
    2. Some application servers support mappedName, which is specified to be vendor specific. This is usually implemented by performing a lookup.
    3. Application servers support bindings at deployment time. This is usually implemented by performing a lookup.
    4. If no other binding information is provided and the bean interface (beanInterface or the field type) is only implemented by a single EJB in the application, then the EJB specification requires that it fall back to that.
    5. If no other binding information is provided and #4 cannot work, some application servers will attempt to perform a lookup in the server namespace based on the ref name (for example, java:comp/env/myEJB might cause a lookup of myEJB in the server namespace).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this error, and i roughly know where it is, but do not
I need an insert statement that will do roughly this: INSERT INTO tblContent(postTitle, postBody,
Know this might be rather basic, but I been trying to figure out how
I know that this sort of question has been asked here before, but still
i know this is a stupid question but i d'ont know how to do
I have a large HTML document which has roughly this structure: <div id=a> <!--
Just a question about Azure. Yes, I know roughly about Azure and cloud computing.
I've worked with CakePHP 1.3, but this is my first foray into CakePHP 2.0
I have some PHP code which looks roughly like this require_once 'cache.php'; require_once 'generator.php';
I've been getting this error: The requested admin page does not exist. I've got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.