Announcement

Collapse
No announcement yet.

Jar error - is not a function, it is object.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jar error - is not a function, it is object.

    I am working with mirth 3.4.x and seem to be having issues.

    I loaded a jar file into the custom lib directory as I have seen in documents

    for RabbitMQ and seem to be getting the following error

    TypeError: [JavaPackage com.rabbitmq.client.ConnectionFactory] is not a function, it is object.
    ------

    My code is simply does the below so no reason why should be getting the above error. Does anyone know why

    From what i read Mirth doesn't need to be restarted.
    I also have read this article. The only thing i haven't done is recompile the source files into new jars. I happen to have them in this case but am trying to avoid compliing them. As it is always practical to have the source code.

    http://www.mirthcorp.com/community/w...+Mirth+Connect

    I would like someone to comment on what I am doing wrong. Thanks in advanced.

    Code:
    var factory =  new com.rabbitmq.client.ConnectionFactory();
    factory.setHost("127.0.0.1");
    var connection = new com.rabbitmq.client.Connection();
    var channel = new com.rabbitmq.client.Channel();
    
     channel.queueDeclare("myqueue", false, false, false, null);
        var messageid = "13";
        channel.basicPublish("", "myqueue", null, messageid .getBytes());
        System.out.println(" [x] Sent '" + messageid  + "'")

  • #2
    If you are adding a custom jar you will have to restart mirth. Beyond that it will be difficult for anyone to help you troubleshoot without access to the source code (or at least a snippet of the function in question) for your custom jar.
    Matt

    http://theunofficialmirthadmin.blogspot.com/

    Comment


    • #3
      I actually had restarted mirth right after i posted this comment and again before responding to this post and still am getting the same error.

      Though I did read the version 3.4 that I have it isn't necessary to restart but rather just load/reload the jar/resource and everything should work.

      I did notice that the IDE in Mirth recognizes the classes with respect to the editor. However the error is still occurring when i send a message.

      In regard to my channel. My channel is all the code you see above in a destination. That is it. I am doing this for proof of concept so there isn't much to the channel . Just to see if i can connect to a queue.

      Comment


      • #4
        refer to the documentation of RabbitMQ. The problem I see is in the constructor Initializer for rabbitmq.client.
        HL7v2.7 Certified Control Specialist!

        Comment


        • #5
          Originally posted by tiskinty View Post
          If you are adding a custom jar you will have to restart mirth.
          This is not correct. The custom class loader loads it on the fly when you press reload resources.

          Comment


          • #6
            I have resolved the problem. I made a bone head mistake....

            Even though I loaded jars for the classes as resources.

            I forgot to Set the resource as a dependency for the channel.

            After doing this resolved the issue.

            Comment

            Working...
            X