class cast在weblogic中的异常 [英] class cast exception in weblogic

查看:158
本文介绍了class cast在weblogic中的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个web应用程序(WAR文件)使用泽西jars.Now当我试图部署这我得到类转换异常(一些引导servlet使用泽西岛)。在分析我发现weblogic本身有泽西罐在common \modules..and我的网络应用程序有不同版本的泽西罐。现在如果我删除common / modules jersey jar然后我的web应用程序被部署。我想知道如何可以让我的web应用程序使用自己的版本的jersey jars,使其得到部署,而不删除common / module jars ..
PS我的.war文件没有weblogic.xml,weblogic正在生成它。

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.

推荐答案

Get由WebLogic即时生成的 weblogic.xml 并修改它添加:

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>

现在确保在war文件中有这个weblogic.xml并重新部署应用程序。

Now make sure to have this weblogic.xml in your war file and redeploy the application.

将prefer-web-inf-classes设置为true 会优先选择应用程序的WEB-INF目录中的类。

Setting prefer-web-inf-classes to true will give preference to the classes present in the application's WEB-INF directory.

-web-inf-classes 可能无法正常工作。如果您使用的是10.3.4+的WebLogic版本,请使用remove prefer-web-inf-classes设置并使用 prefer-application-packages 。也可以通过有关如何在WebLogic中加载类的视频。

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.

这篇关于class cast在weblogic中的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆