10 Replies Latest reply: Sep 25, 2008 2:22 PM by Edwin Biemond RSS

    OC4J: Class not found for class in jar file placed in \j2ee\home\applib\

    hofespet
      I have an ADF application which uses external libraries (jars), which works fine when running the application from within JDeveloper (TP4).
      However if I deploy the application to the embedded OC4J server it won't find any classes imported in those external libraries at runtime (deploy does work). E.g. one library class imports oracle.jbo.server.DBTransaction. If a method of this class is called I get the following exception:
      Unexpected exception caught: java.lang.NoClassDefFoundError, msg=oracle/classloader/util/AnnotatedNoClassDefFoundError 
       oracle/classloader/util/AnnotatedNoClassDefFoundError
      The same exception, when using a german locale, explicitely states that it cannot find oracle.jbo.server.DBTransaction.

      The jar files are placed in the \j2ee\home\applib\ directory and a <library> element to this path is present in application.xml.

      Any further hints what could be wrong?
        • 1. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
          Edwin Biemond
          Hi,

          The production release will use weblogic so don't spend too much time on this issue.

          thanks Edwin
          • 2. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
            hofespet
            Hi Edwin,

            unfortunately I can't wait with this issue for the production release :-( (even if this will be within the next month(s))

            Any other suggestions or hints?

            regards
            • 3. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
              Edwin Biemond
              Ok, you mean the embedded oc4j is working , this is the one you start from jdeveloper.
              and you want to deploy your application to internal oc4j container which is shipped with jdeveloper.

              If you add this library to the server.xml of this oc4j container.

              and try to use -Duser.language=en and -Duser.country=US

              thanks
              • 4. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                hofespet
                Hi Edwin,

                tried your suggestions but without success.

                when I add this library to server.xml then following error occures when starting OC4J
                17.09.2008 17:10:33 oracle.oc4j.util.SystemLog log
                SCHWERWIEGEND: Server start failed processing configuration
                java.lang.InstantiationException: Illegal tag, 'library': The library tag has moved from config/server.xml to config/application.xml, please update your configuration manually or reinstall.
                        at com.evermind.server.XMLApplicationServerConfig.parseDeploymentMainNode(XMLApplicationServerConfig.java:1227)
                        at com.evermind.xml.XMLConfig.parseRootNode(XMLConfig.java:342)
                        at com.evermind.xml.XMLConfig.init(XMLConfig.java:222)
                        at com.evermind.xml.XMLConfig.init(XMLConfig.java:154)
                        at com.evermind.server.XMLApplicationServerConfig.<init>(XMLApplicationServerConfig.java:237)
                        at com.evermind.server.ApplicationServer.createConfig(ApplicationServer.java:661)
                        at oracle.oc4j.server.ServerFactory$Worker.prepareConfig(ApplicationServerFactory.java:225)
                        at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:244)
                        at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
                        at java.lang.Thread.run(Thread.java:619)
                17.09.2008 17:10:33 oracle.oc4j.util.SystemLog logNoStack
                SCHWERWIEGEND: Server exiting: ApplicationServer entered state EXITING
                --> I added this to application.xml

                Than I enabled more logging of classloader "-Duser.country=US -Dclass.load.log.level=finest"

                Here a snippet of the output at starttime of OC4J:
                ================================
                08/09/18 10:17:07 Initial class loaders created. Uptime: 3156ms.
                08/09/18 10:17:07 Loading main class com.evermind.server.OC4JServer...
                08/09/18 10:17:07 com.evermind.server.OC4JServerMain class loaded. Uptime: 3344ms.
                08/09/18 10:17:07 Transferring to com.evermind.server.OC4JServer.main()...
                08/09/18 10:17:15 Ignoring non-existent code source: D:\oracle\jdevstudio1111_preview4_standalone\j2ee\home\config\..\..\..\BC4J\lib\jmxdc.jar(from <code-source> (ignore manifest Class-Path) in /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/config/server.xml)
                08/09/18 10:17:15 Ignoring <code-source> (ignore manifest Class-Path) in /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/config/server.xml entry: code-source /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/lib/api-ext/adflogginghandler.jar (from system property api.ext.dirs) is already visible in the search path of adf.oracle.domain:11.1.4949.
                08/09/18 10:17:15 Ignoring non-existent code source: D:\oracle\jdevstudio1111_preview4_standalone\j2ee\home\config\..\..\..\BC4J\lib\jmxdc.jar(from <code-source> (ignore manifest Class-Path) in /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/config/server.xml)
                08/09/18 10:17:15 Import was not resolved for adf.oracle.domain:11.1.4949: shared library "oracle.fabric.runtime" could not be found.
                08/09/18 10:17:15 Import was not resolved for adf.generic.domain:11.1.4949: shared library "oracle.fabric.runtime" could not be found.
                Seems that oracle.fabric.runtime couldn't be found but the jar's are located in D:\oracle\jdevstudio1111_preview4_standalone\lib\java\shared\oracle.fabric.runtime\11.1.1.0.0

                It's the same as with my jdeveloper installation where I don't have this problems.

                regards
                Peter
                • 5. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                  Edwin Biemond
                  Hi,

                  Can you make a little test case with the external jar and send it to biemond dot gmail dot com

                  thanks Edwin
                  • 6. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                    640239
                    Hi

                    I had this problem with MSSQL jdbc driver. It was resolved by adding jar file path on META-INF/boot.xml located inside oc4j.jar
                    <system-class-loader name="api" parent="jre.extension" version="1.4.0"
                                             extension-property="api.ext.dirs"
                                             default-extension-directory="lib/api-ext">
                            
                            <code-source path="sqljdbc.jar"/> <!-- my external library -->
                            <code-source path="oc4j-api.jar"/>
                            <code-source path="jps-api.jar"/>
                            <code-source path="jps-unsupported-api.jar"/>
                            <code-source path="lib/jmxri.jar" if="java.specification.version == 1.4"/>
                            <code-source path="lib/jmxframework.jar"/>
                             ...
                    I'm not sure but it could help.

                    Damir
                    • 7. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                      hofespet
                      Hello Damir,

                      Just to be sure.
                      In my case the external library can be found but imports, which are done by this external library cant't be found anymore.
                      Was this your problem too or could the external library not be found?

                      regards
                      Peter
                      • 8. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                        640239
                        Classes of external library is visible fo IDE. And i could use it. But then i deploy application on oc4j (Standalone or embedded) it couldnt find it. So I've copied my jar file near oc4j.jar and made those changes in it.
                        • 9. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                          hofespet
                          sent test case to edwin.
                          Thanks in advance!

                          Peter
                          • 10. Re: OC4J: Class not found for class in jar file placed in \j2ee\home\applib\
                            Edwin Biemond
                            Hi, I got it working , I opened your war and I saw that the model lib are not included in the web-lib/lib

                            So add the external libs to viewcontroller project, then deploy from jdev to the local j2ee container and voila. Now the external libs are in web-inf/lib folder of the war

                            the libs with the export check in depended projects to the viewcontroller project are not included in the war /ear

                            thanks Edwin