I have a web application (WAR file) which uses jersey jars.Now when i am trying to deploy this i am getting class cast exception(Some bootstrap servlet uses jersey)..On analysis i found that weblogic itself have jersey jars in common\modules..and my web app have different version of jersey jars. Now if i delete the common/modules jersey jar then my web app got deployed.I want to know how can i make my web app to use its own version of jersey jars so that it gets deployed without deleting common/module jars.. PS my .war file don't have weblogic.xml and weblogic is generating it on the fly.
1 Answers
5
votes
Get the weblogic.xml
generated on the fly by WebLogic and modify it to add:
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
Now make sure to have this weblogic.xml in your war file and redeploy the application.
Setting prefer-web-inf-classes to true will give preference to the classes present in the application's WEB-INF directory.
prefer-web-inf-classes
may not work all the time. If you are using a WebLogic version of 10.3.4+ then use remove prefer-web-inf-classes setting and use prefer-application-packages instead. Also go through this video on how classloading in WebLogic works.