kant
kant

Reputation: 157

Wrong library version when moving web application from Tomcat to WebLogic

My java web application was working on Apache Tomcat. It needs some third party libraries for its work (jasperreports 3.7.2 in particular). But now it became necessary to move application on WebLogic. And it appears that it uses not the library it was using before (on Tomcat) but some other version of this library (I suspect that one which comes with WebLogic by default). How can i specify concrete version of library and make WebLogic use it? I've never used weblogic before. May be i should type something in deployment descriptors or something like that? Thanks for your replies.

Upvotes: 0

Views: 867

Answers (1)

JoseK
JoseK

Reputation: 31371

If you have the JAR you want inside WEB-INF/lib in your war, you can tell Weblogic to use that jar over any other jar that might be present in the Classloader.

  • Use the prefer-web-inf-classes element in a weblogic.xml Web application deployment descriptor (that goes in WEB-INF next to the web.xml)

Here is an example weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
 xmlns="http://www.bea.com/ns/weblogic/90"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic- web-app.xsd">
    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
     </container-descriptor>
</weblogic-web-app>

Note: In this usage all WEB_INF/lib classes will be preferred over other versions in the classpath.

Upvotes: 1

Related Questions