2 Replies Latest reply on Sep 7, 2009 6:57 PM by Cleber Goncalves

    Can't @In annotations and accessor methods be used at the same time for different properties?

    Cleber Goncalves Newbie


      I generated a new form using sean-gen (seam new-form) and added another field to it using an @In annotation:

      public class DummyBean implements Dummy
          @Logger private Log log;
          @In StatusMessages statusMessages;
          @In private String bar;
          private String foo;
          public void doStuff()
              String msg = "dummy.doStuff() action called with foo: #{dummy.foo} and bar: #{bar}. instance variable for bar:" + bar;
          @Length(max = 10)
          public String getFoo()
              return foo;
          public void setFoo(String value)
              this.foo = value;
          public void destroy() {}

      The interface is this one:

      public interface Dummy
          public void doStuff();
          public String getFoo();
          public void setFoo(String value);
          public void destroy();

      The problem is, when I try to access the properties I get:

      javax.faces.FacesException: javax.el.ELException: /dummy.xhtml @22,52 value="#{dummy.foo}": Error reading 'foo' on type org.javassist.tmp.java.lang.Object_$$_javassist_seam_2
           at javax.faces.component.UIOutput.getValue(UIOutput.java:187)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
      Caused by: javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: dummy.bar
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)

      My view is this:

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      <ui:define name="body">
          <h:form id="dummyForm">
                  <f:facet name="header">dummy header</f:facet>
                   <s:decorate id="fooField" template="layout/edit.xhtml">
                      <ui:define name="label">Foo</ui:define>
                      <h:inputText id="foo" required="true"
                   <s:decorate id="barField" template="layout/edit.xhtml">
                      <ui:define name="label">Bar</ui:define>
                      <h:inputText id="bar" required="true"
                  <div style="clear:both"/>
              <div class="actionButtons">
                  <h:commandButton id="doStuff" value="doStuff"

      If I remove either 'fooField' or 'barField' the view renders and works correctly, but if I try to use both at the same time I get the above exception.

      I also noticed that if I use only @In annotations (remove the accessor methods) the page works.

      Is this something expected? I'm using JBoss 5.1.0.GA, Seam 2.2.0.GA and Java 6.