2 Replies Latest reply on Jul 22, 2003 8:20 AM by billelmehdi

    ClassCastException Error When call BeanHome.findByPrimaryKey

    billelmehdi

      Hi, I'm using Jboss 3.0.7
      I have two EJB, the first is called ExportManager and the second is LinkedNodeManager.

      The ExportManager calls findByPrimaryKey method of LinkedNodeManager and I got this Error:

      11:54:19,832 ERROR [LogInterceptor] RuntimeException:
      java.lang.ClassCastException
      at agents.ExportManagerBean.updateChanges(Unknown Source)
      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:324)
      at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:824)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
      at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
      at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:268)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
      at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:380)
      at org.jboss.ejb.Container.invoke(Container.java:738)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:383)
      at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)

      in the source:

      currentNode = linkedHome.findByPrimaryKey("id");
      where linkedHome is the Home interface of LinkedNodeBean.
      I make the lookup correctly.
      The beans are deployed correctly.

      Where is the mistake please?

      There is also this message in starting of LinkedNodeBean

      12:08:11,368 INFO [MainDeployer] Starting deployment of package: file:/E:/jboss-3.0.7/server/default/deploy/DataJar.jar
      12:08:12,149 INFO [EJBDeployer]
      Bean : LinkedNode
      Method : public String ejbCreate(String, String, String) throws CreateException
      Section: 9.2.3
      Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

      12:08:12,149 INFO [EJBDeployer]
      Bean : LinkedNode
      Method : public String ejbCreate(String, String) throws CreateException
      Section: 9.2.3
      Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

      12:08:12,159 INFO [EJBDeployer]
      Bean : LinkedNode
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The return type of the ejbFindByPrimaryKey method must be the primary key type.

      12:08:12,159 INFO [EJBDeployer]
      Bean : LinkedNode
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The ejbFindByPrimaryKey method must be a single-object finder.

      12:08:12,169 INFO [EJBDeployer]
      Bean : LinkedNode
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The finder method return type must be either the entity bean's primary key type or an instance of the Enumeration or the Collection interface.

      12:08:12,189 INFO [EJBDeployer]
      Bean : Node
      Method : public String ejbCreate(String, String) throws CreateException
      Section: 9.2.3
      Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

      12:08:12,189 INFO [EJBDeployer]
      Bean : Node
      Method : public String ejbCreate(String, String, String) throws CreateException
      Section: 9.2.3
      Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

      12:08:12,189 INFO [EJBDeployer]
      Bean : Node
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The return type of the ejbFindByPrimaryKey method must be the primary key type.

      12:08:12,189 INFO [EJBDeployer]
      Bean : Node
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The ejbFindByPrimaryKey method must be a single-object finder.

      12:08:12,189 INFO [EJBDeployer]
      Bean : Node
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The finder method return type must be either the entity bean's primary key type or an instance of the Enumeration or the Collection interface.

      12:08:12,239 INFO [EJBDeployer]
      Bean : Link
      Method : public String ejbCreate(String, String, String, String) throws CreateException
      Section: 9.2.3
      Warning: The return type of an ejbCreate(...) method must be the entity bean's primary key type.

      12:08:12,249 INFO [EJBDeployer]
      Bean : Link
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The return type of the ejbFindByPrimaryKey method must be the primary key type.

      12:08:12,249 INFO [EJBDeployer]
      Bean : Link
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The ejbFindByPrimaryKey method must be a single-object finder.

      12:08:12,249 INFO [EJBDeployer]
      Bean : Link
      Method : public String ejbFindByPrimaryKey(String) throws FinderException
      Section: 9.2.5
      Warning: The finder method return type must be either the entity bean's primary key type or an instance of the Enumeration or the Collection interface.

      12:08:12,299 INFO [EjbModule] Creating
      12:08:12,349 INFO [EjbModule] Deploying LinkedNode
      12:08:12,389 INFO [EjbModule] Deploying Node
      12:08:12,429 INFO [EjbModule] Deploying Link
      12:08:12,659 INFO [EjbModule] Created
      12:08:12,669 INFO [EjbModule] Starting
      12:08:13,070 INFO [EjbModule] Started
      12:08:13,080 INFO [MainDeployer] Deployed package: file:/E:/jboss-3.0.7/server/default/deploy/DataJar.jar

      The primary Key in the descriptor is correct, and there is one findByPrimaryKey method!

      Thanks.