Thursday Mar 28, 2013

ClassCastException thrown when running Coherence with Exabus IMB enabled

Today I worked a Service Request which was a Coherence issue on an Exalogic platform. It is a very interesting issue (at least for me ).

An exception message like the following is thrown when running Coherence with IMB on a WLS server:
java.lang.ClassCastException: com.oracle.common.net.exabus.util.SimpleEvent
at com.tangosol.coherence.component.net.MessageHandler$EventCollector.add(MessageHandler.CDB:6)
at com.oracle.common.net.infinibus.InfiniBus.emitEvent(InfiniBus.java:323)
at com.oracle.common.net.infinibus.InfiniBus.handleEventOpen(InfiniBus.java:502)
at com.oracle.common.net.infinibus.InfiniBus.deliverEvents(InfiniBus.java:468)
at com.oracle.common.net.infinibus.EventDeliveryService$WorkerThread.run(EventDeliveryService.java:126)

The cause of this problem is that Coherence runs into a classloading issue when:
- using to enforce the child-first classloading
- coherence.jar is both in the system classpath and application classpath
- and Exabus IMB is enabled

In newer versions of WLS (12c), coherence.jar is in system classpath, so by default Coherence classes will be loaded from the system classpath. For situations where is required child first class loading semantics, and should be specified over configuration inside weblogic.xml to change the classloading order.

To solve this, add the following into weblogic.xml:
<container-descriptor>
  <prefer-application-packages>
    <package-name>com.tangosol.*</package-name>
    <package-name>com.oracle.common.**</package-name>
  </prefer-application-packages>
  <prefer-application-resources>
    <resource-name>com.tangosol.*</resource-name>
    <resource-name>com.oracle.common.*</resource-name>
    <resource-name>coherence-*.xml</resource-name>
    <resource-name>coherence-*.xsd</resource-name>
    <resource-name>tangosol-*.xml</resource-name>
    <resource-name>tangosol.properties</resource-name>
    <resource-name>tangosol.cer</resource-name>
    <resource-name>tangosol.dat</resource-name>
    <resource-name>internal-txn-cache-config.xml</resource-name>
    <resource-name>txn-pof-config.xml</resource-name>
    <resource-name>pof-config.xml</resource-name>
    <resource-name>management-config.xml</resource-name>
    <resource-name>processor-dictionary.xml</resource-name>
    <resource-name>reports/*</resource-name>
  </prefer-application-resources>
</container-descriptor>
About


Principal Technical Support Engineer in the Exalogic Enterprise Support Team (EEST).

Search

Archives
« March 2013 »
SunMonTueWedThuFriSat
     
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
29
30
31
      
Today