1 Reply Latest reply on Dec 12, 2006 10:42 AM by mein name mein nachname

    java.lang.IllegalArgumentException: object is not an instanc

    mein name mein nachname Newbie

      Java: 1.5.4
      OS: linux 2.4
      Jboss 4.0.4
      Mysql-JDBC-Driver: mysql-connector-java-5.0.4
      mysql-server: 4.0
      EJB - CMP

      after invoking the "ejbCreate" function, the JBoss-Server prints following Exception. (but all data saved in database)

      12:35:55,453 ERROR [STDERR] javax.ejb.EJBException: RuntimeException
      12:35:55,453 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:417)
      12:35:55,454 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:136)
      12:35:55,454 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
      12:35:55,454 ERROR [STDERR] at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:514)
      12:35:55,454 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:975)
      12:35:55,454 ERROR [STDERR] at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:359)
      12:35:55,454 ERROR [STDERR] at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:133)
      12:35:55,454 ERROR [STDERR] at $Proxy62.create(Unknown Source)
      12:35:55,455 ERROR [STDERR] at test.TestBean.startTest(TestBean.java:77)
      12:35:55,455 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:35:55,455 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,455 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,455 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:35:55,455 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      12:35:55,455 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
      12:35:55,455 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
      12:35:55,456 ERROR [STDERR] at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      12:35:55,456 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
      12:35:55,457 ERROR [STDERR] at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      12:35:55,457 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:954)
      12:35:55,457 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:35:55,457 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,457 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,457 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:35:55,457 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      12:35:55,457 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      12:35:55,457 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      12:35:55,458 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      12:35:55,458 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      12:35:55,458 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
      12:35:55,458 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
      12:35:55,458 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:35:55,458 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,458 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,458 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:35:55,459 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      12:35:55,459 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Unknown Source)
      12:35:55,459 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
      12:35:55,459 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      12:35:55,459 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      12:35:55,459 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      12:35:55,459 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
      12:35:55,459 ERROR [STDERR] Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
      12:35:55,459 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:35:55,460 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,460 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,460 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:35:55,460 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand.executeInsert(JDBCMySQLCreateCommand.java:116)
      12:35:55,460 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:321)
      12:35:55,460 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:151)
      12:35:55,460 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:587)
      12:35:55,460 ERROR [STDERR] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:237)
      12:35:55,461 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:225)
      12:35:55,461 ERROR [STDERR] at org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:618)
      12:35:55,461 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:35:55,461 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,461 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:35:55,461 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:35:55,461 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      12:35:55,461 ERROR [STDERR] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1130)
      12:35:55,461 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:203)
      12:35:55,462 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:43)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
      12:35:55,462 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      12:35:55,463 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
      12:35:55,463 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
      12:35:55,463 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
      12:35:55,463 ERROR [STDERR] ... 47 more
      12:35:55,463 ERROR [STDERR] javax.ejb.EJBException: RuntimeException
      ----------------------------------------------------------------

      EJB-Source

      public Integer ejbCreate(Integer einfilter_fid, String filteriname, String filterename) throws javax.ejb.CreateException {
       //setId(0);
       setEinvifilter_fid(einfilter_fid);
       setFilteriname(filteriname);
       setFilterename(filterename);
       return null;
       }
      


      ejb-jar.xml
      <entity>
       <display-name>Dataobjectfilter</display-name>
       <ejb-name>Dataobjectfilter</ejb-name>
       <local-home>com.company.filter.DataobjectfilterLocalHome</local-home>
       <local>com.company.filter.DataobjectfilterLocalObject</local>
       <ejb-class>com.company.filter.DataobjectfilterBean</ejb-class>
       <persistence-type>Container</persistence-type>
       <prim-key-class>java.lang.Integer</prim-key-class>
       <reentrant>False</reentrant>
       <cmp-version>2.x</cmp-version>
       <abstract-schema-name>einvifilterliste</abstract-schema-name>
       <cmp-field>
       <field-name>id</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>einvifilter_fid</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>filteriname</field-name>
       </cmp-field>
       <cmp-field>
       <field-name>filterename</field-name>
       </cmp-field>
       <primkey-field>id</primkey-field>
       <resource-ref>
       <res-ref-name>company/databases/dbdesktop</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       <query>
       <query-method>
       <method-name>findAllByFilterGroup</method-name>
       <method-params>
       <method-param>java.lang.Integer</method-param>
       </method-params>
       </query-method>
       <ejb-ql>SELECT OBJECT(e) FROM einvifilterliste e WHERE e.einvifilter_fid=?1</ejb-ql>
       </query>
       </entity>
      


      jbosscmp-jdbc.xml
      <entity>
       <ejb-name>Dataobjectfilter</ejb-name>
       <datasource>company/databases/dbdesktop</datasource>
       <datasource-mapping>mySQL</datasource-mapping>
       <create-table>false</create-table>
       <remove-table>false</remove-table>
       <pk-constraint>true</pk-constraint>
       <table-name>einvifilterliste</table-name>
       <cmp-field>
       <field-name>id</field-name>
       <column-name>id</column-name>
       <not-null/>
       <jdbc-type>INTEGER</jdbc-type>
       <sql-type>int(11)</sql-type>
       <auto-increment/>
       </cmp-field>
       <cmp-field>
       <field-name>einvifilter_fid</field-name>
       <column-name>einvifilter_fid</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>filteriname</field-name>
       <column-name>filteriname</column-name>
       <not-null/>
       </cmp-field>
       <cmp-field>
       <field-name>filterename</field-name>
       <column-name>filterename</column-name>
       <not-null/>
       </cmp-field>
       <entity-command name="mysql-get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand"/>
       </entity>
      


      Has somebody an idea?

        • 1. Changed some settings
          mein name mein nachname Newbie

          I tried with other settings,

          changed return type of ejbCreate to Object

          public Object ejbCreate(Integer einfilter_fid, String filteriname, String filterename) throws javax
          .ejb.CreateException {

          removed: getId and setId

          ---------------------------------
          ejb-jar:

          changed: <prim-key-class>java.lang.Object</prim-key-class>
          removed: <primkey-field>id</primkey-field>
          removed: <cmp-field><field-name>id</field-name></cmp-field>

          ----------------------------------
          jbosscmp-jdbc.xml
          removed: <cmp-field><field-name>id</field-name> .......
          added:

          <unknown-pk>
           <unknown-pk-class>java.lang.Integer</unknown-pk-class>
           <field-name>id</field-name>
           <column-name>id</column-name>
           <jdbc-type>INTEGER</jdbc-type>
           <sql-type>INT(11)</sql-type>
           <auto-increment/>
           </unknown-pk>



          -> same error