[jboss-user] [JBoss Seam] - Re: @DataModel on Stateful beans (broken?)

sannegrinovero do-not-reply at jboss.com
Thu Aug 2 14:06:39 EDT 2007


Interface:
import javax.ejb.Local;
  | import java.util.List;
  | 
  | @Local
  | public interface BrokenListIfa {
  | 
  |     public List getTestData();
  |     public void destroy();
  | 
  | }
  | 
Bean:
  | import org.jboss.seam.annotations.datamodel.DataModel;
  | import org.jboss.seam.annotations.Name;
  | import java.util.ArrayList;
  | import java.util.List;
  | import org.jboss.seam.ScopeType;
  | import javax.ejb.Stateful;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.annotations.Destroy;
  | import javax.ejb.Remove;
  | 
  | @Name("brokenList")
  | @Stateful
  | public class BrokenList implements BrokenListIfa {
  | 
  |     @DataModel
  |     public List getTestData() {
  | 	List l = new ArrayList();
  | 	l.add("ONE");
  | 	l.add("TWO");
  | 	return l;
  |     }
  |     
  |     @Remove @Destroy
  |     public void destroy() {
  |     }
  | 
  | }
  | 
View:    <h:dataTable value="#{brokenList.testData}" var="d">
  | 	<h:column>
  | 	    <h:outputText value="#{d}" />
  | 	</h:column>
  |     </h:dataTable>
Partial stacktrace (see first post for more detail):anonymous wrote : [...]Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: BrokenList.getTestData() with parameters: (java.util.ArrayList) on: org.jboss.seam.example.pdf.BrokenList
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:31)
  |         at org.jboss.seam.Component.setPropertyValue(Component.java:1656)
  |         ... 108 more
  | Caused by: java.lang.IllegalArgumentException: wrong number of arguments
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:597)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
  |         ... 109 more
  | 

I must point out that the super-simple test throws the exception but actually renders the expected list. In our application I get the same exception but it doesn't render the page, I suppose because of configuration but am not shure.

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

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



More information about the jboss-user mailing list