com.mirth.connect.server.MirthJavascriptTransformerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • After importing Mirth 1.8.2 channels into a new instance of Mirth 2.0.0 we keep getting the same error when starting Mirth. The error seems to happen in the channel preprocessor. {noformat} NFO 2010-11-04 15:22:05,231 [Thread-2] com.mirth.connect.server.Mirth: Mirth Connect 2.0.0.5127 (October 28, 2010) server s arted: Thu Nov 04 15:22:05 CST 2010 INFO 2010-11-04 15:22:05,231 [Thread-2] com.mirth.connect.server.Mirth: This product was developed by Mirth Corporation (htt orp.com) and its contributors (c)2005-2010. INFO 2010-11-04 15:22:05,231 [Thread-2] com.mirth.connect.server.Mirth: Running Java HotSpot(TM) 64-Bit Server VM 1.6.0_20 o at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) ERROR 2010-11-04 15:22:04,250 [Thread-2] com.mirth.connect.server.util.JavaScriptUtil: Error executing f2439943-2775-416b-8df c-1fd7d920f9eb_Deploy script from channel: f2439943-2775-416b-8dfc-1fd7d920f9eb com.mirth.connect.server.MirthJavascriptTransformerException: SOURCE CODE: 4816: } 4817: };var release_tag = 50;function doScript() { 4818: // This script executes once when the mule engine is started 4819: // You only have access to the globalMap here to persist data 4820: 4821: message = message.replace(/:/g, "|") 4822: message = message.replace (/;/g, "^"); 4823: return message; 4824: } LINE NUMBER: 4820 DETAILS: ReferenceError: "message" is not defined. at com.mirth.connect.server.util.JavaScriptUtil.executeScript(JavaScriptUtil.java:251) at com.mirth.connect.server.util.JavaScriptUtil.executeChannelDeployOrShutdownScript(JavaScriptUtil.java:180) at com.mirth.connect.server.controllers.DefaultScriptController.executeChannelDeployScript(DefaultScriptController.ja va:197) at com.mirth.connect.server.controllers.MuleEngineController.deployChannels(MuleEngineController.java:199) at com.mirth.connect.server.controllers.MuleEngineController.redeployAllChannels(MuleEngineController.java:281) at com.mirth.connect.server.controllers.MuleEngineController.startEngine(MuleEngineController.java:144) at com.mirth.connect.server.Mirth.startEngine(Mirth.java:205) at com.mirth.connect.server.Mirth.startup(Mirth.java:176) at com.mirth.connect.server.Mirth.run(Mirth.java:126) INFO 2010-11-04 15:22:05,231 [Thread-2] com.mirth.connect.server.Mirth: Mirth Connect 2.0.0.5127 (October 28, 2010) server s uccessfully started: Thu Nov 04 15:22:05 CST 2010 INFO 2010-11-04 15:22:05,231 [Thread-2] com.mirth.connect.server.Mirth: This product was developed by Mirth Corporation (htt p://www.mirthcorp.com) and its contributors (c)2005-2010. INFO 2010-11-04 15:22:05,231 [Thread-2] com.mirth.connect.server.Mirth: Running Java HotSpot(TM) 64-Bit Server VM 1.6.0_20 o n Linux (2.6.18-xen, amd64) with charset UTF-8. {noformat}
    via by Igor Ges,
  • Try the following in a 2.x preprocessor: \\ \\ {code}logger.info(typeof messageObject);{code} It outputs "undefined", as expected. However in 3.x it will now throw an error: \\ \\ {code}[2014-03-03 09:09:23,887] ERROR (com.mirth.connect.server.util.javascript.JavaScriptUtil:464): Error executing Preprocessor script from channel: 880e07cc-0729-42c5-a146-29c4b3253f9c com.mirth.connect.server.MirthJavascriptTransformerException: SOURCE CODE: 187: }188: }189: function doScript() {190: // Modify the message variable below to pre process data191: 192: logger.info(typeof messageObject);193: 194: return message; 195: }LINE NUMBER: 192DETAILS: Invalid JavaScript value of type com.mirth.connect.server.userutil.MessageObject at 880e07cc-0729-42c5-a146-29c4b3253f9c_Preprocessor:192 (doScript) at 880e07cc-0729-42c5-a146-29c4b3253f9c_Preprocessor:196 at com.mirth.connect.server.util.javascript.JavaScriptUtil.executeScript(JavaScriptUtil.java:489) at com.mirth.connect.server.util.javascript.JavaScriptUtil.executePreprocessorScripts(JavaScriptUtil.java:183) at com.mirth.connect.server.transformers.JavaScriptPreprocessor$JavaScriptPreProcessorTask.call(JavaScriptPreprocessor.java:57) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724){code} \\ \\ In addition, try this code: \\ \\ {code}if (messageObject) logger.info('messageObject exists');{code} In 2.x, it throws an error: \\ \\ {code}[2014-03-03 09:14:51,142] ERROR (com.mirth.connect.server.util.JavaScriptUtil:264): Error executing Preprocessor script from channel: faf8272e-b76d-4cd6-984f-55b23cdb21de com.mirth.connect.server.MirthJavascriptTransformerException: SOURCE CODE: 1: String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,"").replace(/^\t+|\t+$/g,""); };function $(string) { if (globalChannelMap.containsKey(string)) { return globalChannelMap.get(string);} else if (globalMap.containsKey(string)) { return globalMap.get(string);} else { return ''; }}function addAttachment(data, type) {var attachment = Packages.com.mirth.connect.server.controllers.MessageObjectController.getInstance().createAttachment(data, type);muleContext.getProperties().get('attachments').add(attachment); 2: return attachment; }3: function $gc(key, value){if (arguments.length == 1){return globalChannelMap.get(key); }else if (arguments.length == 2){globalChannelMap.put(key, value); }}function $g(key, value){if (arguments.length == 1){return globalMap.get(key); }else if (arguments.length == 2){globalMap.put(key, value); }}function doScript() {4: // Modify the message variable below to pre process data5: if (messageObject)6: logger.info('messageObject exists');7: return message; 8: }LINE NUMBER: 5DETAILS: ReferenceError: "messageObject" is not defined. at faf8272e-b76d-4cd6-984f-55b23cdb21de_Preprocessor:5 (doScript) at faf8272e-b76d-4cd6-984f-55b23cdb21de_Preprocessor:9 at com.mirth.connect.server.util.JavaScriptUtil.executeScript(JavaScriptUtil.java:289) at com.mirth.connect.server.util.JavaScriptUtil.executePreprocessorScripts(JavaScriptUtil.java:166) at com.mirth.connect.server.mule.transformers.JavaScriptPreprocessor.transform(JavaScriptPreprocessor.java:40) at org.mule.transformers.AbstractEventAwareTransformer.doTransform(AbstractEventAwareTransformer.java:48) at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:197) at org.mule.impl.MuleEvent.getTransformedMessage(MuleEvent.java:251) at org.mule.routing.inbound.SelectiveConsumer.isMatch(SelectiveConsumer.java:61) at org.mule.routing.inbound.InboundMessageRouter.route(InboundMessageRouter.java:79) at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:487) at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:266) at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:225) at com.mirth.connect.connectors.vm.VMMessageReceiver.getMessages(VMMessageReceiver.java:222) at org.mule.providers.TransactedPollingMessageReceiver.poll(TransactedPollingMessageReceiver.java:108) at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:97) at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:724){code} However in 3.x you now get warnings from Rhino: \\ \\ {code}[2014-03-03 09:14:40,233] ERROR (Server:146): RHINO USAGE WARNING: Missed Context.javaToJS() conversion: [2014-03-03 09:14:40,233] ERROR (Server:146): Rhino runtime detected object message 9-0 (RECEIVED) of class com.mirth.connect.server.userutil.MessageObject where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.{code}
    via by Nick Rupley,
  • Try the following in a 2.x preprocessor: \\ \\ {code}logger.info(typeof messageObject);{code} It outputs "undefined", as expected. However in 3.x it will now throw an error: \\ \\ {code}[2014-03-03 09:09:23,887] ERROR (com.mirth.connect.server.util.javascript.JavaScriptUtil:464): Error executing Preprocessor script from channel: 880e07cc-0729-42c5-a146-29c4b3253f9c com.mirth.connect.server.MirthJavascriptTransformerException: SOURCE CODE: 187: }188: }189: function doScript() {190: // Modify the message variable below to pre process data191: 192: logger.info(typeof messageObject);193: 194: return message; 195: }LINE NUMBER: 192DETAILS: Invalid JavaScript value of type com.mirth.connect.server.userutil.MessageObject at 880e07cc-0729-42c5-a146-29c4b3253f9c_Preprocessor:192 (doScript) at 880e07cc-0729-42c5-a146-29c4b3253f9c_Preprocessor:196 at com.mirth.connect.server.util.javascript.JavaScriptUtil.executeScript(JavaScriptUtil.java:489) at com.mirth.connect.server.util.javascript.JavaScriptUtil.executePreprocessorScripts(JavaScriptUtil.java:183) at com.mirth.connect.server.transformers.JavaScriptPreprocessor$JavaScriptPreProcessorTask.call(JavaScriptPreprocessor.java:57) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724){code} \\ \\ In addition, try this code: \\ \\ {code}if (messageObject) logger.info('messageObject exists');{code} In 2.x, it throws an error: \\ \\ {code}[2014-03-03 09:14:51,142] ERROR (com.mirth.connect.server.util.JavaScriptUtil:264): Error executing Preprocessor script from channel: faf8272e-b76d-4cd6-984f-55b23cdb21de com.mirth.connect.server.MirthJavascriptTransformerException: SOURCE CODE: 1: String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,"").replace(/^\t+|\t+$/g,""); };function $(string) { if (globalChannelMap.containsKey(string)) { return globalChannelMap.get(string);} else if (globalMap.containsKey(string)) { return globalMap.get(string);} else { return ''; }}function addAttachment(data, type) {var attachment = Packages.com.mirth.connect.server.controllers.MessageObjectController.getInstance().createAttachment(data, type);muleContext.getProperties().get('attachments').add(attachment); 2: return attachment; }3: function $gc(key, value){if (arguments.length == 1){return globalChannelMap.get(key); }else if (arguments.length == 2){globalChannelMap.put(key, value); }}function $g(key, value){if (arguments.length == 1){return globalMap.get(key); }else if (arguments.length == 2){globalMap.put(key, value); }}function doScript() {4: // Modify the message variable below to pre process data5: if (messageObject)6: logger.info('messageObject exists');7: return message; 8: }LINE NUMBER: 5DETAILS: ReferenceError: "messageObject" is not defined. at faf8272e-b76d-4cd6-984f-55b23cdb21de_Preprocessor:5 (doScript) at faf8272e-b76d-4cd6-984f-55b23cdb21de_Preprocessor:9 at com.mirth.connect.server.util.JavaScriptUtil.executeScript(JavaScriptUtil.java:289) at com.mirth.connect.server.util.JavaScriptUtil.executePreprocessorScripts(JavaScriptUtil.java:166) at com.mirth.connect.server.mule.transformers.JavaScriptPreprocessor.transform(JavaScriptPreprocessor.java:40) at org.mule.transformers.AbstractEventAwareTransformer.doTransform(AbstractEventAwareTransformer.java:48) at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:197) at org.mule.impl.MuleEvent.getTransformedMessage(MuleEvent.java:251) at org.mule.routing.inbound.SelectiveConsumer.isMatch(SelectiveConsumer.java:61) at org.mule.routing.inbound.InboundMessageRouter.route(InboundMessageRouter.java:79) at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:487) at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:266) at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:225) at com.mirth.connect.connectors.vm.VMMessageReceiver.getMessages(VMMessageReceiver.java:222) at org.mule.providers.TransactedPollingMessageReceiver.poll(TransactedPollingMessageReceiver.java:108) at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:97) at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:724){code} However in 3.x you now get warnings from Rhino: \\ \\ {code}[2014-03-03 09:14:40,233] ERROR (Server:146): RHINO USAGE WARNING: Missed Context.javaToJS() conversion: [2014-03-03 09:14:40,233] ERROR (Server:146): Rhino runtime detected object message 9-0 (RECEIVED) of class com.mirth.connect.server.userutil.MessageObject where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.{code}
    via by Nick Rupley,
    • com.mirth.connect.server.MirthJavascriptTransformerException: SOURCE CODE: 4816: } 4817: };var release_tag = 50;function doScript() { 4818: // This script executes once when the mule engine is started 4819: // You only have access to the globalMap here to persist data 4820: 4821: message = message.replace(/:/g, "|") 4822: message = message.replace (/;/g, "^"); 4823: return message; 4824: } LINE NUMBER: 4820 DETAILS: ReferenceError: "message" is not defined. at com.mirth.connect.server.util.JavaScriptUtil.executeScript(JavaScriptUtil.java:251) at com.mirth.connect.server.util.JavaScriptUtil.executeChannelDeployOrShutdownScript(JavaScriptUtil.java:180) at com.mirth.connect.server.controllers.DefaultScriptController.executeChannelDeployScript(DefaultScriptController.java:197) at com.mirth.connect.server.controllers.MuleEngineController.deployChannels(MuleEngineController.java:199) at com.mirth.connect.server.controllers.MuleEngineController.redeployAllChannels(MuleEngineController.java:281) at com.mirth.connect.server.controllers.MuleEngineController.startEngine(MuleEngineController.java:144) at com.mirth.connect.server.Mirth.startEngine(Mirth.java:205) at com.mirth.connect.server.Mirth.startup(Mirth.java:176) at com.mirth.connect.server.Mirth.run(Mirth.java:126)
    No Bugmate found.