Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

proxy

jsf

cdi

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?

like image 799
gooamoko Avatar asked Jan 15 '23 15:01

gooamoko


1 Answers

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);
  }
like image 51
munyengm Avatar answered Feb 13 '23 02:02

munyengm