3 Replies Latest reply on Aug 9, 2004 10:24 AM by Darran Lofthouse

    Oracle to JBoss RMI question

    S C Newbie

      I am having difficulty connecting an Oracle package running on a different server to a class file running on another server. Has someone done this before and can you provide some help/examples?

      System Environment:
      1. Oracle database on a different box.
      2. Unix box listening on 1099 (rmi port).
      3. Jboss-3.2.3

      What i have done so far:
      > Created and compiled a single class that has one method that returns a string - such as "Hello".
      > Created Stub and Skel using rmic -d classfilename
      > Created a client class and loaded it into Oracle. This class does a Naming.lookup("rmi://"+rmiName);
      > Created an Oracle package that has a procedure calling this java method.

      1. How do I register the class in RMI on the Jboss app server. Note that my class is not acting as a daemon.
      2. How do I deploy the class file in jboss so it can be called from Oracle?
      (Do i need to package it into a war file and be able to map it somehow?)
      3. Is the calling protocol for the lookup ("rmi://") correct? or do i need to use "http://" ?

      Please help.

        • 1. Re: Oracle to JBoss RMI question
          Darran Lofthouse Master

          Scrap everything that you have done so far.

          Do you have an understanding of J2EE? If not go to www.theserverside.com and download a copy of matering enterprise java beans.

          Next follow through the getting started guide and make sure you understand how to write, deploy and use the different types of components.

          What do you mean by connecting an Oracle package, and what do you mean by created a client class and loaded it into Oracle? What Oracle, do you mean the app server, database server or something else?

          • 2. Re: Oracle to JBoss RMI question
            S C Newbie

            Thanks for your reply. I'm a newbie to J2EE but working on it. I'll attempt to answer your questions now -
            1. A user can push a button on the interface we have that will call the Procedure in the Oracle package. Here's the oracle code:
            create or replace package snfeedinterface as
            procedure getReferralStatus;
            create or replace package body sneedinterface as
            procedure getReferralStatus as language java name 'mydept.testing.OracleSNFeedInterface.getReferralStatus()';

            2. The client has been loaded into the oracle database using loadjava:
            a. RemoteSnFeedInterface.class
            public interface RemoteSnFeedInterface extends java.rmi.Remote {
            public String getReferralStatus() throws java.rmi.RemoteException;
            b. OracleSnFeedInterface.class
            public class OracleSnFeedInterface {
            public OracleSnFeedInterface() {

            public static String getReferralStatus() throws Exception {
            RemoteSnFeedInterface r = getRemoteSnFeedInterface();
            return r.getReferralStatus();

            private static RemoteSalesnetFeedInterface getRemoteSalesnetFeedInterface() throws Exception {
            String rmiName = "SnFeedRMI";
            RemoteSnFeedInterface r = (RemoteSnFeedInterface) Naming.lookup("rmi://"+rmiName);
            return r;
            c. Stub class

            On the remote side, I'm running jboss 3.2.3 as you know.

            • 3. Re: Oracle to JBoss RMI question
              Darran Lofthouse Master

              Ok that makes a bit more sense.

              Still scrap everything that you have been doing so far, to start with you need to learn how to write session beans and how to access them from a client.

              With J2EE you do not need to get involved with the RMI side of things at all.

              Once you have been able to deploy a session bean and access it from a stand alone client you can start to look at how to run the code from the DBMS.