Hi. 

Doscouraged @In(jection) problem I prepared simple app dedicated to be focused 
on this problem only. 
After I started my test app within Jboss AS, results terrified me ;) ... I 
can't understand why it doesn't work.

Seam action bean:

@Stateful
  | @Name( "showAction" )
  | // @Intercept( InterceptionType.ALWAYS ) // added to check if it could help
  | public class ShowActionBean implements ShowAction {
  | 
  |    // this doesn't work
  |    @In( create = true )
  |    @Out
  |    private TestAction testAction;
  | 
  |    @Begin( join = true )
  |    public String go( ) {
  | 
  |      // this solution works
  |      // testBean = (Test) Contexts.getSessionContext( ).get( "testBean" );
  | 
  |       System.out.println( "id=" + testBean.getId( ) );
  |       System.out.println( "name=" + testBean.getName( ) );
  |       return "next";
  |    }
  | 
  |    @Destroy
  |    @Remove
  |    public void destroy( ) {
  |    }
  | 
  | }


Back bean:

@Stateful
  | @Name( "testBean" )
  | public class TestBean implements Test {
  | 
  |    private int id;
  |    private String name;
  | 
  |    public int getId( ) {
  |       return id;
  |    }
  | 
  |    public void setId( int id ) {
  |       this.id = id;
  |    }
  | 
  |    public String getName( ) {
  |       return name;
  |    }
  | 
  |    public void setName( String name ) {
  |       this.name = name;
  |    }
  | 
  |    @Destroy
  |    @Remove
  |    public void destroy( ) {
  |    }
  | 
  | }

I've got created jsf site where are 2 text inputs and submit action performing 
showAction.go( ) method. 

When I fill up text inputs on the site and click submit button, I receive 
Caused by: java.lang.NullPointerException in go( ) method for 
System.out.println( "id=" + testBean.getId( ) ) line.
When I use testBean = (Test) Contexts.getSessionContext( ).get( "testBean" ), 
everything works correctly and I have received testBean from CONVERSATION 
context. 

How to make @In(jections) working?

Regards, Slawek

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948633#3948633

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948633


_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to