web stats
Unable to load modified JARs in MC 3.3.0 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-19-2015, 07:19 AM
rdejournett rdejournett is offline
OBX.2 Kenobi
 
Join Date: Jan 2013
Posts: 99
rdejournett is on a distinguished road
Default Unable to load modified JARs in MC 3.3.0

I have this issue since I upgraded to MC 3.3. I do much of my code in Java and export a JAR for Mirth to run. I usually make the code change in eclipse, create the JAR, copy to custom-lib, stop & start MC server.

Now with the advent of channel specific resources, I can't seem for the life of me to update jars. What ends up happening is that none of the code is executable after I copy over the jar.

I have tried my usual method of stop/start mcservice.

I also tried reload resource from the Resources tab in MC settings.

The error in MC is:

TypeError: Cannot call property runBash in object [JavaPackage com.medfusion.estatement.RunBash]. It is not a function, it is "object".

To me this says that Mirth can't find the class.

The *only* solution I've found is to reboot the whole machine every change. I don't know why this works yet, but it does.

I have tried redeploying channels, stop/start channels, everything I can think of.
Reply With Quote
  #2  
Old 10-19-2015, 08:12 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

If you're creating separate Directory resources (this is the recommended best practice), then you also need to enable them on the channel(s) you want to use them on. Go to the Summary tab and click on Set Dependencies, then go to the Library Resources tab. Select the contexts you want to include your library in.

If you're dumping everything into custom-lib (this is not recommended), then assuming that the default resource still points to custom-lib then your channels should be linked to it by default. Check to make sure that "[Default Resource]" is checked on those channels (same location as before).

If you're adding or updating JARs, you shouldn't need to restart MC. You should only need to run the Reload Resource task on the Resources settings view.

Also, if you're using custom-lib, then in mirth.properties the "server.includecustomlib" setting determines whether those libraries will be loaded into the overall server classpath or not. This is really only needed when you need a library to override something in MC, not just something you're doing in JavaScript. If you're not sure whether you need it to be enabled, it most likely should not be. If you've upgraded from an earlier version to 3.2.2 or higher, then that property will automatically be migrated to "true" in order to keep the same behavior. In that case you need only set it to "false" and restart the server.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 10-19-2015, 09:17 AM
rdejournett rdejournett is offline
OBX.2 Kenobi
 
Join Date: Jan 2013
Posts: 99
rdejournett is on a distinguished road
Default

Thanks Nick, confirm this works. But I am getting stuck on deployment from command line.

In the past, this worked fine:

import \"/app/mirth/channels/CG1-2 $PM Java.xml\" force"
channel deploy \"CG1-2 $PM Java\"

But it looks like the code templates are not being migrated. I confirm if I manually export and Import, it works (i do get the dialog to overwrite code templates). I set the envt to Import Code Templates with channels in Settings/Administrator/

If I run a deployment script which basically looks like this:


echo "import \"/app/mirth/channels/CG1-2 $PM Java.xml\" force" >>/app/mirth/mirth-deploy-script.txt
echo "channel deploy \"CG1-2 $PM Java\"" >>/app/mirth/mirth-deploy-script.txt
scp "/app/mirth/mirth-deploy-script.txt" $STR:/app/mirth/mirth-deploy-script.txt
ssh -l mirth $STR exec /app/mirthconnect/mccommand -a https://127.0.0.1:8443 -u admin -p admin -s /app/mirth/mirth-deploy-script.txt
echo Script Completed

Then it does not import code templates.
Reply With Quote
  #4  
Old 10-19-2015, 09:26 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Right now the CLI doesn't support importing code templates as part of a channel XML import, precisely because of the complexity in merging (which is why in the Administrator that dialog is shown). However, it does support importing code templates by themselves. Run the "help" command to see the code template / library commands and how to use them.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #5  
Old 10-19-2015, 10:41 AM
rdejournett rdejournett is offline
OBX.2 Kenobi
 
Join Date: Jan 2013
Posts: 99
rdejournett is on a distinguished road
Default

Thanks, is that functionality planned, any ETA?
Reply With Quote
  #6  
Old 10-29-2015, 05:46 AM
rdejournett rdejournett is offline
OBX.2 Kenobi
 
Join Date: Jan 2013
Posts: 99
rdejournett is on a distinguished road
Default

Couple of updates/queries. I notice that the library import is similarly restricted, I think the library setting is not being set during export (ie in the XML), because whenever I redeploy the library setting is gone. So this is a manual setting I believe which is required (correct me if I am wrong).

Also I found a solution for a very annoying error that is not really due to Mirth but rather found in Rhino.

If you upgrade Java to a new version, and export custom JARs against that new version, the Mirth server must be running on that new version. Makes sense right?

So when you get this error: JavaPackage com.medfusion.blah.Blah()] is not a function, it is object. - and you are sure your class is in there and spelled correctly, check the java version.
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 10:43 AM.


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