0 Replies Latest reply on Aug 5, 2014 11:38 AM by Filipe Ferraz

    Weld proxy error (can not set on field)

    Filipe Ferraz Newbie

      Im my application I'm mixing EJB and CDI. I have one CDI Transactional class that is Injected on field in the Stateless EJB.

      Sometimes this erros appears:

      java.lang.IllegalArgumentException: Can not set ClassA field ClassB.classA to ClassA$Proxy$_$$_WeldSubclass

       

      I already tried to change from private to public or protected. None seems to work. A strange behaviour is that sometimes just restarting the wildfly server the error is gone.

      Anyone have some idea of the cause of this error?

       

      I'm using wildfly 8.1.0.Final and weld 2.2.4.Final (patched).

       

      The follow code is to help visualize the structure (the ClassB is called from a CDI ManagedBean, annotated with @Named and @ViewScoped):

       

      @Transactional

      public class ClassA {

           @Inject

           private EntityManager em;

      }

       

      @Stateless

      @LocalBean

      public class ClassB {

         @Inject

         private ClassA classA;

      }