EJB redeployment : ClassCastException
sanepid Dec 5, 2002 11:36 AMHello,
I posted a simmilar message a couple of days ago, but, since I haven't got any response yet, I decided to post more information about what appears to be a serious bug with CMP redeployment. I tried the latest JBoss from sourceforge without any luck. Any advice in this matter would be highly appreciated.
Briefly, here is the problem:
A jar contains 2 CMP entity beans: EventBean and ProfileBean. ProfileBean holds a local reference to EventBean. When I first deploy the jar, everything goes fine, the ProfileBean is created fine, the local reference to EventBean is created fine as well and everything works good. The problem appears when I modify the EventBean and then redeploy the archive. The following line in ProfileBean generates the ClassCastException:
EventLocalHome eventLocalHome = (EventLocalHome)initialContext.lookup("java:/comp/env/ejb/EventBean");
2002-12-05 10:42:43,218 ERROR [iqos_ProfileBean] Exception
java.lang.ClassCastException
at com.inquent.iqos.ejb.Profile.ProfileBean.isEventAuthorized(ProfileBean.java:102)
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.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1097)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:95)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:324)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:91)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:108)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:101)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:206)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:154)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:481)
at org.jboss.ejb.Container.invoke(Container.java:680)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1026)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:340)
at sun.reflect.GeneratedMethodAccessor88.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)
Here is the ejb-jar.xml file for the jar bundle(never mind the bad design with CMP directly exposed to the clients without a session beans layer - it's just a test):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
Profile CMP
<display-name>MDBean</display-name>
<enterprise-beans>
<ejb-name>EventBean</ejb-name>
<local-home>com.inquent.iqos.ejb.Profile.EventLocalHome</local-home>
com.inquent.iqos.ejb.Profile.EventLocal
<ejb-class>com.inquent.iqos.ejb.Profile.EventBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
False
<cmp-version>2.x</cmp-version>
<abstract-schema-name>ProcEvent</abstract-schema-name>
<cmp-field>
<field-name>eventID</field-name>
</cmp-field>
<cmp-field>
<field-name>eventName</field-name>
</cmp-field>
<primkey-field>eventID</primkey-field>
<ejb-name>ProfileBean</ejb-name>
<local-home>com.inquent.iqos.ejb.Profile.ProfileLocalHome</local-home>
com.inquent.iqos.ejb.Profile.ProfileLocal
com.inquent.iqos.ejb.Profile.ProfileHome
com.inquent.iqos.ejb.Profile.ProfileRemote
<ejb-class>com.inquent.iqos.ejb.Profile.ProfileBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.inquent.iqos.ejb.Profile.ProfilePK</prim-key-class>
False
<cmp-version>2.x</cmp-version>
<abstract-schema-name>ProcEventProfile</abstract-schema-name>
<cmp-field>
<field-name>permissionID</field-name>
</cmp-field>
<cmp-field>
<field-name>profileCondition</field-name>
</cmp-field>
<cmp-field>
<field-name>eventID</field-name>
</cmp-field>
<cmp-field>
<field-name>order</field-name>
</cmp-field>
<query-method>
<method-name>findProfiles</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</query-method>
<ejb-ql>
</ejb-ql>
<ejb-local-ref>
<ejb-ref-name>ejb/EventBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.inquent.iqos.ejb.Profile.EventLocalHome</local-home>
com.inquent.iqos.ejb.Profile.EventLocal
<ejb-link>EventBean</ejb-link>
</ejb-local-ref>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<ejb-name>ProfileBean</ejb-name>
<method-name>*</method-name>
<ejb-name>EventBean</ejb-name>
<method-name>*</method-name>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Does anybody know anything about this problem? Is this a known-bug or am I doing something wrong?
I don't have this problem with session beans, they are correctly redeployed. Only entity beans return ClassCastException during redeployment.
Thanks a lot for your help