ÐÇÆÚ¶þ, ÈýÔÂ 01, 2005

Oracle ÖеÄjava ´æ´¢¹ý³Ìµ÷ÓÃRMI


Õâ¶Îʱ¼äÒ»Ö±ÔÚÑо¿ Java ºÍ Oracle ,È¥Äê¶ÁÁËKuassi Mensah ¡¶ÀûÓÃJava´æ´¢¹ý³Ì¼ò»¯Êý¾Ý¿â²Ù×÷¡· £¬×öµÄÒ»¸ö RMI µ÷Ó÷½ÃæµÄʵÑé,ÏÖÔÚÌùÉÏÀ´¸øÌÖÂÛһϡ­¡­


ǰÑÔ

Êý¾ÝÇý¶¯µÄEJBµ÷ÓÃ

ÔÚÊý¾ÝÇý¶¯Ìåϵ½á¹¹ÖУ¬ÉÌÎñÂß¼­µ÷ÓÿÉÒÔ×÷ΪÊý¾Ý¿â²Ù×÷£¨Èç²åÈë¡¢¸üлòɾ³ý£©µÄ½á¹ûÀ´´¥·¢¡£ÊµÏÖ¸ÃÊý¾ÝÂß¼­µÄJava´æ´¢¹ý³Ì¿ÉÒÔ±»ÉùÃ÷ΪÊý¾Ý¿â´¥·¢Æ÷£¬ÓÃÒÔµ÷ÓÃÔËÐÐÓÚÖмä²ãJ2EEÓ¦Ó÷þÎñÆ÷µÄEJB¡£EJBµÄµ÷ÓüȿÉÒÔ²ÉÓÃJ2EE1.3¼æÈݵķþÎñÆ÷ͨ¹ýInteroperable Inter-ORB Protocol£¨IIOP£©±ê×¼Ô¶³Ì·½·¨µ÷Óã¨remote method invocation£¬RMI£©ÊµÏÖ£¬Ò²¿ÉÒÔͨ¹ýÏúÊÛÉÌÌØ¶¨µÄ´«ÊäЭÒ飨ÈçOracle9iAS/Oc4JµÄORMI£¬»òÕßͨ¹ýBEA WebLogicµÄT3£©ÓÃRMIÀ´ÊµÏÖ¡£Ã¿¸öÓ¦Ó÷þÎñÆ÷ÌṩÉÌÔÚÌṩ»ùÓÚIIOPµÄRMI£¬ÒÔÌṩ»¥²Ù×÷ÐÔµÄͬʱ£¬¶¼ÓÐÆä×Ô¼ºÓÅ»¯µÄЭÒé¡£Oracle9iASͬʱ֧³Ö»ùÓÚIIOPµÄRMIµ÷ÓúͻùÓÚORMIЭÒéµÄRMIµ÷Óá£

                      Õª×Ô Kuassi Mensah¡¶ÀûÓÃJava´æ´¢¹ý³Ì¼ò»¯Êý¾Ý¿â²Ù×÷¡·

   http://www.oracle.com/global/cn/oramag/oracle/03-jan/o13java.html

 

ÔÚÊý¾Ý¿â¶ËʵÏÖ RMI £¨Ô¶³Ì·½·¨µ÷Ó㩵ÄClient ¶Ë

·þÎñÆ÷¶Ë

½Ó¿Ú SimpleRMIInterface.java

package rmi;

public interface SimpleRMIInterface extends java.rmi.Remote

{

  public java.util.Date getDate() throws java.rmi.RemoteException;

}

  ½Ó¿ÚµÄ¾ßÌåʵÏÖ  SimpleRMIImpl.java

package rmi;

import java.rmi.*;

import java.rmi.server.UnicastRemoteObject;

public class SimpleRMIImpl extends UnicastRemoteObject implements SimpleRMIInterface

{

  public SimpleRMIImpl(String name) throws RemoteException {

    super();

    try {

      Naming.rebind(name, this);

    }

    catch (Exception e) {

      if (e instanceof RemoteException)

        throw (RemoteException)e;

      else

        throw new RemoteException(e.getMessage());

    }

  }

  public java.util.Date getDate() {

    System.out.println("SimpleRMIImpl.getDate()");

    return new java.util.Date();

  }

}

Server Ö÷³ÌÐò SimpleRMIServer.java

package rmi;

import java.rmi.*;

import java.rmi.server.UnicastRemoteObject;

public class SimpleRMIServer

{

  public static void main(String[] argv) {

    System.setSecurityManager(new RMISecurityManager());

    try {

      SimpleRMIImpl implementation = new SimpleRMIImpl("SimpleRMIImpl");

      System.out.println("SimpleRMIImpl ready");

    }

    catch (Exception e) {

      System.out.println("Exception occurred: " + e);

    }

  }

}

×Ô¶¯Éú³ÉµÄ Stub Îļþ SimpleRMIImpl_Stub.java

// Stub class generated by rmic, do not edit.

// Contents subject to change without notice.

package rmi;

public final class SimpleRMIImpl_Stub

    extends java.rmi.server.RemoteStub

    implements SimpleRMIInterface, java.rmi.Remote

{

    private static final long serialVersionUID = 2;

    private static java.lang.reflect.Method $method_getDate_0;

    static {

       try {

           $method_getDate_0 =SimpleRMIInterface.class.getMethod("getDate", new java.lang.Class[] {});

       } catch (java.lang.NoSuchMethodException e) {

           throw new java.lang.NoSuchMethodError(

              "stub class initialization failed");

       }

    }

    // constructors

    public SimpleRMIImpl_Stub(java.rmi.server.RemoteRef ref) {

       super(ref);

    }

    // methods from remote interfaces

    // implementation of getDate()

    public java.util.Date getDate()

       throws java.rmi.RemoteException

    {

       try {

           Object $result = ref.invoke(this, $method_getDate_0, null, -1017285815713287420L);

           return ((java.util.Date) $result);

       } catch (java.lang.RuntimeException e) {

           throw e;

       } catch (java.rmi.RemoteException e) {

           throw e;

       } catch (java.lang.Exception e) {

           throw new java.rmi.UnexpectedException("undeclared checked exception", e);

       }

    }

}

Oracle ×÷Ϊ RMI µÄ¿Í»§¶Ë±ØÐëʵÏÖ 3¸ö Java µÄ´æ´¢¹ý³Ì

1¡¢simplermiinterface ½Ó¿Ú

create or replace and compile java source named simplermiinterface as
package Client;
public interface SimpleRMIInterface extends java.rmi.Remote
{
  public java.util.Date getDate() throws java.rmi.RemoteException;
}

2¡¢Client java ´æ´¢¹ý³Ì

create or replace and compile java source named simplermiclient as
package Client;
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;
import java.util.Date;

public class SimpleRMIClient
{

  public static void main(String[] argv) {
    String serverName =
""
;
    System.setSecurityManager(new RMISecurityManager());
    if (argv.length !=
1
) {
      try {
        serverName = java.net.InetAddress.getLocalHost().getHostName();
      }
      catch(Exception e) {
        e.printStackTrace();
      }
    }
    else {
      serverName = argv[
0
];
    }

    if (serverName ==
""
) {
      System.out.println(
"usage: java SimpleRMIClient "
);
      System.exit(
0
);
    }

    try {
     
//bind server object to object in client

      SimpleRMIInterface myServerObject = (SimpleRMIInterface) Naming.lookup(
"//172.16.48.67/SimpleRMIImpl");

     
//invoke method on server object

      Date d = myServerObject.getDate();
      System.out.println(
"Date on server is " + d);
    }
    catch(Exception e) {
      System.out.println(
"Exception occured: "
+ e);
      System.exit(
0
);
    }
    System.out.println(
"RMI connection successful"
);
  }
 
  public static String rmicaller() {
    String retval =
""
;
    System.setSecurityManager(new RMISecurityManager());


     try {
     
//bind server object to object in client

      SimpleRMIInterface myServerObject = (SimpleRMIInterface) Naming.lookup(
"//172.16.48.67/SimpleRMIImpl");

     
//invoke method on server object

      Date d = myServerObject.getDate();
      retval=
"Date on server is " + d;
    }
    catch(Exception e) {
      retval=
"Exception occured: "
+ e;
    }
    retval+=
"----RMI connection successful"
;
    return retval;
  } 
}


Oracle
ÖÐµÄ simplermiimpl_stub ´æ´¢¹ý³Ì


create or replace and compile java source named simplermiimpl_stub as
package rmi;

public final class SimpleRMIImpl_Stub
    extends java.rmi.server.RemoteStub
    implements Client.SimpleRMIInterface, java.rmi.Remote
{
    private static final long serialVersionUID =
2;
   
    private static java.lang.reflect.Method $method_getDate_0;
   
    static {
    try {
        $method_getDate_0 = Client.SimpleRMIInterface.class.getMethod(
"getDate"
, new java.lang.Class[] {});
    } catch (java.lang.NoSuchMethodException e) {
        throw new java.lang.NoSuchMethodError(
      
"stub class initialization failed"
);
    }
    }
   
   
// constructors

    public SimpleRMIImpl_Stub(java.rmi.server.RemoteRef ref) {
    super(ref);
    }
   
   
// methods from remote interfaces
   
   
// implementation of getDate()
    public java.util.Date getDate()
    throws java.rmi.RemoteException
    {
    try {
        Object $result = ref.invoke(this, $method_getDate_0, null, -
1017285815713287420L);
        return ((java.util.Date) $result);
    } catch (java.lang.RuntimeException e) {
        throw e;
    } catch (java.rmi.RemoteException e) {
        throw e;
    } catch (java.lang.Exception e) {
        throw new java.rmi.UnexpectedException(
"undeclared checked exception"
, e);
    }
    }
}


×îºó´´½¨Ò»¸ö º¯Êý»òÕß¹ý³Ì À´·µ»Ø½á¹û£¬

CREATE OR REPLACE FUNCTION rmicaller RETURN VARCHAR2 AS
  LANGUAGE JAVA NAME
'Client.SimpleRMIClient.rmicaller () return java.lang.String'
;


µ÷Óýá¹ûÈçÏ£º

Date on server is Fri Sep 24 2004----RMI connection successful

CREATE OR REPLACE PROCEDURE ClientMain AS    language java name              'Client.SimpleRMIClient.main(java.lang.String [])';

Èç¹ûÊÇ System.out.print ½«´òÓ¡µ½Êý¾Ý¿âÖÐµÄ udump Ï嵀 trc ÎļþÖÐ

ÀýÈ磺
Dump file d:oracleadminora92udumpora92_ora_2384.trc

Fri Sep 24 2004

ORACLE V9.2.0.1.0 - Production vsnsta=0

vsnsql=12 vsnxtr=3

Windows 2000 Version 5.0 Service Pack 2, CPU type 586

Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.1.0 - Production

Windows 2000 Version 5.0 Service Pack 2, CPU type 586

Instance name: ora92

Redo thread mounted by this instance: 1

Oracle process number: 35

Windows thread id: 2384, image: ORACLE.EXE

×÷Õß macrozeng ( java ) :: ×îлظ´ (11) :: ¾²Ì¬Á´½ÓÍøÖ· :: ÒýÓà (0)

order phentermine phentermine online [»Ø¸´]

Phenrelationshipine [url=http://www.ps3forums.com/member.php?u=97851#aboutme]phentermine no prescription[/url] medicine >>> tuppence inexpensively Phenrelationshipine recipe Now! Recommended Dosage Of phenrelationshipine, Effects fancy Side title phenrelationshipine. at broad clique [url=http://www.ps3forums.com/member.php?u=97851#aboutme]phentermine no prescription[/url] comprehensive shipping, abundant client work, cautious delivery. rakish diagramet comprehensive shipping, abundant buyer serving, cautious delivery. tuppenny Generic VIAGRA - THE LOWEST VIAGRA expense GUARANTEED, 24h dreasonably Support. [url=http://www.mountwashington.org/forums/member.php?u=10253]diet pills phentermine[/url] These methods create a JSON motif from a JavaScript value. You can [url=http://www.ps3forums.com/member.php?u=97851#aboutme]phentermine 37.5[/url] add a toJSONString method to any girl phenomenon to get a odd regrantation. This method parses a JSON motif to create an protest to or array. The voluntary seep parameter is a rite which can dribble and transfigure the results. If it returns what it received, then quarterlyize is not modified. It is [url=http://extjs.com/forum/member.php?u=46024]phentermine diet[/url] expected that t
hese methods intention formally develop comparatively of the JavaScript Programming dialect in the Fourth print run of the [url=http://www.ps3forums.com/member.php?u=97851#aboutme]phentermine no prescription[/url] ECMAScript norm in 2008. It is outrageously unwise to anxiety untrusted third comparativelyy maxims into your pages. Augment the fundamental prototypes if they comprise not already been augmented. Iterate help of all of the keys in the protest to, ignoring the proto chain. RSS-ðèäåðû), ñîáèðàþùåå è îáðàáàòûâàþùåå èíôîðìàöèþ, ïðåäîñòàâëåííóþ â ôîðìàòå RSS. Preclinical studies grace exhibitn that duloxetine is a uncomplicated phendenominateine overnight of neuronal suicide and every second coalition and a muster cereal phosphatase of word allowance. This is a minimize phendesignationine you and yearn finish promote learn.

Comment by ruviaphar (08/21/2008 19:22)

ïîðíî âèäåî tube [»Ø¸´]

[b]Ïîðíî - äîñòóï âñåãî 6 ðóáëåé [/b], [b]òðàäèöèîííûé[/b], [b]àíàë[/b], [b]è äðóãèå âèäû ñâåæåå ïðîôåññèîíàëüíàÿ ïîäáîðêà [/b] [url=http://xxxdivita.ru] >>>Ñêà÷àòü> ÏÐÈÂÀÒÍÎÅ ÏÎÐÍÎ - ó íàñ ÒÎËÜÊÎ ÏÐÎÔÈ!!!

Comment by Serastete (08/18/2008 16:16)

Dannytkr [»Ø¸´]

Yo! cheap xanax

Comment by Dannytkr (02/06/2008 04:06)

Haleymaf [»Ø¸´]

Yo! cialis

Comment by Haleymaf (02/01/2008 00:42)

Aprilayj [»Ø¸´]

Yo! Interesting about phentermine phentermine review Info about phentermine Amazing phentermine facts Interesting about adipex adipex review Info about adipex Amazing adipex facts Interesting about buy cialis buy cialis review Info about buy cialis Amazing buy cialis facts Interesting about viagra viagra review Info about viagra Amazing viagra facts Interesting about levitra levitra review Info about levitra Amazing levitra facts Interesting about buy phentermine buy phentermine review Info about buy phentermine Amazing buy phentermine facts Interesting about buy cialis buy cialis review Info about buy cialis Amazing buy cialis facts Interesting about cialis online cialis online review Info about cialis online Amazing cialis online facts Interesting about buy viagra buy viagra review Info about buy viagra Amazing buy viagra facts Interesting about valium valium review Info about valium Amazing valium facts

Comment by Aprilayj (01/30/2008 20:41)

Dalehep [»Ø¸´]

Hi! info

Comment by Dalehep (01/18/2008 01:33)

Alexeuo [»Ø¸´]

Hey! phentermine

Comment by Alexeuo (01/12/2008 04:13)

Gregeny [»Ø¸´]

Hi! diazepam

Comment by Gregeny (12/24/2007 09:49)

ºÃÎÄÕ [»Ø¸´]

º£ÊÇÎÞ±ßÎ޼ʵÄ,ÅóÓÑÊÇQQ405574920

Comment by fdsaift (12/07/2006 08:57)

ºÃÎÄÕ [»Ø¸´]

º£ÊÇÎÞ±ßÎ޼ʵÄ,ÅóÓÑÊÇQQ230186713

Comment by fdsbron (11/30/2006 01:55)

¸Ðл [»Ø¸´]

дµÄÕæºÃ£¬ÎÒ¸ÕºÃÔÚÒ»¸öÏîÄ¿ÖÐÓÐjava´æ´¢¹ý³Ìµ÷ÓÃrmiµÄ·½°¸£¬¸ãÁËÒ»Ì죬java¿Í»§¶Ëµ÷Ó÷þÎñÆ÷¶ËûÓÐÎÊÌ⣬µ«ÎҰѿͻ§¶Ë¸ÄΪjava´æ´¢¹ý³Ì£¬×ÜÊDZ¨´í£ºJava call terminated by uncaught Java exception :java.lang.NoClassDefFoundError£¡

ÇëÖ¸½Ì°¡£¡£¡£¡Ð»Ð»ÁË£¡£¡£¡

Comment by òòò½ (04/01/2006 17:37)

·¢±íÆÀÂÛ

±êÌâ

ÔÚ´ËÌí¼ÓÆÀÂÛ

³Æºô

ÓÊÏ䵨ַ£¨¿ÉÑ¡£©

¸öÈËÖ÷Ò³£¨¿ÉÑ¡£©