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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:12:55+00:00 2026-06-10T16:12:55+00:00

so the problem is pretty simple: We are using JSF 2.0 with Primefaces and

  • 0

so the problem is pretty simple:

We are using JSF 2.0 with Primefaces and EJB to handle our application and we have encountered a problem. We have a single @SessionScoped bean in which we store all ours @Stateful Session Beans.

In one case, (when we didn’t handle some exceptions from JPA) and there is an exception:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "webuser_idwebuser_pk"
  Detail: Key (idwebuser)=(6) already exists.

It leads to destruction of one of our @Stateful Session Bean.
So after refreshing the website, when JSF is still working correctly, after filling the form and trying to submit it, by invoking a method from that Bean there is an exception:

javax.ejb.NoSuchObjectLocalException: The EJB does not exist. session-key: 22900a4d007e1f-6dcc714a-0

What is the most problematic, we have to restart and redeploy the application to make it work on the same computer (or web browser) because the JSF’s @SessionScoped Bean is somehow kept through cookies or something.

So the solution I guess would be to force the destuction of that @SessionScoped or refresh the session somehow, but actually I have no idea how to do so.
Or what would be a better approach.

Thanks!

  • 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-10T16:12:57+00:00Added an answer on June 10, 2026 at 4:12 pm

    To remedy this, you need to be aware about the difference between application- and system exceptions in EJB.

    Those roughly correspond to checked and runtime exceptions respectively.

    Application exceptions are supposed to be handled by your own code, and will not cause a transaction rollback or the destruction of a bean. System exceptions have the opposite effect and will cause a rollback and the destruction of the EJB bean.

    The latter effect is what you are seeing. JPA throws unchecked exceptions, which thus become system exceptions, which thus cause your SFSB to be destroyed. JSF nor CDI managed beans participate in this “system exception” thing, so they will just propagate the exception and will stay alive.

    What you probably want is to define a new Exception that you annotate with @ApplicationException and then set its rollback attribute to true. Catch the JPA exception within your SFSB and wrap and rethrow it with your custom exception.

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

Sidebar

Related Questions

I have implemented pretty simple application, using gwt and gwt event service 1.1.1, it
I'm having a problem with a pretty simple setup in NHibernate. (I'm using Fluent
I have a pretty simple problem. Basically I have an array called $list that
I have a problem with WCF. My testing code is pretty simple. I call
I have a pretty simple general programming problem, yet I can't quite get the
I have a pretty simple problem. When program has been started and user tries
I have a pretty simple problem, in wich I try to exchange an object
I've got a pretty simple problem, I think. I'm using WPF in Visual Basic
I have pretty simple problem. I have a large file that goes through three
The problem is that, shaders (pretty simple ones, as I'm learning OpenGL) fail to

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.