myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard W. Smith, Jr." <>
Subject Re: @Singleton @Lock(READ) to resolve, Could not instantiate converter ...
Date Sat, 13 Apr 2013 13:47:07 GMT

On Sat, Apr 13, 2013 at 8:38 AM, Mike Kienenberger <>wrote:

> Maybe your problem is that you are missing the no-arg constructor for
> the converter.
> Maybe that was why it worked when it was static.

Interesting. I'm definitely still novice to java, especially use of
'static', even though i used it, primarily, for adding static strings
throughout the app. All along, I knew that 'static' means that only one
copy will be created/instantiated within/for the parent class.

I think the static reference was added (by Netbeans, when it generated the
code for me, back in 2011), because of the following:

Below, you will see that the managed bean has a reference to a stateless

@ManagedBean(name = "customerController")
public class CustomerController implements Serializable {

    private jpa.session.CustomerFacade ejbFacade;

and, the CustomerControllerConverter.getAsObject() method references the
@EJB which is a member of the managed bean, CustomerController. See below.

            CustomerController controller = (CustomerController)
                    getValue(facesContext.getELContext(), null,
            return controller.ejbFacade.find(getKey(value));

> Was there additional information in java.lang.InstantiationException,
> like a root cause?
> I'll have to take a look at that, but I see MyFaces ApplicationImpl which
throws the exception, but haven't made my way to looking at
java.lang.InstantiationException, just yet.

> The two things I would try are
> 1)  move it to a separate class
> 2) add a no-arg constructor
Will try this and let you know. I think it still may be necessary to add
the class as a 'public static' class, so there will be only one instance of
@FacesConverter(forClass = Customer.class) during runtime.

> I haven't really written many converters since the annotation support
> was added, but this is what one of the few I did write looks like.
> This was a quick proof of concept thing, so I didn't take the time to
> debug why @FacesConverter(forClass = ) wasn't working for me but
> instead manually specified a converter id in the one place I used the
> converter.

Yeah, I really prefer not to use converter id, or I would have to go all
throughout my xhtml and update, accordingly. Thanks.

Will share any/all updates, ASAP. Thanks Mike!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message