I am getting a ClassCastException when using the CMP 2.x jdbc2 PM for one of my entity beans in JBoss.

Solution Verified - Updated -

Issue

  • We tried to define this bean as a "Standard Pessimistic CMP 2.x EntityBean" but then we get ClassCastExceptions while deploying because it then uses a JDBCStoreManager which is incompatible to the JDBCStoreManager2 of the new persistence manager.

  • You see the following exception in your server.log:

    12:04:02,089 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EjbModule,module=xxxxx-2.8.1.jar
    java.lang.ClassCastException:
     org.jboss.ejb.plugins.cmp.jdbc2.JDBCStoreManager2 cannot be cast to 
    org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:386)
            at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
            at org.jboss.ejb.EjbModule.startService(EjbModule.java:414)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 4.x
  • Enterprise Java Bean (EJB) 2.1 Container Managed Persistence (CMP) Entity Beans
  • Enterprise Java Bean (EJB) 2.1 Bean-Managed Persistence (BMP) Entity Beans

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.