[jboss-user] [JBoss Seam] - ClassCastException with @DataModel

texan do-not-reply at jboss.com
Fri Sep 1 12:02:44 EDT 2006


I'm getting the following exception while using @DataModel with a h:dataTable component.

Note that without the "@Out" annotations, my dataTables were always empty.  Maybe that in itself is a clue, but I don't  know how to debug it further.

Also note that "document" is not null in my test case.

Is there a problem with more than one @DataModel in a bean?

Caused by: java.lang.ClassCastException: java.util.ArrayList
  | 	at org.jboss.seam.databinding.DataModelBinder.isDirty(DataModelBinder.java:19)
  | 	at org.jboss.seam.Component.outjectDataModelList(Component.java:973)
  | 	at org.jboss.seam.Component.outjectDataModels(Component.java:937)
  | 	at org.jboss.seam.Component.outject(Component.java:857)
  | 	at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:41)
  | 	at sun.reflect.GeneratedMethodAccessor650.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:82)
  | 	at sun.reflect.GeneratedMethodAccessor649.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
  | 	at sun.reflect.GeneratedMethodAccessor648.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
  | 	at sun.reflect.GeneratedMethodAccessor647.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
  | 	at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
  | 	at sun.reflect.GeneratedMethodAccessor675.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	... 48 more

My Session Bean is:


  | @Name("viewDocument")
  | @Stateless
  | public class ViewDocumentAction implements ViewDocument {
  | 
  |     @DataModel(value = "alerts")
  |     @Out
  |     private List          alerts;
  |     
  |     @DataModelSelection(value="alerts")
  |     private Alert selectedAlert;
  | 
  |     @DataModel(value = "docevents")
  |     @Out
  |     private List          docevents;
  |     
  |     @DataModelSelection(value="docevents")
  |     private DocumentEvent selectedEvent;
  | 
  |     @Out
  |     private Document      document;
  | 
  |     @PersistenceContext
  |     private EntityManager em;
  | 
  |     @RequestParameter
  |     private String        documentId;
  | 
  |     public String view() {
  | 
  |         long id = StringUtility.parseLong(documentId);
  | 
  |         document = em.find(Document.class, id);
  | 
  |         if (document != null) {
  |             // fetch alerts and events from db
  |             document.getEvents().size();
  |             document.getAlerts().size();
  | 
  |             alerts = new ArrayList(document.getAlerts());
  |             docevents = new ArrayList(document.getEvents());
  |         }
  | 
  |         return "/Document.xhtml";
  |     }
  | 


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

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



More information about the jboss-user mailing list