Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weblogic 10.3.5 Overriding Spring Version

I am developing a web application using Oracle's OEPE distribution, including Weblogic server 10.3.5. WLS includes its own version of Spring, which appears to be 2.5.6.SEC01. However, we are trying to use Spring and Spring Security features specific to the 3.1 release.

The Maven POM defines the Spring Version as a property to be 3.1.1.RELEASE (with that property plugged in to the sections, i.e.:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
</dependency>

I've try two separate ways in weblogic.xml of excluding the built-in Spring (one is commented out below, but rest assured I've tried both):

<wls:container-descriptor>
    <wls:prefer-application-packages>
        <wls:package-name>com.oracle.ojdbc16.*</wls:package-name>
        <wls:package-name>antlr.*</wls:package-name>
        <wls:package-name>javax.persistence.*</wls:package-name>
        <wls:package-name>org.apache.commons.*</wls:package-name>
        <wls:package-name>org.springframework.*</wls:package-name>
        <wls:package-name>org.hibernate.*</wls:package-name>
        <wls:package-name>org.apache.xerces.*</wls:package-name>
    </wls:prefer-application-packages>
    <!-- <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes> -->
</wls:container-descriptor>

What in the world do I have to do to use my own version of Spring?

like image 260
Jason Avatar asked Jul 13 '12 19:07

Jason


2 Answers

I had the same problem. The solution was to create weblogic-application.xml into the META-INF folder of EAR project. Here is the code.

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application>
    <prefer-application-packages>
        <package-name>org.apache.*</package-name>
        <package-name>org.springframework.*</package-name>
    </prefer-application-packages>
</weblogic-application>

Maybe your problem is that you're using weblogic.xml into WAR project instead of weblogic-application.xml into EAR project.

Hope it helps.

like image 62
jalcalav Avatar answered Oct 03 '22 19:10

jalcalav


OPTION1: Deploy your Spring 3.x app to a wls server in a domain that does not have JRF installed. That works for me.

OPTION2: use prefer-web-inf-classes in weblogic.xml and deploy as a war. This worked for me with wls 10.3.6, JRF domain, Spring 3.2.2. I couldn't get prefer-application-packages to work, but prefer-web-inf-classes did.

NOTES: With a domain that does have JRF installed, I've tried both the war/weblogic.xml/prefer-application-packages and ear/weblogic-application.xml/prefer-application-packages approaches and neither seems effective. I have a test jsp that outputs org.springframework.core.SpringVersion.getVersion() and it persists in reporting 2.5.6.SEC01 despite my efforts (this is the version of Spring bundled in the oracle_common/modules folder).

Deploy the same app in a non-JRF domain though, and org.springframework.core.SpringVersion.getVersion() will report whatever version of spring you bundled with your app.

like image 27
Jaffadog Avatar answered Oct 03 '22 17:10

Jaffadog