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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:32:38+00:00 2026-05-30T10:32:38+00:00

I am creating a Java EE application using jpa. I am getting the following

  • 0

I am creating a Java EE application using jpa.

I am getting the following error when the code is run on server

    [2/25/12 22:56:31:371 IST] 00000047 SystemOut     O hello
    [2/25/12 22:56:31:375 IST] 00000047 SystemOut     O Error...:(
    [2/25/12 22:56:31:371 IST] 00000047 SystemErr     R java.lang.NullPointerException
    [2/25/12 22:56:31:371 IST] 00000047 SystemErr     R     at plh.service.ejb.UserBean.getUserDetails(UserBean.java:41)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at java.lang.reflect.Method.invoke(Method.java:599)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:65)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:113)
    [2/25/12 22:56:31:372 IST] 00000047 SystemErr     R     at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:374)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
    [2/25/12 22:56:31:373 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:859)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    [2/25/12 22:56:31:374 IST] 00000047 SystemErr     R     at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    [2/25/12 22:56:31:375 IST] 00000047 SystemErr     R     at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    [2/25/12 22:56:31:375 IST] 00000047 SystemErr     R     at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
    [2/25/12 22:56:31:375 IST] 00000047 SystemErr     R     at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
    [2/25/12 22:56:31:375 IST] 00000047 SystemErr     R     at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
    [2/25/12 22:56:31:375 IST] 00000047 SystemErr     R     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

Line no 41 in UserBean.java is :

//within UserBean.java, containing UserBean a stateless EJB

    public class UserBean implements UserBeanInterface {

      /**
      * Default constructor. 
      */
@PersistenceContext
    private EntityManager manager;

public UserBean() {
}
public String authenticate(String name){
    return null;
}
public String changePassword(){
    return null;
}
public String setUserDetails(){
    return null;
}
public String getUserDetails(){
    System.out.println("hello");
    try{
41=>  Query query=manager.createQuery("from User");

        List<User> results = query.getResultList();

        if(results.size()!=0){
            Iterator<User> stIterator=results.iterator();
            while(stIterator.hasNext()){
                User st=stIterator.next();
                System.out.print("User Id:"+st.getUserId());
                System.out.print("Type:"+st.getUserType());
                System.out.print("Detail:"+st.getUserProfile());
            }
        }
        else
        {
            System.out.println("Record not found.");
        }
    }
    catch(Exception e)
    {
        e.printStackTrace();
        System.out.println("Error...:(");
    }
    return "hi";

    }
    }

The User class, User has been generated automatically from the database tables. There is a USER table in the database. Please help on what the possible reason for this error could be.

  • 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-30T10:32:39+00:00Added an answer on May 30, 2026 at 10:32 am

    Your EntityManager manager is no-interface an Enterprise Java Bean injected in your client UserBean. EJBs should be injected in classes whose lifecycle is managed by the application server.

    The client must be either a web component or another enterprise bean. In your case, the client UserBean is a POJO (Plain Old Java Object). See here for further details about how to use EJBs.

    A possible simple solution is to make UserBean a Stateless Session Bean by adding the annotation javax.ejb.Stateless before the class definition. And you should eventually inject UserBean into your ManagedBean with the EJB annotation.

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

Sidebar

Related Questions

I'm creating a web based application using Java Server Faces (JSF). I'm just wondering
I need some advice on creating a syntax highligher for java application using swing.
I'm Creating a facebook application using apache-tomcat. I use the Java Facebook API. It
I'm creating a p2p audio-midi streaming application using Java (unfortunately) and I'm searching for
I am creating a Java Application using netBeans and Swing Gui Builder. I am
I am creating a simple video editing application using Java, JNI, C, and FFmpeg.
In my Java application I need to select a path using JFileChooser. The code
Possible Duplicate: Creating online help in Java Swing application - using pdf user docs
I'm creating a sticky note application using Java. What I want to do: I
I'm creating a dialog as part of Java application. I'm using groovy's swingBuilder and

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.