开发者

WAR loads differently on weblogic when inside an EAR, why?

开发者 https://www.devze.com 2023-03-22 05:37 出处:网络
How does WebLogic 11g load libraries in an EAR file? I have this problem with a web application, that when deployed as a WAR (with libraries it depends on in WEB-INF/lib), it works just fine. However,

How does WebLogic 11g load libraries in an EAR file? I have this problem with a web application, that when deployed as a WAR (with libraries it depends on in WEB-INF/lib), it works just fine. However, when it's inside an EAR file, WebLogic does not find those libraries unless I put them in APP-INF/lib. Does that mean that if I'm deploying as an EAR I'd have to pull out all JAR files from the WEB-INF/lib directory and 开发者_运维知识库place them in APP-INF/lib ? or is there a configuration that can be done in WebLogic to avoid this?

Thanks!


If you have JAR files that you need to share between multiple WAR files or between WAR files and EAR files then you will need to package them in the EAR.

If WAR#1 has a JAR in its WEB-INF/lib and is packaged in an EAR with WAR#2, then WAR#2 will not be able to see the JAR files in WAR#1/WEB-INF/lib.


Solving your problem will take some understanding of how Java EE classloading works in a container. You should look at this link to get an understanding, but the basic problem is that when you package your application as an EAR, you've introduced another classloader (the application classloader) into the class loading hierarchy. You can configure WebLogic to load from your webapp by using the prefer-web-inf-classes element.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号