• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EntityManager not getting injected in EJB, resulting in NullPointerException

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am new to J2EE and have been trying to resolve this issue from almost a week. This is the code in my session bean where in I am getting a NullPointerException. Found out that the entity manager is not getting injected. Can anyone pllllzzzz lemme know how to resolve it.

The code from session bean:

Thanks in advance
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Please UseCodeTags when posting code. Click on the link to understand how to do that.

You have indicated you have a NullPointerException. Please provide the stack trace as that would point to the line where this happens: TellTheDetails.
 
Shilpa Mishra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Sorry am new to the forum, added the code tags.
This is the last 2 lines from the stack trace.
SEVERE: java.lang.NullPointerException
at session.UserFacade.validateUser(UserFacade.java:56)
I am getting the Null Pointer Exception in this line

From the msgs that I have printed out, it shows that em is null.
Could you please lemme know what am I missing

Thanks,

Ranganathan Kaliyur Mannar wrote:Hi,
Please UseCodeTags when posting code. Click on the link to understand how to do that.

You have indicated you have a NullPointerException. Please provide the stack trace as that would point to the line where this happens: TellTheDetails.

 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To which application server are you deploying, and what does the structure of your deployment look like?
 
Shilpa Mishra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Guys,
Solved it.. Had not injected EJB at managed bean level. Thats where the prob was .



Jelle Klap wrote:To which application server are you deploying, and what does the structure of your deployment look like?

 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic