Issue with @PostConstruct JSF method in EAP 5.1.1

Solution Verified - Updated -

Issue

Use PostConstruct results in a IllegalArgumentException, if there is an overloaded method with arguments.

We had this in a JSF Managed Bean :

@PostConstruct
public void myOperationName() { ... }

public String myOperationName(Object foo){ ... }

When trying to use the Managed Bean in a view, (jsfHello), we got this error:

2011-08-29 16:41:17,434 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jsfHello].[jsp]] (http-localhost%2F127.0.0.1-808
0-2) Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: wrong number of arguments
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

Environment

JBoss Enterprise Application Platform 5.1.1

JSF 1.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.