2 Replies Latest reply on Apr 13, 2008 2:32 AM by jaikiran pai

    IllegalArgumentException( argument type mismatch) when using

    Peter Johnson Newbie

      I'm porting my app from Seam 1.2 to Seam 2.0 and I've got a problem that is completely baffling me. I don't think it really has anything to do with Seam (I've pretty much removed Seam and still have the problem), but the Seam change is the biggest difference.

      The problem only occurs when I have my app clustered. I'm using the jboss EJB3EntityTreeCache. With a single instance, it works. However, whenever it is clustered, and the second instance tries to pull an entity out of the cache, I get an exception (show at the end of this message). By second instance, what I really mean is the instance that did not directly populate the cache, but got it sync'ed from the other--I can force either node to have the problem.

      It looks like it is pulling the fields out of the cache and applying them to the wrong property on the entity bean. (The 'rule' property is a String and all other properties are ints). Curiously, if I printDetails on the EJB3EntityTreeCache, the order in which the params are listed in the older app (which works) is different than in the newer app (which doesn't); I don't know if that is relevant or a red herring.

      If anyone has a clue, I'd appreciate a hand here...I'm losing my hair over this!

      2008-04-07 14:52:07,590 ERROR [org.hibernate.property.BasicPropertyAccessor] IllegalArgumentException in class: com.zattoo.channelserver.entity.permission.AbstractPermissionRule, setter method of property: rule
      2008-04-07 14:52:07,590 ERROR [org.hibernate.property.BasicPropertyAccessor] expected type: java.lang.String, actual value: java.lang.Integer
      2008-04-07 14:52:07,591 INFO [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command
      org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.zattoo.channelserver.entity.permission.AbstractPermissionRule.rule
      at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104)
      at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:337)
      at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:200)
      at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3566)
      at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:116)
      at org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:82)
      at org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:553)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:508)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:357)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
      at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
      at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
      at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:196)
      at org.hibernate.collection.PersistentBag.initializeFromCache(PersistentBag.java:141)
      at org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:35)
      at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:130)
      at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48)
      at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
      at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
      at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:797)
      at org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:580)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:508)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:357)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
      at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
      at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
      at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:196)
      at org.hibernate.collection.PersistentBag.initializeFromCache(PersistentBag.java:141)
      at org.hibernate.cache.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:35)
      at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:130)
      at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:48)
      at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
      at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
      at org.hibernate.Hibernate.initialize(Hibernate.java:309)
      at com.zattoo.channelserver.session.ChannelProviderBean.getAllPartitions(ChannelProviderBean.java:127)
      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:585)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:101)
      at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      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: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.invokeInCallerTx(TxPolicy.java:126)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
      at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
      at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
      at $Proxy161.getAllPartitions(Unknown Source)
      at com.zattoo.channelserver.service.ChannelCacheService.loadPartitionCache(ChannelCacheService.java:136)
      at com.zattoo.channelserver.service.ChannelCacheService.getAllPartitions(ChannelCacheService.java:155)
      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:585)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:101)
      at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      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: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)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:329)
      at org.jboss.ejb3.service.ServiceContainer.localInvoke(ServiceContainer.java:294)
      at org.jboss.ejb3.service.ServiceMBeanDelegate.getAttribute(ServiceMBeanDelegate.java:139)
      at org.jboss.mx.server.RawDynamicInvoker.getAttribute(RawDynamicInvoker.java:117)
      at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:556)
      at org.jboss.jmx.adaptor.control.Server.getMBeanAttributeResultInfo(Server.java:144)
      at org.apache.jsp.inspectMBean_jsp._jspService(inspectMBean_jsp.java:185)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.inspectMBean(HtmlAdaptorServlet.java:204)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:96)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doGet(HtmlAdaptorServlet.java:77)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:856)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:566)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalArgumentException: argument type mismatch
      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:585)
      at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)
      ... 155 more
      200

        • 1. Re: IllegalArgumentException( argument type mismatch) when u
          Peter Johnson Newbie

          After poking at this a bit more, I think I sort of understand what was going on (though I don't really know why) and have a resolution which I am mostly confident in (but some reassurance would be nice!)

          It appears to be a problem with the way Hibernate uses the JBoss cache. Hibernate is storing a CacheEntry in the clustered JBoss TreeCache for each entity instance. This CacheEntry seems to store an array of property values, the order of which is determined by some metadata, presumably gathered by introspection of the entity's class. When pulling data out of the cache, it again uses this metadata to put those values back into the correct entity properties.

          The assumption seems to be that in two different JVMs this metadata about the entity is constructed identically; i.e. the properties are listed in the same order. If the second JVM for some reason has the properties in a different order, then when reconstructing an entity from a CacheEntry, it tries to stuff values into the wrong properties.

          I turned on the hibernate.cache.use_structured_entries setting and now instead of a CacheEntry that uses an array with an assumed order, it uses a StructuredCacheEntry (I think) which seems to use Map semantics (i.e. key=value) and now my 2nd JVM gets the values in their correct properties.

          Does anyone with deeper understanding of Hibernate and/or JBoss cache have any thoughts on this? Is this is a good workaround?

          I think this may be a bug in Hibernate and I'll go file an issue in their Jira.

          • 2. Re: IllegalArgumentException( argument type mismatch) when u
            jaikiran pai Master

             

            "peter_zat" wrote:

            Does anyone with deeper understanding of Hibernate and/or JBoss cache have any thoughts on this? Is this is a good workaround?



            Probably, someone from the JBoss Cache team will be able to comment, if you post this in the JBoss Cache User Forums http://www.jboss.com/index.html?module=bb&op=main&c=29.