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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:48:28+00:00 2026-06-06T09:48:28+00:00

Short: (Portlet-)Container swallows Exception thrown by @PostConstruct method in backing bean. Is this behavior

  • 0

Short: (Portlet-)Container swallows Exception thrown by @PostConstruct method in backing bean.

Is this behavior intentional, a bug or container specific?

Long: I am running a portlet on WebSphere Portal 7, where i force managed bean construction in a PhaseListener so it can send the user back to the start page, when the system encounters unrecoverable problems during Bean construction/post-construction.

I am using the following code to ‘force’ construction:

@SuppressWarnings("unchecked")
public static <T> T getManagedBean(final String beanName)
{
    final FacesContext context = getFacesContext();
    return (T)context.getApplication().evaluateExpressionGet(context, "#{" + beanName + "}", Object.class);
}

I tested throwing a RuntimeException from the @PostConstruct method

@PostConstruct
public void initialize()
{
    throw new RuntimeException("test");
}

The stacktrace ends up on the RAD(Eclipse) log:

com.ibm.ws.webcontainer.annotation.WASAnnotationHelper doInvoke unable to invoke method --> [initialize] on class --> [foo.bar.UpdateAddress]
                             java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.doInvokeSingle(WASAnnotationHelper.java:432)
at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.doInvokeChain(WASAnnotationHelper.java:400)
at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.doPostConstruct(WASAnnotationHelper.java:220)
at com.sun.faces.vendor.WebSphereInjectionProvider.invokePostConstruct(WebSphereInjectionProvider.java:86)
at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:225)
...
Caused by: java.lang.RuntimeException: test
    at foo.bar.UpdateAddress.initialize(UpdateAddress.java:119)
    ... 121 more

But there is no exception to catch in my PhaseListener and it happily continues without being aware of an Exception during the @PostConstruct.

Is this behavior intentional, a bug or container specific?

It looks like at least JBoss has a similar way of handling : http://www.coderanch.com/t/499013/JSF/java/PostConstruct-exception-handling

  • 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-06T09:48:30+00:00Added an answer on June 6, 2026 at 9:48 am

    Per section 15.5.9 of the Servlet 3.0 specification:

    The @PostConstruct annotation MUST be supported by all classes that
    support dependency injection and called even if the class does not
    request any resources to be injected. If the method throws an
    unchecked exception the class MUST not be put into service and no
    method on that instance can be called.

    If you’re seeing different behavior, then this looks like a product defect. If the servlet is not being put into service but the exception is being swallowed, this sounds like a serviceability defect. In either case, I would recommend opening a PMR with IBM. Note that it is unlikely that your terms of service allow decompiling WebSphere Application Server classes, even for the purposes of debugging.

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

Sidebar

Related Questions

Short version : echo testing | vim - | grep good This doesn't work
Short Version: If I create a System.Web.HttpException as follows: var exception = new HttpException(403,
Short Version I want to extend SoapClient so it does this internally when accessing
Short version: I'm wondering if it's possible, and how best, to utilise CPU specific
Short of inserting a try/catch block in each worker thread method, is there a
Short best practice question: If an object A is injected into another object B,
Short version: I have a similar setup to StackOverflow. Users get Achievements. I have
Short version: Is it easy/feasible/possible to program modal window in Flash (AS3)? Is there
SHORT INTRO: I'm having trouble with a 3D cube on a plane. The plane
Short version: I'm trying to determine the best way to track what the user

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.