Help with Java ACK Handling

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Help with Java ACK Handling

  • Creator
    Topic
  • #54733
    Gabriel Mendes
    Participant

      Folks,

      I am building an application in Cloverleaf 8 and I am handling HL7 ACK via Java UPOC.

      I tested the code on TPS Testing tool in clover and everything went perfectlky fine. however when I run on network monitor, I get the following error:

      Code:

      [sms :sms :ERR /0:     Send_ADT:06/24/2015 08:55:56] Tcl error:
      msgId = message0
      proc = ‘cljTPS’
      args = ‘{CLASS ChangePatientStatusByACK} ‘
      result = ‘com.quovadx.cloverleaf.upoc.CloverleafException: Could not instantiate user-defined class ChangePatientStatusByACK InvocationTargetException: null’
      errorInfo: ‘
      com.quovadx.cloverleaf.upoc.CloverleafException: Could not instantiate user-defined class ChangePatientStatusByACK InvocationTargetException: null
      at com.quovadx.cloverleaf.upoc.CloverEnv.makeUpocInstance(CloverEnv.java:1195)
         invoked from within
      “makeUpocInstance $className TPS $__userArgsCfgs”
         (procedure “cljTPS” line 29)
         invoked from within
      “cljTPS {MSGID message0} {OBMSGID message1} {CONTEXT sms_ib_reply} {ARGS {{CLASS ChangePatientStatusByACK} }} {MODE run} {…”‘

      Can anybody give me a hand?

      Here is my code:

      Code:


      public DispositionList process(CloverEnv cloverEnv, String context,
      String mode, Message msg) throws CloverleafException {

      DispositionList dl = new DispositionList();

      if (mode.compareToIgnoreCase(”start”) == 0) {

      logger.fine(”Nothing to run in START MODE”);

      } else if ((mode.compareToIgnoreCase(”run”) == 0)) {

      System.out.println(”Printing Message: n” + msg.getContent());

      Hl7M ack = msg.makeHl7M(”2.3″, null, “ACK”);

      logger.fine(”ACK Code: ” + ack.getString(”0(0).MSA(0).#1(0)”));
      logger.fine(”Message Control ID: ”
      + ack.getString(”0(0).MSA(0).#2(0)”));
      logger.fine(”Text Message: ” + ack.getString(”0(0).MSA(0).#3(0)”));

      String id = new String();

      id = ack.getString(”0(0).MSA(0).#2(0)”);

      if (id != null && id == “”) {

      HospitalInformationSystemDB hisDB = new HospitalInformationSystemDB();
      this.dbConnection = hisDB.getDBConnection();

      try {

      PatientDAO patientDAO = new PatientDAO(dbConnection);
      // Cast Message ID to Long
      Patient patient = patientDAO.findByMessageID(Long
      .parseLong(id));

      String newStatus = new String();
      String errorDescription = new String();

      if (ack.getString(”0(0).MSA(0).#1(0)”).compareTo(”AA”) == 0) {

      newStatus = PatientStatus.getFinished();
      errorDescription = “”;

      } else {
      newStatus = PatientStatus.getError();
      errorDescription = ack.getString(”0(0).MSA(0).#3(0)”);
      }

      patient.setControlIntegration(newStatus);
      patient.setErrorDescription(errorDescription);

      patientDAO.updateStatusMessageId(patient);

      } catch (Exception ex) {
      ex.printStackTrace();
      } finally {
      hisDB.close();
      }
      }
      logger.fine(”Running KILLREPLY”);

      dl.add(DispositionList.KILLREPLY, msg);

      logger.fine(”ack destroy”);

      ack.destroy();

      }
      logger.fine(”return disposition”);

      return dl;
      }

    Viewing 2 reply threads
    • Author
      Replies
      • #82762
        Jerry Tilsley
        Participant

          Gabriel,

          Have you verified that any external JARs or libraries you are referencing are either in the $HCISITEDIR/java_uccs folder or the $HCIROOT/java_uccs folder?  I find this is usually my problem when I receive similar errors.

          Thanks,

          Jerry

        • #82763
          Gabriel Mendes
          Participant

            Hello Jerry,

            Thanks for your reply

            Yes, the class is there, inside my Site folder / Java_uccs.

            What is even more wired is that I am able to run it using testing tool, but when attaching to a thread, it does not work… I double-checked every name and every path.. everything is configured correctly…

            This is really really wired

          • #82764
            Levy Lazarre
            Participant

              Gabriel,

              1. Have you tried to place your .class file in $HCIROOT/java_uccs instead of site/java_uccs?

              2. There may be a problem with a NullPointerException when the class constructor is called.

              InvocationTargetException usually means that one of the methods that you invoked threw an exception. Put try/catch blocks in your invocation code and log the exceptions (do a InvocationTargetException.getCause())

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.