2 Ekim 2014 Perşembe

java.lang.ClassCastException and org.omg.stub.javax.ejb._EJBHome_Stub in Websphere Application Server

Root Cause of the error :

The One EJB application throws below exception .

Caused by: java.lang.ClassCastException: org.omg.stub.javax.ejb._EJBHome_Stub incompatible with some.internal.class.of.an.app

        at pagecode.sso.faces.SSOsystems.lookUpSSOIsletimRemote(SSOsystems.java:52)
        at pagecode.sso.faces.SSOsystems.getSSOSistemList(SSOsystems.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:619)
        at javax.el.BeanELResolver.getValue(BeanELResolver.java:91)


A solution for us : 

Check whether the class callled some.internal.class.of.an.app is used by another apps in the environment or not .
If it is used and If it exists more than one directory . Check they are all same .

If one jar contains this class ,and if this jar exists more than one directory  ,  ensure that  the jar is same for all of them. InCompatibility may refer to version difference of jar , or same class is not actually same in different directory.  It may be updated in one place but it may not in another.

If this jar is used by many applications from different directories such as WEB-INF/lib. Then remove them from WEB-INF/lib and define shared library  for this jar in websphere environment and therefore put only one of them in order to  keep compatible.

For example ,

The following three applications uses same jar , For this ,  create shared library  or keep them same Otherwise , you may encounter the incompatibility error.

/opt/IBM/WebSphere/AppServer/profiles/Custom01/installedApps/myCell01/myapp1.ear/myWeb1.war/WEB-INF/lib/xyz.jar

/opt/IBM/WebSphere/AppServer/profiles/Custom01/installedApps/myCell01/myapp2.ear/myWeb2.war/WEB-INF/lib/xyz.jar

/opt/IBM/WebSphere/AppServer/profiles/Custom01/installedApps/myCell01/myapp3.ear/myWeb3.war/WEB-INF/lib/xyz.jar







Hiç yorum yok:

Yorum Gönder