[jboss-user] [JBoss Seam] - Re: @Service / @Management bean injection
rhomber
do-not-reply at jboss.com
Fri Sep 21 04:23:05 EDT 2007
Hey,
I found a feature request that suggests there is a way of doing it: http://jira.jboss.org/jira/browse/JBSEAM-1498
I am not stuck with the fact that I cannot inject a stateless bean either. Perhaps my understanding of how Seam works is wrong.
I have a stateless bean:
@Name("utibaServiceGajMediator")
| @Stateless
| @Scope(ScopeType.APPLICATION)
| @AutoCreate
| public class GAJServiceMediatorBean implements GAJServiceMediator {
|
| public int nextTransID() throws Exception {
| return 1234;
| }
|
| }
Implementing interface:
@Local
| public interface GAJServiceMediator {
|
| public int nextTransID() throws Exception;
|
| }
And then used by this class:
@Name("utibaTester")
| @AutoCreate
| public class UtibaTest {
|
| @In GAJServiceMediator gajServiceMediator;
| @In MyBean myBean;
|
| public void takeMagicFlight() {
| try {
| myBean.setText("TransID = " + gajServiceMediator.nextTransID());
| } catch (Exception e) {
| myBean.setText("Failed");
| }
| }
|
| }
Then elsewhere I have a commandLink:
| <h:commandButton type="submit" value="Fly Away" action="#{utibaTester.takeMagicFlight}"/>
|
And get the following error message:
Caused by: javax.faces.el.EvaluationException: /ajax.xhtml @22,102 action="#{utibaTester.takeMagicFlight}": org.jboss.seam.RequiredException: In attribute requires non-null value: utibaTester.gajServiceMediator
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
| at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
| ... 43 more
| Caused by: org.jboss.seam.RequiredException: In attribute requires non-null value: utibaTester.gajServiceMediator
Well that is the useful portion anyway. As far as I can tell I have followed the documentation, perhaps my understanding of how all this should work together is wrong? Should I be able to have one stateless bean injected as a resource to another bean?
Any help would be appreciated.
Cheers,
David
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087094#4087094
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087094
More information about the jboss-user
mailing list