'org.springframework.aop.framework.AopConfigException Error in WebLogic 12c

I am in the process of upgrading WebLogic Server 11g (10.3.6.0) to 12c (12.2.1.3.0).

I installed the war file without a problem onto the 12c server. Then, I tried to start the module. I was getting weblogic.application.ModuleException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.aop.framework.AopConfigException error due to missing a particular class file. It seems like the class file belongs to "spring-aop-2.5.2.jar."

When I deployed the same war file onto the WebLogic Server 11g environment, I did not observe any problem. I ensured that "spring-aop-2.5.2.jar" exists in the war file. I am using the version 2.5.2 for the SpringFramework. I suspect it may also be a problem.

Based on my research, some people suggested to append <package-name>net.sf.cglib.*</package-name> into the to <prefer-application-packages> in your weblogic-application.xml. I do not have the weblogic-application.xml in my project or in the war file. I only see the file on the server. Although I appended the tag into weblogic-application.xml, I am still geting the same error.

Should I configure anything else based on my description? Any idea?



Solution 1:[1]

Having the same issue, I got it to work by putting both spring and cglib jars in the ear APP-INF/lib folder and using the following META-INF/weblogic-application.xml

<?xml version='1.0' encoding='UTF-8'?>
<weblogic-application xmlns="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.3/weblogic-application.xsd">
    <prefer-application-packages>
        <package-name>net.sf.cglib.*</package-name>
        <package-name>org.springframework.*</package-name>
    </prefer-application-packages>
</weblogic-application>

From my understanding, it's important that:

  • Both cglib and spring jars are in the same classpath folder
  • Both are present in "prefer-application-packages"

Using "prefer-application-packages" in weblogic.xml inside my .war file did not seem to work for some reason.

Solution 2:[2]

You should modify your weblogic.xml file to use the proper libraries with prefer-application-packages. However, do not forget to include this.

<prefer-web-inf-classes>false</prefer-web-inf-classes>

Oracle states here

Note that in order to use prefer-application-packages or prefer-application-resources, prefer-web-inf-classes must be set to false.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 p91paul
Solution 2 rcastellcastell