Search code examples
jsfproxycdi

WELD-001410: The injection point has non-proxyable dependencies


I have two Managed Beans:

SessionBean:

@Named(value = "sessionBean")
@SessionScoped
public class SessionBean implements Serializable {

  private final Param param

  SessionBean(Param param) {
      this.param = param;
  }

}

and TypesBean:

@Named(value = "typesBean")
@RequestScoped
public class TypesBean {

  @Inject
  private SessionBean session;

}

The project builds, but does not deploy:

Error occurred during deployment: Exception while loading the app : WELD-001410 The injection point [field] @Inject private com.example.TypesBean.session has non-proxyable dependencies. Please see server.log for more details.

What's the problem?


Solution

  • The problem is the lack of an accessible no-args constructor on the SessionBean class.

    One solution as the OP pointed out is:

    "The problem was in final methods of SessionBean. Removing final and making methods just public - solve the problem. Sorry for wasting your time. "

    Or alternatively...

    @Named(value = "sessionBean")
    @SessionScoped
    public class SessionBean implements Serializable {
    
      . . . //variables, setters, getters and other methods
      private final Param param
    
      public SessionBean(Param param) {
          this.param = param;
      }
      // no-args constructor used by CDI for proxying only 
      // but is subsequently replaced with an instance 
      // created using the above constructor. 
      protected SessionBean() {
         this(null);
      }