3
votes

When i deploy .ear file on weblogic 12c, it is giving following error.

java.lang.ClassNotFoundException: com.abc.util.CustomUtility
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:335)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:302)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:180)


<Administration Console encountered the following error: weblogic.application.WrappedDeploymentException: com.abc.util.CustomUtility
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:335)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:302)

As soon as I deploy .ear file, it is giving the above error. It's complaining about ClassNotFoundException which is a user-defined class in the project.

I see all .classes are part of .ear file. Still why this issue comes up ?

Please help me on this.

2

2 Answers

3
votes

I've seen this problem when I have utility classes defined on several projects. The .class are in the .ear, but the app doesn't find it.

In my case the problem was solved adding the missing class project to the manifest file.

0
votes

The accepted answer didn't solve our problem. We solved it by adding the packages (of the missing classes) to the prefer-application-packages section in the weblogic-application.xml

    <!-- to load classes of the packages from application context first and not from server context.  -->
    <prefer-application-packages>
        <package-name>antlr.*</package-name>
        <package-name>org.apache.*</package-name>
        <package-name>org.hibernate.*</package-name>
        <package-name>org.springframework.*</package-name>
        <package-name>org.aopalliance.*</package-name>
        <package-name>org.objectweb.*</package-name>
        <package-name>net.sf.cglib.*</package-name>
        ...
    </prefer-application-packages>
</weblogic-application>