3 Replies Latest reply: Mar 13, 2012 1:16 PM by 795418 RSS

    Database 11g can't use loaded java library

    761373
      Hello.

      Some days ago i started to write a java library for working with ms office. And for this it was decided to use Java com Bridge (JACOB project). First of all i loaded jacob jar to database. After this i made a test java class for testing. I loaded it too, wrote a pl/sql wrapper and tried to execute it under database but foud an error:
      ORA-29532: Java: java.lang.ExceptionInInitializerError - after first execution,
      ORA-29532: Java: java.lang.NoClassDefFoundError - after all other executions.

      I am 100% sure that problem is that my class does not see library loaded jacob.jar and can't load any of its classes.

      Could somebody help me please?

      Thank you.
        • 1. Re: Database 11g can't use loaded java library
          793351
          Hi,

          Even we are facing similar problem.
          We have a JAR which contains JAXB classes apart from other classes.

          Now, a test java class which tries to instantiate JAXBContext and unmarshall XML files.
          This class is also loaded to DB.

          But it throws the same error as mentioned above, while JAXBContext.newInstance("<package>").

          Appreciate any help to resolve this.

          Thanks,
          Rajesh
          • 2. Re: Database 11g can't use loaded java library
            MarceloF.Ochoa
            Hi Rajesh:
            A few years ago I developed a server side framework similar to Struts for DBPrism CMS, at that time I utilized the JAXB framework for instantiating the action form class (user provided).
            The code which instantiate the class based on arguments defined the XML file was:
            http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/src/com/prism/cms/action/Controller.java?revision=1.8&view=markup
            The trick was to get the user's class-loader from the user connected session (note Bootstrap class) because Controller class is at DBPrism schema and Bootstrap is loaded at Scott for example.
            With this trick JAXB frameworks work as expected.
            At this [cms.xml|http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/tasks/cms.xml?revision=1.19&view=markup] file there is code for making a new Jar with only the missing classes of the framework because if upload directly the xml.jar to the OJVM it will override some native classes of XMLType implementation (target unpack-jaxb-classes).
            Note that the above Ant file also have the target for uploading Bootstrap class to the user schema.
            Hope this help, Marcelo.
            • 3. Re: Database 11g can't use loaded java library
              795418
              Hello,

              I have the same problem loading JAXB in OracleVM with loadjava tool. In Java 1.6, JAXB is part of "core" Java. But in Java 1.5, it is part of the Java Web Services Developer Pack, so all of its JARs have to be loaded: activation.jar, jaxb-api-2.0-SNAPSHOT.jar, jaxb-impl-1.0.5.jar, jaxb-impl-2.0-SNAPSHOT.jar, jsr173_api-1.0.jar. No matter what order I try to use loadjava on these JARs, classes are always skipped because of additional dependencies.

              The result is that my classes produced by the jvc utility, which "import javax.xml.bind.*", cannot be resolved (regardless of whether or not I use I use loadjava -resolve or -genmissing flags). ORA-29541: class XXX could not be resolved

              Has ANYONE had success using JAXB in the OracleVM in 11gR2? If so, please provide a loadjava script.

              Thanks,
              --Alex