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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:48:28+00:00 2026-05-27T17:48:28+00:00

I want to make a web application using JSF 2.0 and Hibernate. I want

  • 0

I want to make a web application using JSF 2.0 and Hibernate. I want to log exceptions in a data base[Asynchronously].

How can I do this?

  • 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-27T17:48:29+00:00Added an answer on May 27, 2026 at 5:48 pm

    The information you give in your question is a bit meager really, but I’ll give it a shot anyway.

    Limiting exception logging to those that occur during request processing (as per your comment), your first step would be to install a Servlet Filter:

    @WebFilter(filterName="exceptionHandler", urlPatterns="/*")
    public class ExceptionHandler extends HttpFilter {
    
        @Override
        public void doFilter(HttpServletRequest request, HttpServletResponse response, HttpSession session, FilterChain chain) throws ServletException, IOException {
    
            try {
                chain.doFilter(request, response);
            } catch (Exception e) {
                // ... handle exception here
            }
        }
    }
    

    If you already have other filters installed, you’ll probably need a web.xml to tune the order in which they are called.

    The next step is to do the asynchronous persisting to a DB. Here it depends on what stack you are using beyond JSF and Hibernate. For instance, Java EE has a convenient @Asynchronous annotation here, while in Spring it’s @Async. In general JSF is most often combined with Java EE, but people saying they’re using Hibernate instead of JPA typically tend to be on Tomcat.

    For Java EE you would inject an EJB in the Filter, with the EJB using JPA (possibly Hibernate) and the mentioned @Asynchronous annotation:

    Filter:

    @WebFilter(filterName="exceptionHandler", urlPatterns="/*")
    public class ExceptionHandler extends HttpFilter {
    
        @EJB
        private ExceptionPersister exceptionPersister;
    
        @Override
        public void doFilter(HttpServletRequest request, HttpServletResponse response, HttpSession session, FilterChain chain) throws ServletException, IOException {
    
            try {
                chain.doFilter(request, response);
            } catch (Exception e) {
                exceptionPersister.persist(e);
            }
        }
    }
    

    EJB:

    @Stateless
    public class ExceptionPersister {
    
        @PersistenceContext
        private EntityManager entityManager;
    
        @Asynchronous
        public void persist(Exception exception) {
            // use entityManager to persist exception in your
            // specific way.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make an installing application using vb.net(not asp.net) where i can login
I'm trying to make this 2-player web game application using Spring MVC. I have
I'm trying to use Netbeans to make a web application using facelets. I want
In my web jsf application, I display different messages to the user using this
I want to make user Login Authentication in my web application. I am using
Suppose I want to make a Web application which uses a fixed width and
I want to make a code snippet database web application. Would the best way
I want to make a web-UI where users can enter a table name and
I want to make a site where there user can basically navigate the web
I plan to make an web application using XPages for the design (plus the

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.