It's all about the answers!

Ask a question

java.lang.ClassCastException: com.ibm.wbit.al.config.impl.ALConfigPackageImpl incompatible with org.eclipse.emf.ecore.EPackage


Ruifeng Ma (1112) | asked Jan 08 '16, 4:04 a.m.
 Encountered below strange ClassCastException when implementing RTC plain java libs on a WAS8.5 server.

[1/8/16 16:40:33:329 SGT] 000000ed RTCWorkItemHa E com.ibm.gpo.test.resources.RTCWorkItemHandler establishRTCClient java.lang.ClassCastException: com.ibm.wbit.al.config.impl.ALConfigPackageImpl incompatible with org.eclipse.emf.ecore.EPackage
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform$1.handleExtensionAdded(InternalTeamPlatform.java:284)
at com.ibm.team.repository.common.util.ExtensionReader.internalReadElement(ExtensionReader.java:202)
at com.ibm.team.repository.common.util.ExtensionReader.readRegistry(ExtensionReader.java:350)
at com.ibm.team.repository.common.util.ExtensionReader.start(ExtensionReader.java:380)
at com.ibm.team.repository.common.util.ExtensionReader.earlyStart(ExtensionReader.java:127)
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.initializeGeneratedPackages(InternalTeamPlatform.java:317)
at com.ibm.team.repository.common.internal.util.InternalTeamPlatform.start(InternalTeamPlatform.java:108)
at com.ibm.team.repository.client.TeamPlatform.startup(TeamPlatform.java:50)
at com.ibm.gpo.test.utils.rtc.RTCClient.<init>(RTCClient.java:104)
at com.ibm.gpo.test.resources.RTCWorkItemHandler.establishRTCClient(RTCWorkItemHandler.java:133)
	
It seems to be a class loading issue. As the problematic code snippet is as below:
	
            protected boolean handleExtensionAdded(IConfigurationElement element {
	
            if(element.getName().equals("package"))
            {
                String packageURI = element.getAttribute("uri");
                String className = element.getAttribute("class");
                if(packageURI != null && className != null)
                {
                    if(org.eclipse.emf.ecore.EPackage.Registry.INSTANCE.get(packageURI) != null)
                        return true;
                    EPackage ePackage = null;
                    try
                    {
                        Class javaClass = getClass().getClassLoader().loadClass(className);
                        Field field = javaClass.getField("eINSTANCE");
                        ePackage = (EPackage)field.get(null);
                    }
                    catch(ClassNotFoundException _ex) { }
                    catch(IllegalAccessException _ex) { }
                    catch(NoSuchFieldException _ex) { }
                    if(ePackage != null)
                        org.eclipse.emf.ecore.EPackage.Registry.INSTANCE.put(packageURI, ePackage);
                }
            }
            return true;
        }
	
The code can't be changed as it's part of the RTC jar. Can this be worked around in other ways?
	

Comments
Donald Nong commented Jan 08 '16, 4:34 a.m. | edited Jan 08 '16, 4:37 a.m.

Have you checked what's passed to the below two APIs?

at com.ibm.gpo.test.utils.rtc.RTCClient.<init>(RTCClient.java:104)
at com.ibm.gpo.test.resources.RTCWorkItemHandler.establishRTCClient(RTCWorkItemHandler.java:133)

The involved API should be from IBM Integration Designer. Does it ring a bell?


Ruifeng Ma commented Jan 08 '16, 4:52 a.m.

 The APIs were written locally and called through a simple REST client like postman. The code used to work properly on my local WAS server until I installed IBM Business Process Manager onto the server. Not sure any plug-ins added or properties changed by BPM could cause this issue. 


Ruifeng Ma commented Jan 08 '16, 4:55 a.m. | edited Jan 08 '16, 5:01 a.m.

<Removed duplicate comment entry>


Ruifeng Ma commented Jan 08 '16, 4:56 a.m. | edited Jan 08 '16, 5:01 a.m.

<Removed duplicate comment entry>


Donald Nong commented Jan 08 '16, 5:01 a.m.

Does the installation of IBM Business Process Manager require adding any shared library in the WAS server? Generally speaking, using the "parent last" class loading policy should give you better application isolation, but it still depends on how the application is designed.


Ruifeng Ma commented Jan 08 '16, 5:51 a.m.

 No. The installation did not require any manual addition of new shared library to the WAS server. The class loading policy has been configured before as you suggested. I even tried to package all the RTC plain jars to a shared library and let my application reference it such that WAS server can refer to it using an isolated class loader. The approach didn't help either. 


Donald Nong commented Jan 10 '16, 5:59 p.m.

If you're still struggling with that, I suggest you contact Support, preferably WebSphere as that's a class loading issue.

showing 5 of 7 show 2 more comments

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.