2 Replies Latest reply on Jul 19, 2002 6:39 AM by 310398

    Loadjava and ClassNotFound

      Hi All

      I am attempting to use classes bundled in the oc4jclient.jar file in a stored procedure. I have loaded the oc4jclient.jar file using:

      loadjava -u sys/syspwd@localdb -schema SYS -recursivejars -jarasresource -resolver "((* PUBLIC))" oc4jclient.jar

      The problem now manifests itself when I try to create an InitialContext using the following code:

      ============ SNIP =============

      Properties props = new Properties();
      props.setProperty("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory");
      props.setProperty("java.naming.provider.url", "ormi://myserver:15011/gateway");
      props.setProperty("java.naming.security.principal", "admin");
      props.setProperty("java.naming.security.credentials", "admin");

      // Get initial context
      try {
      initialContext = new InitialContext(props);
      } catch(NamingException e) {

      ============ SNIP =============

      As soon as the InitialContext constructor is called the following exception is thrown.

      javax.naming.NoInitialContextException: Cannot instantiate class: com.evermind.server.rmi.RMIInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com/evermind/server/rmi/RMIInitialContextFactory
      at java.lang.Class.forName0(Class.java)
      at java.lang.Class.forName(Class.java)
      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java)
      at javax.naming.InitialContext.init(InitialContext.java)
      at javax.naming.InitialContext.<init>(InitialContext.java)
      at SequenceServer.getId(SequenceSever:35)

      What am I doing wrong?


      Francois Joubert
        • 1. re:Loadjava and ClassNotFound
          Avi Abrami
          Salut Francois,
          I am using OC4J version on SUN Solaris 7 with JDK 1.3.1
          I tried to do the same thing as you. The problem I found was that,
          although the classes are loaded, they are not correctly resolved, and
          therefore they have a status of "invalid". You can check this by querying
          the ALL_OBJECTS view (or the DBA_OBJECTS view -- since it appears that
          you loaded the classes into the SYS user's schema).

          I then tried to load the "oc4j.jar" file, since I figured that it is
          a superset of the "oc4jclient.jar" file, and I am guessing that the
          "oc4jclient.jar" has missing dependencies. This didn't make any difference,
          the "RMIInitialContextFactory" class was still "invalid". So either
          I am missing something, or the "oc4jclient.jar" file cannot be loaded
          into the database (despite Oracle's claims that it can).

          Sorry I couldn't give you better news!

          Good Luck,

          P.S. If you manage to get it working, please let me know how. Personally
          I have given up on it for now. If I really need this functionality,
          then I figure I can use a servlet instead.
          • 2. re:Loadjava and ClassNotFound
            Can you find any object in all_objects with name 'com/evermind/server/rmi/RMIInitialContextFactory' and type 'JAVA CLASS'?

            Also, you can check if status of any Java object is invalid or not.

            If you are running your program through a user other than sys, you should create synonym also using "-s -grant public" of loadjava command.