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

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web3

  • via Unknown by Nick Rupley,
  • via Unknown by Nick Rupley,
  • via Unknown by Igor Ges,
  • Stack trace

    • 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)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    We couldn't find other users who have seen this exception.