2014-11-07 2 views
-2

클라이언트 측에서 서버 쪽에서 메서드를 호출하고 있습니다. 나는 3 대의 서버가 있고 UDP를 사용하여 통신 할 필요가 있으므로 메서드에서 orb을 다시 시작하여 스레드 프로세스를 시작해야합니다. 그러나 ORB 초기화 문제로 인해 이것이 확실한 것 같습니다.CORBA 오류 : 메서드에서 ORB 초기화

서버에서의 나의 메소드 측면 :

public String getNonReturners(String adminUsername, String adminPassword, 
      String educationalInstitution, int numDays) { 

     String _result = null; 
     String _initiatedServerResult = null; 
     final ArrayList<String> result = new ArrayList<String>(); 

     try { 
      ORB orb = ORB.init(); 
      POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); 
      BufferedReader brConcordia = new BufferedReader(new FileReader(
        "concordia.txt")); 
      String concordia = brConcordia.readLine(); 
      brConcordia.close(); 

      BufferedReader brMcgill = new BufferedReader(new FileReader(
        "mcgill.txt")); 
      String mcgill = brMcgill.readLine(); 
      brMcgill.close(); 

      BufferedReader brDawson = new BufferedReader(new FileReader(
        "dawson.txt")); 
      String dawson = brDawson.readLine(); 
      brDawson.close(); 
      org.omg.CORBA.Object concordiaObject = orb.string_to_object(concordia); 
      org.omg.CORBA.Object mcgillObject = orb.string_to_object(mcgill); 
      org.omg.CORBA.Object dawsonObject = orb.string_to_object(dawson); 
      final DRMSInterface _concordiaServer = DRMSInterfaceHelper 
        .narrow(concordiaObject); 
      final DRMSInterface _mcgillServer = DRMSInterfaceHelper 
        .narrow(mcgillObject); 
      final DRMSInterface _dawsonServer = DRMSInterfaceHelper 
        .narrow(dawsonObject); 

      if (educationalInstitution.toLowerCase().equals("concordia")) { 
       final Thread t1 = new Thread() { 
        @Override 
        public void run() { 
         result.add(_mcgillServer 
           .responseData(_mcgillPortNumber)); 
        } 
       }; 
       t1.setDaemon(true); 
       t1.start(); 
       final Thread t2 = new Thread() { 
        @Override 
        public void run() { 
         result.add(_dawsonServer 
           .responseData(_dawsonPortNumber)); 
        } 
       }; 
       t2.setDaemon(true); 
       t2.start(); 

       System.out.println("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _mcgillPortNumber); 
       result.add("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _mcgillPortNumber); 
       result.add("/n"); 
       System.out.println("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _dawsonPortNumber); 
       result.add("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _dawsonPortNumber); 
       result.add("/n"); 
       final String _concordiaRequestMessage = educationalInstitution 
         + numDays; 
       System.out.println("Sending data " 
         + _concordiaRequestMessage.length() 
         + " bytes to server."); 
       result.add("Sending data " + _concordiaRequestMessage.length() 
         + " bytes to server."); 
       result.add(_concordiaServer.requestData(_mcgillPortNumber, 
         _concordiaRequestMessage)); 
       result.add(_concordiaServer.requestData(_dawsonPortNumber, 
         _concordiaRequestMessage)); 
       _initiatedServerResult = _concordiaServer.getNonReturnersData(
         educationalInstitution, numDays); 
       if (_initiatedServerResult != null) { 
        result.add(_initiatedServerResult); 
       } 
       else { 
        result.add("No Defaulters in Concordia"); 
       } 
      } 
      else if (educationalInstitution.toLowerCase().equals("mcgill")) { 
       final Thread t1 = new Thread() { 
        @Override 
        public void run() { 
         result.add(_concordiaServer 
           .responseData(_concordiaPortNumber)); 
        } 
       }; 
       t1.setDaemon(true); 
       t1.start(); 
       final Thread t2 = new Thread() { 
        @Override 
        public void run() { 
         result.add(_dawsonServer 
           .responseData(_dawsonPortNumber)); 
        } 
       }; 
       t2.setDaemon(true); 
       t2.start(); 

       System.out.println("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _concordiaPortNumber); 
       result.add("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _concordiaPortNumber); 
       System.out.println("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _dawsonPortNumber); 
       result.add("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _dawsonPortNumber); 
       final String _mcgillRequestMessage = educationalInstitution 
         + numDays; 
       System.out.println("Sending data " 
         + _mcgillRequestMessage.length() + " bytes to server."); 
       result.add("Sending data " + _mcgillRequestMessage.length() 
         + " bytes to server."); 
       result.add(_mcgillServer.requestData(_concordiaPortNumber, 
         _mcgillRequestMessage)); 
       result.add(_mcgillServer.requestData(_dawsonPortNumber, 
         _mcgillRequestMessage)); 
       _initiatedServerResult = _mcgillServer.getNonReturnersData(
         educationalInstitution, numDays); 
       if (_initiatedServerResult != null) { 
        result.add(_initiatedServerResult); 
       } 
       else { 
        result.add("No Defaulters in Mcgill"); 
       } 

      } 
      else if (educationalInstitution.toLowerCase().equals("dawson")) { 
       final Thread t1 = new Thread() { 
        @Override 
        public void run() { 
         result.add(_concordiaServer 
           .responseData(_concordiaPortNumber)); 
        } 
       }; 
       t1.setDaemon(true); 
       t1.start(); 
       final Thread t2 = new Thread() { 
        @Override 
        public void run() { 
         result.add(_mcgillServer 
           .responseData(_mcgillPortNumber)); 
        } 
       }; 
       t2.setDaemon(true); 
       t2.start(); 

       System.out.println("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _concordiaPortNumber); 
       result.add("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _concordiaPortNumber); 
       System.out.println("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _mcgillPortNumber); 
       result.add("Attemping to connect to " + IPAddress 
         + ") via UDP port" + _mcgillPortNumber); 

       final String _dawsonRequestMessage = educationalInstitution 
         + numDays; 
       System.out.println("Sending data " 
         + _dawsonRequestMessage.length() + " bytes to server."); 
       result.add("Sending data " + _dawsonRequestMessage.length() 
         + " bytes to server."); 
       result.add(_dawsonServer.requestData(_concordiaPortNumber, 
         _dawsonRequestMessage)); 
       result.add(_dawsonServer.requestData(_mcgillPortNumber, 
         _dawsonRequestMessage)); 
       result.add(_concordiaServer.getNonReturnersData(
         educationalInstitution, numDays)); 
       _initiatedServerResult = _dawsonServer.getNonReturnersData(
         educationalInstitution, numDays); 
       if (_initiatedServerResult != null) { 
        result.add(_initiatedServerResult); 
       } 
       else { 
        result.add("No Defaulters in Dawson"); 
       } 
      } 
     } 
     catch (IOException e) { 
      e.printStackTrace(); 
     } 
     catch (InvalidName e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 

     return _result = result.toString(); 
    } 

이 질문에서 마지막 답변을 시도했지만 도움이되지 않습니다. calling args from out side the main method

오류 :

org.omg.CORBA.NO_IMPLEMENT: ----------BEGIN server-side stack trace---------- 
org.omg.CORBA.NO_IMPLEMENT: vmcid: SUN minor code: 201 completed: No 
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.genericNoImpl(Unknown Source) 
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.genericNoImpl(Unknown Source) 
    at com.sun.corba.se.impl.orb.ORBSingleton.resolve_initial_references(Unknown Source) 
    at DistributedReservationManagementSystem.DRMSInterfaceImpl.getNonReturners(DRMSInterfaceImpl.java:448) 
    at DistributedReservationManagementSystem.DRMSInterfacePOA._invoke_getNonReturners(DRMSInterfacePOA.java:224) 
    at DistributedReservationManagementSystem.DRMSInterfacePOA.access$9(DRMSInterfacePOA.java:215) 
    at DistributedReservationManagementSystem.DRMSInterfacePOA$Operation_getNonReturners.invoke(DRMSInterfacePOA.java:385) 
    at DistributedReservationManagementSystem.DRMSInterfacePOA._invoke(DRMSInterfacePOA.java:73) 
    at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleRequest(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleInput(Unknown Source) 
    at com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleRequest(Unknown Source) 
    at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.dispatch(Unknown Source) 
    at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.doWork(Unknown Source) 
    at com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(Unknown Source) 
    at com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(Unknown Source) 

----------END server-side stack trace---------- vmcid: SUN minor code: 201 completed: No 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(Unknown Source) 
    at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknown Source) 
    at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source) 
    at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source) 
    at DistributedReservationManagementSystem._DRMSInterfaceStub.getNonReturners(_DRMSInterfaceStub.java:502) 
    at DistributedReservationManagementSystem.DRMSInterfaceClient.main(DRMSInterfaceClient.java:362) 

답변

1

내가 속성 파일에서 읽기 이런 식으로 해결 : 우리가 인수

로에게 빈 문자열 배열을 통과 할 때

try { 
      Properties prop = new Properties(); 
      String[] orbarg = new String[2]; 

      try { 
       // load a properties file 
       prop.load(new FileInputStream("config.properties")); 
       // get the property value and print it out 
       orbarg[0] = "-ORBInitRef"; // <---- NEEDED 
       orbarg[1] = prop.getProperty("ORBInitRef"); 

      } catch (IOException ex) { 
       ex.printStackTrace(); 
      } 

      ORB orb = ORB.init(orbarg,null); 

그것은 심지어 작동