0 Replies Latest reply on Jul 27, 2012 9:03 AM by luca.masini

    Cannot access Stateful EJB from inner anonymous class

    luca.masini

      Hi all, I'm trying to deploy the generated Java EE 6 application under several application servers.

       

      Now under Weblogic 12c I've some problems. One of this is that in the generated code we have the JSF Converter:

       

            return new Converter()

            {

       

       

               @Override

               public Object getAsObject(FacesContext context, UIComponent component, String value)

               {

       

       

                  return MyWonderfulBean.this.getAsObject(value);

               }

       

      But when JSF tries to execute an IllegalStateException: "Extended Persistence Contexts can only be invoked from within the context of the stateful session bean that declares the Extended Persistence Context." is raised.

       

      I think that WLS is right, but I want your opinion. Infact accessing the "this" object we don't have the EJB object but only the plain Java Bean that implements it, and this is not the desidered Stateful EJB.

       

      I tried to use the SessonContext to grab the EJB Object, but without a Local interface this is not allowed.

       

      So I solved implementing the Converter interface directly from the EJB and passing the EJB to the JSF page:

       

      <h:selectOneMenu converter="#{myWonderfulBean......

       

      Can we consider this a bug in the generated code ??

       

      Should I open an Issue ??

       

      Thank you.