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 7410877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:18:01+00:00 2026-05-29T06:18:01+00:00

I am trying to convert a Guice inject project to a Java EE project,

  • 0

I am trying to convert a Guice inject project to a Java EE project, that is to run on glassfish.

I have a lib project, that defines an interface, Hello, annotated with @Remote. Then I have an impl project that has a bean, HelloBean, annotated with @Stateless, and a single constructor with parameters and @Inject.

Then I have a was project that depends on the lib and it’s interface to create a webservice, HelloService, annotated with @WebService, and Hello as a member annotated with @EJB.

This does not seem to work. Since beans must have a no-args constructor, I created HelloBean as a bean, and HelloImpl as a Pojo with a single @Inject constructor, with arguments. I have tried then injecting Hello and HelloImpl into HelloBean with both @Inject, @Resource and @EJB. None seem to work.

If I @Inject Hello or HelloImpl into HelloBean, I get a NPE.
If I @Resource Hello or HelloImpl, I get an Lookup failed for delegate.
If I @EJB HelloImpl, same error. @EJB Hello and I get stackoverflows (understandably).

I do want to use constructor injection, as I feel it’s a more correct way of creating classes (they are always valid once constructed). But I don’t see how it’s possible to combine CDI and EJBs.

How can I get a Pojo with an @Inject constructor into a bean? Or is my plan fundamentally flawed?

  • 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-29T06:18:02+00:00Added an answer on May 29, 2026 at 6:18 am

    A better way is to define a initialize method annotated with @Inject. Any parameters will be injection points and should be supplied via CDI. You can also do this with constructors. Make sure you have WEB-INF/beans.xml as well.

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

Sidebar

Related Questions

i´m using subsonic 3 trying convert a SQL2008 project to MySQL. when the projects
Trying to convert this c code into MIPS and run it in SPIM. int
I'm trying to convert some code that worked great in VB, but I can't
I am trying to convert an ASP.NET website into a web application project. The
I am trying to convert an int into three bytes representing that int (big
I am trying to convert a Java function into equivalent Groovy code, but I
I am trying to convert some actions within a controller to run asynchronously in
I have an XML file and I'm trying convert it into a (table( HTML
I´m trying to convert that: <% var obj = Model.Div; %> <script type=text/javascript> var
I have a code in vb, and I'm trying convert it to c#. _nextContactDate.ToShortDateString

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.