Exception @In attribute requires non-null
allllllan Jul 9, 2010 5:12 PMCan't figure out what's going on... been pounding on the following issue for the last day and a half. I've done a seam project before and have never ran into this issue. But now, the following which seems so basic will not work...
I have the following sample entity:
@Entity
@Name("sampleentity")
@Table(name = "sampleentity")
public class SampleEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
All I'm trying to do is inject the above 'sampleentity' component into a session bean:
@Stateful
@Scope(CONVERSATION)
@Name(AccountServiceLocal.NAME)
public class AccountServiceBean implements AccountServiceLocal {
...
@In(create = true)
private SampleEntity sampleentity;
...
}
Now, @In(create = true) is supposed to create a new instance of 'sampleentity' if there isn't already an instance of it. But all I get is:
javax.faces.FacesException: ${accountService.someMethod}: javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: accountService.sampleentity
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
Adding @AutoCreate to the entity doesn't work either.
The big difference with this project is that I used maven to setup the project using the seam maven archetype from http://seam-archetype.sourceforge.net/jbosscc-seam-archetype/1.2/project-info.html. In my previous project, I used seam-gen to setup the project.
Anyone run into this issue before? Any advice would be much appreciated.
I have the following sample entity:
@Entity
@Name("sampleentity")
@Table(name = "sampleentity")
public class SampleEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
All I'm trying to do is inject the above 'sampleentity' component into a session bean:
@Stateful
@Scope(CONVERSATION)
@Name(AccountServiceLocal.NAME)
public class AccountServiceBean implements AccountServiceLocal {
...
@In(create = true)
private SampleEntity sampleentity;
...
}
Now, @In(create = true) is supposed to create a new instance of 'sampleentity' if there isn't already an instance of it. But all I get is:
javax.faces.FacesException: ${accountService.someMethod}: javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: accountService.sampleentity
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
Adding @AutoCreate to the entity doesn't work either.
The big difference with this project is that I used maven to setup the project using the seam maven archetype from http://seam-archetype.sourceforge.net/jbosscc-seam-archetype/1.2/project-info.html. In my previous project, I used seam-gen to setup the project.
Anyone run into this issue before? Any advice would be much appreciated.