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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:19:36+00:00 2026-05-28T04:19:36+00:00

Start a new web application using NetBeans 7 on GlassFish 3.1 In index.xhtml body

  • 0
  1. Start a new web application using NetBeans 7 on GlassFish 3.1
  2. In index.xhtml body add an h:outputText tag with value="#{myBean.message}"
  3. Create a SessionScoped ManagedBean MyBean with a String property called message; create getter and setter; make it implement Serializable
  4. Create a Stateless SessionBean and inject it into MyBean using @EJB annotation
  5. From this point on, whenever you change the Java code and save the project, you will get plenty of errors (NPE, IOError, EJB errors) during undeployment. The deployment is fine, and the application runs well. But I would like to avoid the exceptions during undeployment.

Is this normal? Or am I doing something wrong?

Here my code:

Index.xhtml (body part)

    <h:body>
        <h:outputText value="#{myBean.message}"></h:outputText>
    </h:body>

MyBean.Java

@ManagedBean
@SessionScoped
public class MyBean implements Serializable {

    @EJB NewSessionBean nsb;

    public String getMessage() {
        return " " + nsb.toString();
    }

    public MyBean() {
    }
}

NewSessionBean.java

@Stateless
@LocalBean
public class NewSessionBean {
}

In order to get the errors, just load the web page, add a space in the message string, save the java file (having the auto deployment toggled, otherwise redeploy manually).

Some exceptions

EJB5014: Exception resolving object 
java.lang.NullPointerException at    
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate$SerializableLocalObjectDelegate.createObject(EJBLocalObjectInvocationHandlerDelegate.java:158)

IOException while loading persisted sessions: java.io.IOException
java.io.IOException
at com.sun.ejb.base.io.EJBObjectInputStream.resolveObject(EJBObjectInputStream.java:114)

UPDATE

If I replace the ManagedBean annotations with Named, therefore using CDI, and consequently replace javax.faces.bean.SessionScoped with javax.enterprise.context.SessionScoped, I have exactly the same problem when undeploying, and afterwords the application runs smoothly.

The thrown exception is exactly the same as before.

  • 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-28T04:19:37+00:00Added an answer on May 28, 2026 at 4:19 am

    Your server tries to serialize and save http session. Your session beans should me serializable to make session persistence available. Ir looks like this reference : NewSessionBean nsb; is not serializable. You can make it transient and you should get rid of error. But after sesson restore nsb will be null. I’m not sure how it’s handled in EJB but this reference must be reinjected somehow.

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

Sidebar

Related Questions

I'm trying to start a new ASP.NET Web Application Project using Visual Studio 2008.
Every time I start working on a new J2EE web application, I need to
I'm playing around with building a new web application using DB4O - piles of
I am working on building a web-application using Django. Since I'm new to working
I am using the IIS Powershell snapin to configure a new web application from
I'm developing a web application using ASP.NET MVC (I'm new to the framework and
In vs2010, I start a new project > asp.net web application and get presented
i'm new to asp.net.. i'm developing a web application using asp.net a jquery. i
I'll start a new PHP/MySQL web site / Facebook application for Videos - Pictures
I have created application using: Default Web Site >> Right Click >> Add Application

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.