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

  • Home
  • SEARCH
  • 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 7011755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:10:03+00:00 2026-05-27T22:10:03+00:00

I am using EJB3.1 deployed to JBoss AS 5.1, so I’m using the @EJB

  • 0

I am using EJB3.1 deployed to JBoss AS 5.1, so I’m using the @EJB injection. It works great when called from another EJB. Like this bean:

@Stateless (mappedName = "daos/MyDao")
public class MyDAO implements MyDaoRemote {

@PersistenceContext(unitName = "myEm")
private EntityManager em;

which is injected into this other bean

@Stateless(mappedName = "handler/MyHandler")
public class MyHandler implements MyHandlerRemote {

@EJB(mappedName = "daos/MyDao")
private MyDaoRemote myDao;

However, my application starts from a POJO. I don’t think you can use the @EJB injection outside of a EJB… SO, is it possible to get MyHandler without using a JNDI lookup? This code works:

return (MyHandlerRemote) new InitialContext().lookup("handler/MyHandler");

but I would love to avoid doing this lookup. In Seam and Spring, it seems like the scanning of classes for annotations is easier.

I probably don’t NEED @EJB injection, but I like having the container manage the PersistenceContext for me, and the auto-wiring.

Seems like Weld could help, but I don’t think it will work in JBoss AS 5.1, as could Spring, but it seems like there should be a starting point for EJB without JNDI lookups.

Thanks in advance.

  • 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-05-27T22:10:03+00:00Added an answer on May 27, 2026 at 10:10 pm

    You can use Seam for injecting EJBs in POJOs running under JBoss AS 5.1, without the need for making a JNDI lookup – instead, using Seam’s @In annotation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to specify JNDI name for an EJB3 bean using annotation, but
I'm using JBoss 4.2.3 and I deployed two ears called triad-1.0.ear and reportservices-1.0.ear ,
I have an EJB3 bean deployed as a web service in JBoss 4.2.2. In
is it possible to create something like static object using EJB3 in Jboss. in
I am using JNDI lookups to inject a remote EJB3 session bean inside my
I'm trying to implement stateless session bean ejb3 in jboss5 using netbeans6.8 as a
I am using restEasy(Restful implementation for jboss) ejb3.0, Jboss5.1.1 AS I did restful service
I would like to know how safe is EJB3 to prevent SQL Injection. I've
I'm upgrading an application from an old ejb2 setup to use ejb3's using the
I am using Weblogic 11g, EJB3.0. I am struggling for weeks with this problem.

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.