0 Replies Latest reply on Oct 23, 2012 6:18 AM by Stylianos Koussouris

    Multiple WAR Classloading ClassCastException

    Stylianos Koussouris Newbie
      • We have multiple Liferay Portlets deployed as separate .war deployments in JBoss 7
      • All rely on  library x.jar
      • All carry the library x.jar in WEB-INF/lib (Liferay deployment puts this automatically through declared dependencies per portlet)
      • When an object from x.jar is nstantiated by Portlet A using the x.jar libray and then calls an exposed functionality in Portlet B which also relies on the same x.jar library functionality (ie. new instantiation) results in ClassCastException (Factory Method does the instantiation inside x.jar)


      We have figured out that at the point where the library (not controlled by us) casts to the appopriate implementation the classloader is mixed up and therefore we get the exception.


      I have read the following






      although I see that between EAR deployments you can share dependencies and hence the classloader the same I am not certain can be said for WAR deployments. Is there a way we can put the libray in one WAR and share the dependency/classloader from the others?


      Note we cannot change the deployment structure as this is dictated by Liferay compile/deployment process.