9 Replies Latest reply on Jan 28, 2010 10:24 AM by 447464

    jar loading conflict in embedded oc4j

    523311
      I ran in to a problem with jdevelopers embedded OC4J container when using web service libraries such as wsdl4j, saaj, jax-rpc. Now I am wondering am I tied to Oracle jax-rpc client libraries when using oc4j ?

      With the code that I am currently writing, for example I used wsdl4j from Axis:

      import javax.wsdl.factory.WSDLFactory;
      import javax.wsdl.xml.WSDLReader;

      WSDLFactory wsdlFactory = WSDLFactory.newInstance();
      WSDLReader reader = wsdlFactory.newWSDLReader();

      As this code runs normal in the jvm, it didn’t work any more ones I had deployed to oc4j and ran it from a servlet.

      When I started the debugger, I noticed that the ‘reader’ variable in the code example above, was of type oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl instead of type javax.wsdl.xml.WSDLReader.

      Apparently oc4j’s class-loader can’t resolve the wsdl4j.jar and uses the standard webservice jar files that are contained in the Oracle JAX-RPC CLIENT library that come with the jdeveloper installation. If I am not mistaken these are located at …\jdev1013\webservices\lib\ .

      I also notices that in this lib directory oracle contains jar files for saaj, jax-rpc ect.

      Does this mean you are tied down to using the oracle implementation’s of these components, or is there a way to use libraries of your chosing ?

      If not I have a huge problem, either I refactor my code to work with the oracle libraries or I abandon jdeveloper completely.

      Without being able to deploy my own jar files to oc4j, jdeveloper is of no use to me.. unfortunately because until now I found it a great tool.
        • 1. Re: jar loading conflict in embedded oc4j
          206307
          I hope I can help, can it be that you are not forcing OC4J to search for local-libraries first? You can set some parameters mentioned in:

          http://www.comp.hkbu.edu.hk/docs/o/dl/web/B10321_01/develop.htm#1019111
          • 2. Re: jar loading conflict in embedded oc4j
            523311
            Thanks for the reply. I am sure that what your suggesting could be the case. Unfortunatly I don't know how to add the search-local-classes-first element to the -web-application.xml. In the documentation it doesnt tell you the format.

            By the way, I talks about class loading in war files first. I am not sure whether this still applies to jar files from your local project in the embedded oc4j as well, since jdeveloper self deploys this without you having to package everything into a war file first. But I am sure it does..

            Do you know what the exact xml element entry looks like. The default global-web-application.xml doesnt contain search for local classes first ?
            • 3. Re: jar loading conflict in embedded oc4j
              18475
              Hello,

              OracleAS 10.1.3 has been tested with Apache Axis and we have documented how to configure OC4J to deploy Axis applications, see Using Apache Axis.

              In addition, to answer you question about "search local class first":
              To configure the search local class first, you have to create/modify the orion-web.xml with the following element:
              <web-app-class-loader search-local-classes-first="true" />
              It is documented in the servlet development guide.


              However, I usually think that creating and using a shared library to control le class loader is a better practice than loading all the classes from the War file. You can learn more about OracleAS shared libraries in the following documentation:
              - Utilizing the OC4J Class Loading Framework

              Let us know if that solves your issue.

              Regards
              Tugdual Grall
              • 4. Re: jar loading conflict in embedded oc4j
                523311
                Since my problem with the class-loading resides within the embedded oc4j I wasnt sure where to create the orion-web.xml and add the element you suggested : <web-app-class-loader search-local-classes-first="true" />

                Application are ussually deployed to something like : <jdev-home>\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\application-deployments\.....
                Here I dont know which folder (the 'default' folder and the 'current-workspace-app' folder) contains the orion-web.xml to that needs to be altered. Neither one worked.

                I also tried adding a new orion-web.xml to the config directory of the embedded oc4j, this also didnt work.

                However, what DID work was adding <web-app-class-loader search-local-classes-first="true" /> to the global-web-application.xml.

                For now this works and I am happy to continue development with oc4j. I will look into the shared libraries option as soon as I have time. I am sure your right that this method deserves preference.

                Thanks a lot for the pointing out the right documentation.
                • 5. Re: jar loading conflict in embedded oc4j
                  18475
                  Hello,

                  With JDeveloper 10.1.3 you should be able to easily create the orion-web.xml, and it will be located in the good location (in the WEB-INF directory) and should be use by the embedded OC4J.

                  To create a new orion-web.xml in JDeveloper, from your Web project:
                  1- File > New
                  2- In the General > Deployment Descriptor gallery choose OC4J deployment descriptor
                  3- Then follow the wizard.

                  The wizard will create an empty file then you can use Jdeveloper to help you to build the file with the codeinsight. (JDeveloper has registered all the OracleAS & J2EE schemas to help developer to create deployment descriptors)

                  Regards
                  Tugdual Grall
                  • 6. Re: jar loading conflict in embedded oc4j
                    523311
                    Thats perfect. This way the orion-web.xml gets deployed to oc4j automatically and its project specific. Thanks so much, you really helped me out !
                    • 7. Re: jar loading conflict in embedded oc4j
                      523311
                      As I moved on with development and had to use the saaj library I noticed that the previous option with the orion-web.xml deployment descriptor didnt work for all libraries. For example I added wsd4j.jar and saaj.jar and jax-rpc.jar to my project.
                      The wsdl4j lib from axis gets loaded first by the class-loader whereas the saaj library for working with soap still uses the oracle libraries.
                      Do you have any idea why this could be ?
                      • 8. Re: jar loading conflict in embedded oc4j
                        DnlCY
                        Mark your problem seems the same as I have. wsdl4j as jaxb are packaged as javax which is one of the exceptions of search-local-classes-first solution:

                        In accordance with the servlet specification, search-local-classes-first functionality cannot be used in loading classes in java.* or javax.* packages.

                        :(

                        I have been trying other solutions indicated but until know without success.

                        I tried to remove shared library using <remove-inherited> tag in orion-application.xml and nothing

                        Tried to make my own shared library:

                        <orion-application>
                        <imported-shared-libraries>
                        <remove-inherited name="oracle.xml"/>
                        <import-shared-library name="jaxb.xml" max-version="2.1/>
                        </imported-shared-libraries>
                        </orion-application>

                        and also nothing.

                        Does someone as any idea?
                        • 9. Re: jar loading conflict in embedded oc4j
                          447464
                          I tried to run Apache AXIS on top of an OC4J 10.1.2.0.2 standalone container and install the file upload sample web service. When I ran it, it failed with an invalid soap header. Am I missing something simple? Can I run AXIS on top of this OC4J version, and if so, which version of AXIS?

                          My concern is that I'm trying to fix a web service issue with a Production report generation process and I'd like to have the fix in place before March 1st.

                          Thanks for any help,
                          Eric