EJB failing to start with ClassCastException: $Proxy594 cannot be cast to javax.naming.Context in JBoss EAP 5
Issue
- Migrating EJB application to JBoss EAP 5 is failing to deploy with:
2013-02-26 15:17:57,278 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=jboss.j2ee:jar=example.jar,name=ExampleBean,service=EJB3 state=Create
java.lang.ClassCastException: $Proxy594 cannot be cast to javax.naming.Context
at org.jboss.util.naming.Util.createSubcontext(Util.java:70)
at org.jboss.util.naming.Util.bind(Util.java:104)
at org.jboss.util.naming.Util.bind(Util.java:91)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:932)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:917)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bind(JndiSessionRegistrarBase.java:906)
at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bindEjb(JndiSessionRegistrarBase.java:159)
at org.jboss.ejb3.session.SessionContainer.lockedStart(SessionContainer.java:219)
at org.jboss.ejb3.session.SessionSpecContainer.lockedStart(SessionSpecContainer.java:547)
at org.jboss.ejb3.stateless.StatelessContainer.lockedStart(StatelessContainer.java:194)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:985)
...
The EJB is an EJB3 configured with these annotations:
@Stateless(name="ExampleBean", mappedName="ExampleBean")
@Local({ExampleLocal.class})
@Remote({Example.class})
public class ExampleBean {
...
}
Environment
- JBoss Enterprise Application Platform (EAP)
- 5.x
- JBoss Enterprise SOA Platform (SOA-P)
- 5.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
