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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:10:26+00:00 2026-06-10T18:10:26+00:00

My application server is WebSphere Application Server V8. I have a session scoped managed

  • 0

My application server is WebSphere Application Server V8. I have a session scoped managed bean in which I have injected EJB (EJB 3.0) using @EJB annotation. EJB is stateless.

   @ManagedBean
   @SessionScoped
    public class MyBean extends BaseBackingBean implements
    Serializable {

@EJB
private IDetails custInfo;

I was analyzing the session data and noticed NotSerializableException

java.io.NotSerializableException: com.ejb.EJSLocal0SLDetailsImpl_081f812d at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1537) at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1502) at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1420) at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) at 

Now I tried to mark the EJB as transient and it works fine without throwing NotSerializableException exception.

@EJB
private transient IDetails custInfo;

Is this correct implementation or what can be alternate solution?

I have referred Should EJBs be instance variables and marked as transient in JSF Managed Beans? where it is mentioned that marking EJB as transient is not required; then what can be wrong?

  • 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-06-10T18:10:28+00:00Added an answer on June 10, 2026 at 6:10 pm

    Implemented a POC code on WAS V8 with both Local and Remote interfaces, noted the following:

    a. With Local interface (EJB does not implement Serializable)

    // Initializing the EJB in the servlet
    SerializableTestEJBLocal localSrvlt=new SerializableTestEJB(); 
    //Try to serialize
    FileOutputStream objFOS = new FileOutputStream("D:\\MYTEST\\testsrv.txt");
    ObjectOutputStream objOpStr = new ObjectOutputStream(objFOS);
    objOpStr.writeObject(localSrvlt);
    

    This resulted in java.io.NotSerializableException: com.ibm.test.SerializableTestEJB
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:..

    To prevent this, the EJB had to explicitly implement Serializable.

    b. With Remote Interface (EJB does not implement serializable)

    //Obtain Remote Stub. 
    SerializableTestEJBRemote seremoteSrvlt=(SerializableTestEJBRemote)PortableRemoteObject.narrow(homeObject, SerializableTestEJBRemote.class);
    
    //Try serialization
    FileOutputStream objFOS = new FileOutputStream("D:\\MYTEST\\testsrv.txt");
    ObjectOutputStream objOpStr = new ObjectOutputStream(objFOS); 
    objOpStr.writeObject(seremoteSrvlt);
    

    The serialization was successfully.

    Conclusion:

    The inherent mechanism of remote interface is to obtain a stub or proxy to allow for client-server communication occurs using this proxy pattern. This involves marshalling and unmarshalling of data and hence the proxy-stub is Serializable by default and hence the EJB does not need to implement the Serializable interface.

    But the local interfaces does not involve remote look ups and stub handlers. EJB initializes is similar to initializing a locally available class, hence serialization is not available by default. In this scenario, either the EJB will need to implement serializable interface or the object will need to be declared transient to skip serialization.

    I am declaring the variable as transient. This might be WebSphere specific solution

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

Sidebar

Related Questions

We have a WebSphere Application Server 6.1. Session management is configured with replication and
I have web application deployed on websphere application server 7.0. User logins using /j_security_check.
I am using Websphere application server 7.0.0.0.9 with ;OpenJPA 1.2.3-SNAPSHOT'. I have Set property
I have an application running on Websphere Application Server 6.0 and it crashes nearly
I have a J2EE application running on an IBM Websphere Application Server on a
I am using IBM Websphere Application Server v6 and Java 1.4 and am trying
I have a Websphere Portal application containing several portlets for which I'm currently working
I have two separate installs of WebSphere. (Actually one is WebSphere Application Server V6.1
We have an application deployed in Websphere application server 7. Its deployed and functioning
I have a strange problem. I have configured our Websphere Application Server to run

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.