java.lang.ClassCastException: com.jboss.examples.logger.reference.Log4JLogger cannot be cast to com.jboss.examples.logger.Logger in JBoss EAP 6

Solution Unverified - Updated -

Issue

  • We have two applications, if we only deploy one of them, there is no issue, but if we deploy both of them, we get the ClassCastException as shown below on JBoss EAP 6.
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/example].[jsp]] (ajp-app01/192.168.1.100:8009-4) Servlet.service() for servlet jsp threw exception: java.lang.ClassCastException: com.jboss.examples.logger.reference.Log4JLogger cannot be cast to com.jboss.examples.logger.Logger
    at com.jboss.examples.logger.reference.Log4JLogFactory.getLogger(Log4JLogFactory.java:88) [example-logger.jar:1.0.0]
    at com.jboss.examples.app.LogUtil.getLogger(ESAPI.java:154) [example-app.jar:1.0.0]
    at com.jboss.examples.app.ExampleApp.<init>(ExampleApp.java:15) [example-app.jar:1.0.0]
    ...

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content