5 Replies Latest reply: Oct 4, 2008 10:39 AM by John Stegeman RSS

    Loadjava class error

    615288
      Hi.

      I'm trying integrate Java with SAP using the SAP Java Connector (JCO). When I run my code in JDeveloper it works, but when I try to deploy this class in Oracle Server has an error.

      My code is:
      public class Class1
      {
      public Class1()
      {
      }

      public static void main(String srgs[])
      {

      }

      public static String get(String value)
      {
      JCO.Client client = JCO.createClient(new String[][]{});
      return value;
      }
      }

      Error on deploy to the server:
      Invoking loadjava on connection 'Desenvolvimento' with arguments:
      -order -resolve -thin
      errors : class sap/mypackage/Class1
      ORA-29534: referenced object com/sap/mw/jco/JCO$Client could not be resolved
      The following operations failed
      class sap/mypackage/Class1: resolution
      oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
           at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
           at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:117)
           at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:47)
           at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
           at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:447)
           at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:334)
           at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:276)
           at oracle.jdevimpl.deploy.StoredProcProfileDt$3.run(StoredProcProfileDt.java:386)
      #### Deployment incomplete. #### 03/10/2008 08:06:08








      The following code works (It Deployes):


      public class Class1
      {
      public Class1()
      {
      }

      public static void main(String srgs[])
      {

      }

      public static String get(String value)
      {
      //JCO.Client client = JCO.createClient(new String[][]{});
      JCO.Client client;
      return value;
      }
      }




      How can I deploy my java class and keep the error?
        • 1. Re: Loadjava class error
          John Stegeman
          user,

          The Oracle database clearly doesn't have the JCO classes and all of the supporting stuff loaded. In order to load your class into the DB, you would have to load all of the JCO + supporting classes into the database first (read the docs on loadjava).

          Wouldn't running your class in the application server (instead of the database) be a better idea?

          John
          • 2. Re: Loadjava class error
            470068
            Hi,

            All java libraries are placed in jlib database directory, try to copy SAP required .jar files (libraries) there and restart database. Also (as my experience indicates) if you want to use java inside database your sources should be compiled exactly the same JDK version that database uses. To compile all, don't use JDeveloper but JDK embeded in database.

            Kuba
            • 3. Re: Loadjava class error
              John Stegeman
              Kuba,

              Actually, the bit about the java libraries going in jlib is not true. If you want to access them from a java class loaded in the database, they must be loaded into the database using loadjava.

              John
              • 4. Re: Loadjava class error
                470068
                Hi John,

                Not exactly. Once, I tried to connect to MySQL from inside Oracle database (to data replication). To retrive JDBC connection I had to use MySQL driver. So. I also thought that it only needs loadjava, but it didn''t work and when I invoked java stored procedure ... - no exceptions, no data in remote MySQL :). Man from Metalink adviced me to copy driver into jlib directory. I didn't test it because erlier I found another solution.

                Kuba
                • 5. Re: Loadjava class error
                  John Stegeman
                  Thanks for that Kuba - I'm glad I'm still learning something new every day.

                  John