WLS 10.3: ClassCastException while compiling or deploying EJB 2.1 with EJB 3.0 descriptor. (Doc ID 1212640.1)

Last updated on MAY 24, 2017

Applies to:

Oracle Weblogic Server - Version 10.0 and later
Information in this document applies to any platform.

Symptoms

If you specify a EJB2.1 style entity bean within a EJB3 version of  ejb-jar.xml, you will notice the below error on appc and also during deployment.

java.lang.ClassCastException: weblogic.j2ee.descriptor.EntityBeanBeanImpl cannot be cast to weblogic.j2ee.descriptor.SessionBeanBean
at weblogic.ejb.container.deployer.CompositeMBeanDescriptor.getBusinessRemotes(CompositeMBeanDescriptor.java:515)
at weblogic.ejb.container.deployer.BeanInfoImpl.<init>(BeanInfoImpl.java:278)
at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.<init>(ClientDrivenBeanInfoImpl.java:149)
at weblogic.ejb.container.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:133)
......


Or in appc compilation:

[wlappc] <Jun 9, 2010 11:56:00 AM PDT> <Info> <J2EE> <BEA-160186> <Compiling EAR module 'xxxxxxxxxxx'>
[wlappc] java.lang.ClassCastException: weblogic.j2ee.descriptor.EntityBeanBeanImpl
[wlappc] at weblogic.ejb.container.deployer.CompositeMBeanDescriptor.getBusinessRemotes(CompositeMBeanDescriptor.java:515)
[wlappc] at weblogic.ejb.container.deployer.BeanInfoImpl.<init>(BeanInfoImpl.java:280)
[wlappc] at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.<init>(ClientDrivenBeanInfoImpl.java:134)
[wlappc] at weblogic.ejb.container.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:131)
[wlappc] at weblogic.ejb.container.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:712)
[wlappc] at weblogic.ejb.container.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:534)
[wlappc] at weblogic.ejb.container.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:235)
....


The ejb-jar.xml schema, for example, would be like:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" metadata-complete="false" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

Changes

N/A.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms