5 Replies Latest reply: Sep 30, 2013 5:17 PM by user9978059 RSS

    Upgrade to 12c causing error on server startup with class loading

    user9978059

      Upgrading an existing application from 11g R2 to 12c (12.1.2) is causing an error on running it from JDev Integrated Weblogic Server giving following exception.

       

      Sep 27, 2013 2:11:59 PM EDT> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "APP" due to error weblogic.application.ModuleException: weblogic.utils.compiler.ToolFailureException: Neither <prefer-application-packages> nor <prefer-application-resources> can be specified when <prefer-web-inf-classes> is turned on in weblogic.xml

      weblogic.application.ModuleException: weblogic.utils.compiler.ToolFailureException: Neither <prefer-application-packages> nor <prefer-application-resources> can be specified when <prefer-web-inf-classes> is turned on in weblogic.xml

          at weblogic.servlet.internal.WebAppModule.initFilterClassLoader(WebAppModule.java:404)

          at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:260)

          at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:681)

          at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)

          at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)

          Truncated. see log file for complete stacktrace

       

      However, <prefer-application-packages>  and <prefer-application-resources> are not specified in weblogic.xml or weblogic-application.xml. see below.


      Only <prefer-web-inf-classes>true</prefer-web-inf-classes> is specified in weblogic.xml.

       

      Where is the classloader picking <prefer-application-packages>  and <prefer-application-resources> from??


      weblogic.xml


      <?xml version = '1.0' encoding = 'windows-1252'?>

      <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                        xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd"

                        xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">

         <context-root>NGRP</context-root>

        <library-ref>

            <library-name>adf.oracle.domain.webapp</library-name>

         </library-ref>

         <library-ref>

            <library-name>jstl</library-name>

            <specification-version>1.2</specification-version>

         </library-ref>

         <library-ref>

            <library-name>jsf</library-name>

            <specification-version>2.0</specification-version>

         </library-ref>

         <container-descriptor>

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

         </container-descriptor>

      </weblogic-web-app>

       

      weblogic-application.xml.


       

      <?xml version = '1.0' encoding = 'windows-1252'?>

      <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.1/weblogic-application.xsd"

                            xmlns="http://xmlns.oracle.com/weblogic/weblogic-application">

        <listener>

          <listener-class>oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener</listener-class>

        </listener>

        <listener>

          <listener-class>oracle.mds.lcm.weblogic.WLLifecycleListener</listener-class>

        </listener>

        <library-ref>

          <library-name>adf.oracle.domain</library-name>

        </library-ref>

      </weblogic-application>

       

      Any help?

        • 1. Re: Upgrade to 12c causing error on server startup with class loading
          Timo Hahn

          User,  the parts of the weblogic.xml and the other descriptors are from the ear file or from your workspace?

           

          If they are from your workspace, Bild an ear for the application and unpack the ear into a temporary folder. Then check all the descriptors of the ear and the wat file, which you have to unpack too.

          Jdev is known to change the descriptors when you build an ear or deploy directly to the server.

           

          Timo

          • 2. Re: Upgrade to 12c causing error on server startup with class loading
            user9978059

            Hi Timo, appreciate your response.

            Looking at the descriptors in build , they are slightly different , but classloader preferences does look the same. <prefer-web-inf-classes>true</prefer-web-inf-classes> . I still get the exception Neither <prefer-application-packages> nor <prefer-application-resources> can be specified when <prefer-web-inf-classes> is turned on in weblogic.xml.


            Below is the weblogic.xml and weblogic-application.xml from the build.

             

            weblogic.xml

             

            <?xml version = '1.0' encoding = 'windows-1252'?>

            <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                              xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd"

                              xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">

               <context-root>APP</context-root>

              <library-ref>

                  <library-name>adf.oracle.domain.webapp</library-name>

               </library-ref>

               <library-ref>

                  <library-name>jstl</library-name>

                  <specification-version>1.2</specification-version>

               </library-ref>

               <library-ref>

                  <library-name>jsf</library-name>

                  <specification-version>2.0</specification-version>

               </library-ref>

               <container-descriptor>

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

               </container-descriptor>

               <jsp-descriptor>

                  <keepgenerated>

                     false

                  </keepgenerated>   

               </jsp-descriptor>

            </weblogic-web-app>

             

            weblogic-application.xml

             

            <?xml version = '1.0' encoding = 'windows-1252'?>

            <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.1/weblogic-application.xsd"

                                  xmlns="http://xmlns.oracle.com/weblogic/weblogic-application">

              <xml>

                <parser-factory>

                  <saxparser-factory>oracle.xml.jaxp.JXSAXParserFactory</saxparser-factory>

                  <document-builder-factory>oracle.xml.jaxp.JXDocumentBuilderFactory</document-builder-factory>

                  <transformer-factory>oracle.xml.jaxp.JXSAXTransformerFactory</transformer-factory>

                </parser-factory>

              </xml>

              <application-param>

                <param-name>jps.credstore.migration</param-name>

                <param-value>OVERWRITE</param-value>

              </application-param>

              <application-param>

                <param-name>jps.policystore.migration</param-name>

                <param-value>OVERWRITE</param-value>

              </application-param>

              <listener>

                <listener-class>oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener</listener-class>

              </listener>

              <listener>

                <listener-class>oracle.mds.lcm.weblogic.WLLifecycleListener</listener-class>

              </listener>

              <listener>

                <listener-class>oracle.security.jps.wls.listeners.JpsApplicationLifecycleListener</listener-class>

              </listener>

              <library-ref>

                <library-name>adf.oracle.domain</library-name>

              </library-ref>

              <library-ref>

                <library-name>oracle.jsp.next</library-name>

              </library-ref>

            </weblogic-application>

             

             

            Thanks

            • 3. Re: Upgrade to 12c causing error on server startup with class loading
              Timo Hahn

              The

                 <container-descriptor>

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

                 </container-descriptor>

              is in the weblogic.xml and somehow interfere with other configuration. Question is, why is the prefer-web-inf-classes there at all?

              As neither you nor me know where the other configurations are, you can tackle the problem the other way around. Instead of using the prefer-web-inf-classes use the prefer-application-packages for the classes which should be used from your application.

               

              Timo

              • 4. Re: Upgrade to 12c causing error on server startup with class loading
                dvohra21

                <Error> <Deployer> <BEA-149205> <Failed to initialize the application "APP" due to error weblogic.application.ModuleException: weblogic.utils.compiler.ToolFailureException: Neither <prefer-application-packages> nor <prefer-application-resources> can be specified when <prefer-web-inf-classes> is turned on in weblogic.xml


                What is an exception should be a Note as in the documentation.

                weblogic.xml Deployment Descriptor Elements - 12c Release 1 (12.1.1)

                • 5. Re: Upgrade to 12c causing error on server startup with class loading
                  user9978059

                  Hi Timo,

                   

                  Tried using prefer-application-packages in weblogic.xml for application libraries. Server startup did go further than it was earlier. However, having prefer-application-packages seems to interfere with the loading of Weblogic libraries itself (eg. libraries in Oracle_Home\oracle_common\modules) and is expecting me to add all Weblogic specific libraries in weblogic.xml, failing which is causing classnotfoundexception on weblogic library classes.

                   

                  Below is my weblogic.xml and as you can see i ended up adding jps security related libraries. Is there a better way of workaround to configure all weblogic libraries to be not specified in this manner?

                   

                  the following weblogic.xml resulted in exception below..

                   

                  <Sep 30, 2013 6:02:26 PM EDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004

                  weblogic.application.ModuleException: java.lang.NoClassDefFoundError: Could not initialize class oracle.security.jps.internal.common.util.JpsCommonUtil

                      at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)

                      at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)

                      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)

                      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)

                      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)

                      Truncated. see log file for complete stacktrace

                  Caused By: java.lang.NoClassDefFoundError: Could not initialize class oracle.security.jps.internal.common.util.JpsCommonUtil

                   

                   

                   

                  <?xml version = '1.0' encoding = 'windows-1252'?>

                  <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                    xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd"

                                    xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">

                      <context-root>APP</context-root>

                      <library-ref>

                          <library-name>adf.oracle.domain.webapp</library-name>

                      </library-ref>

                      <library-ref>

                          <library-name>jstl</library-name>

                          <specification-version>1.2</specification-version>

                      </library-ref>

                      <library-ref>

                          <library-name>jsf</library-name>

                          <specification-version>2.0</specification-version>

                      </library-ref>

                      <container-descriptor>

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

                          <prefer-application-packages>

                              <package-name>org.aopalliance.*</package-name>

                              <package-name>org.aspectj.*</package-name>

                              <package-name>org.eclipse.*</package-name>

                              <package-name>org.osgi.*</package-name>

                              <package-name>com.adminserver.bll.*</package-name>

                              <package-name>com.adminserver.bll.*</package-name>

                              <!--aspectjweaver-->

                              <package-name>org.aspectj.apache*</package-name>

                              <package-name>org.aspectj.asm.*</package-name>

                              <package-name>org.aspectj.bridge.*</package-name>

                              <package-name>org.aspectj.internal.*</package-name>

                              <package-name>org.aspectj.lang.*</package-name>

                              <package-name>org.aspectj.runtime.*</package-name>

                              <package-name>org.aspectj.util.*</package-name>

                              <package-name>org.aspectj.weaver.*</package-name>

                              <package-name>net.sf.cglib.*</package-name>

                              <!-- coherence skipped-->

                              <package-name>org.apache.commons.*</package-name>

                              <package-name>org.dom4j.*</package-name>

                              <!--  <package-name>org.eclipse.persistence.*</package-name>

                                              <package-name>javax.persistence.*</package-name>-->

                              <package-name>commonj.sdo.impl.*</package-name>

                              <package-name>com.sun.el.*</package-name>

                              <package-name>org.apache.taglibs.*</package-name>

                              <package-name>javax.servlet.jsp.jstl.*</package-name>

                              <package-name>org.iso_relax.*</package-name>

                              <package-name>org.codehaus.janino.*</package-name>

                              <!-- Javax.jsp-->

                              <!--    <package-name>javax.servlet.jsp.*</package-name>

                                                    <package-name>javax.el.*</package-name>-->

                              <package-name>org.eclipse.persistence.*</package-name>

                              <package-name>org.osgi.service.*</package-name>

                              <!-- Javax.servlet-->

                              <!--   <package-name>javax.servlet.*</package-name>-->

                              <package-name>org.apache.taglibs.standard.*</package-name>

                              <package-name>org.jaxen.*</package-name>

                              <package-name>org.w3c.dom.*</package-name>

                              <package-name>org.jdom.*</package-name>

                              <package-name>org.nfunk.jep.*</package-name>

                              <package-name>com.jcraft.jsch.*</package-name>

                              <package-name>org.apache.log4j.*</package-name>

                              <package-name>com.sun.msv.*</package-name>

                              <package-name>oracle.jdbc.*</package-name>

                              <package-name>oracle.core.*</package-name>

                              <package-name>oracle.jpub.*</package-name>

                              <package-name>oracle.net.*</package-name>

                              <package-name>oracle.security.*</package-name>

                              <package-name>oracle.sql.*</package-name>

                              <package-name>net.sf.saxon.*</package-name>

                              <!--<package-name>javax.servlet.*</package-name>-->

                              <package-name>org.springframework.aop.*</package-name>

                              <package-name>org.springframework.asm.*</package-name>

                              <package-name>org.springframework.beans.*</package-name>

                              <package-name>org.springframework.*</package-name>

                              <package-name>org.springframework.core.*</package-name>

                              <package-name>org.springframework.util.*</package-name>

                              <package-name>org.springframework.expression.*</package-name>

                              <package-name>org.springframework.jdbc.*</package-name>

                              <package-name>org.springframework.orm.*</package-name>

                              <package-name>org.springframework.dao.*</package-name>

                              <package-name>org.springframework.jca.*</package-name>

                              <package-name>org.springframework.transaction.*</package-name>

                              <package-name>org.springframework.http.*</package-name>

                              <package-name>org.springframework.remoting.*</package-name>

                              <package-name>org.springframework.web.*</package-name>

                              <package-name>org.apache.bcel.*</package-name>

                              <package-name>org.apache.regexp.*</package-name>

                              <package-name>org.apache.xalan.*</package-name>

                              <package-name>org.apache.xml.*</package-name>

                              <package-name>org.apache.xpath.*</package-name>

                              <package-name>java_cup.runtime.*</package-name>

                              <package-name>com.sun.msv.*</package-name>

                              <package-name>com.sun.xml.*</package-name>

                              <!--<package-name>oracle.*</package-name>-->

                              <package-name>oracle.security.wls.oamagent.OAMAgentWrapperFilter</package-name>

                              <package-name>oracle.security.wls.*</package-name>

                              <package-name>oracle.security.jps.ee.http.*</package-name>

                                <package-name>oracle.security.jps.util.*</package-name>

                                <package-name>oracle.security.*</package-name>

                          </prefer-application-packages>

                      </container-descriptor>

                  </weblogic-web-app>