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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:31:38+00:00 2026-05-31T21:31:38+00:00

In a JSF 2 application, which is developed on tomcat, I have the following

  • 0

In a JSF 2 application, which is developed on tomcat, I have the following SessionScoped managed bean:

@ManagedBean(name = "loginBean")
@SessionScoped
public class LoginBean implements Serializable {

    private static final long serialVersionUID = 1L;

    private String login;
    private String password;

    @ManagedProperty(value = "#{authenticationService}")
    transient private AuthenticationService authenticationService;

    public String login() {

        boolean success = authenticationService.login(login, password); // after restarting tomcat, authenticationService is null here!

        //........
    }
}

authenticationService is a spring’s @Service:

@Service("authenticationService")
public class AuthenticationServiceImpl implements AuthenticationService, Serializable {

    private static final long serialVersionUID = 1L;

    //....
}

Also, I’ve defined the session to be saved on the client side:

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>

THE PROBLEM:

the LoginBean works fine when I start tomcat first time in the morning. But if I then restart tomcat and immediately try to access LoginBean.login(), I am getting a NullPointerException on authenticationService.

I have defined authenticationService to be transient so that it won’t be saved to the session. But when restarting tomcat, it is not injected again with the refrence to the spring bean authenticationService.

Questions:

  1. Why is it not re-injected during start up?
  2. Why did defining authenticationService as transient not signal JSF to re-inject authenticationService?
  3. Is the problem affected by setting javax.faces.STATE_SAVING_METHOD as client?
  4. How can I solve this problem? If your solution is affected by the value of javax.faces.STATE_SAVING_METHOD, please explain how.
  • 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-31T21:31:39+00:00Added an answer on May 31, 2026 at 9:31 pm

    This is most likely due to session serialization done by tomcat. It is trying to restore your serialized session but won’t inject authenticationService. You can safely disable this feature, it is seldom of any use. To disable it, look up tomcat’s conf/context.xml and uncomment section described as responsible for session persistence management.

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

Sidebar

Related Questions

I have a JSF 2.0 application(App#1) that has a managed Session Scoped bean that
I have a small web application developed using Icefaces 1.8.2 and jsf 1.1 which
I have a Java-JSF Web Application on GlassFish, in which I want to use
Basically i have a enterprise jsf application which shows some services to the user.
I have jsf application in which I have to use a facelet custom component
I have a JSF 2 application which creates some SVG content. How can i
We have a JSF 2.0 application running under Glassfish 3.1.1 which has been moved
I have a JSF application in which I have different servlets and facelets. The
I have a JSF 2 application which uses a Richfaces 4 tree control. The
We have a web based java/JSF/Spring application for which we want to create sitempas.xml

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.