Home Ask Login Register

Developers Planet

Your answer is one click away!

Orlando February 2016

Problems with Dependency Injection

I'm new in Java EE and I have a problem which I have not yet resolved.

I'm working on a Java EE project, which has an EJB project, a project that contains a Web service and another project with a visual interface (Web application).

The problem is when I try to make a dependency injection from one of my web service interfaces to the user interface (web application project). First I would like to clarify that all injections by tags never worked and tried the method: InitialContext.doLookup (name); and this worked great.

I was able to get the implementation of my interface but when I make a call to one of its methods that returns the object, the returned object comes with all its fields empty. And when I test the service from a client created by me this returns the object with all values. I checked beforehand that all classes and objects were implementing the Serializable interface.

My question is: Why do the methods of the service implementation, which I inject in my web application project, return empty objects?

I am using:

  1. Eclipse

  2. Glassfish Server

  3. JAXB(to Web Services)


Orlando February 2016

I apologize for taking so to respond, I would like to tell you that I could solve the problem and would like to make a comment about the problem I had.

I'm working on a project JavaEE as I said. This project contains an EJB module, an EAR project, a web service and a dynamic web project. First I would like to clarify that projects were made by someone else and I'm continuing the work. I may discover that the problem was that they had the persistence within the EJB project, which is not bad but when generating entities rather than keeping them within the project that contains the persistence, the developer moved them to another project called "Utils" and it included in the EAR as another application module. Everything seemed to work well with instances of entities but apparently the project that contains the persistence (EJB) did not have the physical entities in their packages and therefore was not able to build and fill these data when a request was made by injection.

I want to thank you for your concern and quick response.


Post Status

Asked in February 2016
Viewed 1,023 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life