class cast exception in weblogic

北慕城南 提交于 2019-12-19 21:20:40

问题


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:


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.



来源:https://stackoverflow.com/questions/13375185/class-cast-exception-in-weblogic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!