web stats
Jar error - is not a function, it is object. - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2017, 06:41 AM
vill vill is offline
OBX.1 Kenobi
 
Join Date: Dec 2011
Posts: 33
vill is on a distinguished road
Default 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  + "'")
Reply With Quote
  #2  
Old 03-16-2017, 08:10 AM
tiskinty tiskinty is offline
OBX.1 Kenobi
 
Join Date: Jun 2016
Posts: 43
tiskinty is on a distinguished road
Default

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/
Reply With Quote
  #3  
Old 03-16-2017, 08:33 AM
vill vill is offline
OBX.1 Kenobi
 
Join Date: Dec 2011
Posts: 33
vill is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 03-16-2017, 09:20 PM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

refer to the documentation of RabbitMQ. The problem I see is in the constructor Initializer for rabbitmq.client.
Reply With Quote
  #5  
Old 03-20-2017, 03:56 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 137
odo is on a distinguished road
Default

Quote:
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.
Reply With Quote
  #6  
Old 03-23-2017, 10:51 AM
vill vill is offline
OBX.1 Kenobi
 
Join Date: Dec 2011
Posts: 33
vill is on a distinguished road
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:32 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation