IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

CORBA Discussion :

hello world


Sujet :

CORBA

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations forums :
    Inscription : Mai 2004
    Messages : 8
    Points : 8
    Points
    8
    Par défaut hello world
    bonjour
    j'ai un serveur enregistrant un objet sur le POA (serveur sous Solaris avec Visibroker en C++)
    je n'arrive pas a obtenir une reference sur cet objet depuis un client (sous NT en Java)
    j'ai trouvé qqs exemples mais j'ai du mal a les adapter a mon exemple

    ps : je fait une application hello world

    merci d'avance pour votre aide

  2. #2
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations forums :
    Inscription : Mai 2004
    Messages : 8
    Points : 8
    Points
    8
    Par défaut
    voici le code du serveur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    #include <fstream.h>
    #include <corba.h>
    #include <Hello_impl.hh>
    
    
    int
    main&#40;int argc, char* const* argv&#41;
    &#123;
      try&#123;
     //initialize the ORB
        CORBA&#58;&#58;ORB_var orb = CORBA&#58;&#58;ORB_init&#40;argc, argv&#41;;    
    
        PortableServer&#58;&#58;POA_var rootPOA=PortableServer&#58;&#58;POA&#58;&#58;_narrow&#40;orb->resolve_initial_references&#40;"RootPOA"&#41;&#41;;
        CORBA&#58;&#58;PolicyList policies;
        policies.length&#40;1&#41;;
        policies&#91;&#40;CORBA&#58;&#58;ULong&#41;0&#93;=rootPOA->create_lifespan_policy&#40;PortableServer&#58;&#58;PERSISTENT&#41;;
        PortableServer&#58;&#58;POAManager_var poa_manager = rootPOA -> the_POAManager&#40;&#41;;
    
        PortableServer&#58;&#58;POA_var myPOA = rootPOA->create_POA&#40;"hello_poa",poa_manager,policies&#41;;
        Hello_impl managerServant;
        PortableServer&#58;&#58;ObjectId_var managerId=PortableServer&#58;&#58;string_to_ObjectId&#40;"hello"&#41;;
          myPOA->activate_object_with_id&#40;managerId, &managerServant&#41;;
        poa_manager->activate&#40;&#41;;
        cout << myPOA->servant_to_reference&#40;&managerServant&#41; << "is ready" << endl;
        orb->run&#40;&#41;;
    
      &#125;
      catch&#40;const CORBA&#58;&#58;Exception& e&#41;&#123;
        cerr << e << endl;
    return 1;&#125;
      return 0;
    &#125;
    ainsi que celui du client :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    
    
    public class HelloClient
    
    &#123;
      static Hello helloImpl;
    
      public static void main&#40;String args&#91;&#93;&#41;
        &#123;
          try&#123;
           // create and initialize the ORB
    	ORB orb = ORB.init&#40;args, null&#41;;
    
            // get the root naming context
            org.omg.CORBA.Object objRef = orb.resolve_initial_references&#40;"RootPOA"&#41;;
            // Use NamingContextExt instead of NamingContext. This is
            // part of the Interoperable naming Service.
            NamingContextExt ncRef = NamingContextExtHelper.narrow&#40;objRef&#41;;
    
            // resolve the Object Reference in Naming
            String name = "hello_poa";
            helloImpl = HelloHelper.narrow&#40;ncRef.resolve_str&#40;name&#41;&#41;;
    
            System.out.println&#40;helloImpl.sayHello&#40;&#41;&#41;;
    
    	&#125; catch &#40;Exception e&#41; &#123;
              System.out.println&#40;"ERROR &#58; " + e&#41; ;
    	  e.printStackTrace&#40;System.out&#41;;
    	  &#125;
    	  &#125;
    &#125;
    et maintenant voici l'erreur :
    ERROR : org.omg.CORBA.NO_IMPLEMENT: This is a locally constrained object. vmcid
    : 0x0 minor code: 0 completed: No
    org.omg.CORBA.NO_IMPLEMENT: This is a locally constrained object. vmcid: 0x0 m
    inor code: 0 completed: No
    at org.omg.CORBA.LocalObject._is_a(LocalObject.java:109)
    at org.omg.CosNaming.NamingContextExtHelper.narrow(NamingContextExtHelpe
    r.java:73)
    at HelloClient.main(HelloClient.java:32)


    voila si vous voyez le truc qui cloche, merci de votre aide

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations forums :
    Inscription : Mai 2004
    Messages : 8
    Points : 8
    Points
    8
    Par défaut
    pb resolu : c'etait une histoire de classpath
    ++ all

  4. #4
    Candidat au Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 3
    Points : 2
    Points
    2
    Par défaut
    Tu peux parler un peu + en détail de ton histoire de classpath s'il te plait?

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [C++] Hello world ne compile pas
    Par thargos dans le forum C++
    Réponses: 9
    Dernier message: 25/09/2006, 18h45
  2. Hello world avec JCreator
    Par skunkies dans le forum Environnement de Développement Intégré (EDI)
    Réponses: 4
    Dernier message: 22/09/2006, 12h54
  3. [Débutant] Hello World
    Par Ultiny dans le forum C++
    Réponses: 2
    Dernier message: 25/02/2006, 12h57
  4. [Débutant] hello world jsp tomcat
    Par RENAULT dans le forum Tomcat et TomEE
    Réponses: 24
    Dernier message: 13/05/2004, 16h29
  5. [STRUTS] hello world, bonjour le monde
    Par Celina dans le forum Struts 1
    Réponses: 3
    Dernier message: 19/04/2004, 15h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo