web stats
Receiving Message without MSH - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2011, 04:58 AM
raja4web raja4web is offline
Mirth Newb
 
Join Date: Mar 2011
Posts: 12
raja4web is on a distinguished road
Default Receiving Message without MSH

Hi,
I am having problem when i want to filter out inbound message based upon missing MSH segment. I m using Mirth connect version 2.1.0.5389.
In my source connector Filter, i have code to check whether MSH segment exists in incoming message or not. But when the message is received without MSH, the following TWO errors are shown in Server Log tab on Dashborad.

Code:
[2011-08-18 16:59:01,181]  ERROR (com.mirth.connect.server.controllers.DefaultMessageObjectController:248): could not log message: id=014c6d65-0b08-43c3-b831-246de42d3bfa
com.ibatis.common.jdbc.exception.NestedSQLException:   --- The error occurred in sqlserver2000/sqlserver2000-message.xml.  --- The error occurred while applying a parameter map.  --- Check the Message.insert-message-param.  --- Check the statement (update failed).  --- Cause: java.sql.DataTruncation: Data truncation
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:393)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:58)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.writeMessageToDatabase(DefaultMessageObjectController.java:245)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.updateMessage(DefaultMessageObjectController.java:185)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.setStatus(DefaultMessageObjectController.java:894)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.setTransformed(DefaultMessageObjectController.java:822)
	at com.mirth.connect.server.mule.transformers.JavaScriptTransformer.transform(JavaScriptTransformer.java:305)
	at org.mule.transformers.AbstractEventAwareTransformer.doTransform(AbstractEventAwareTransformer.java:48)
	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:197)
	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
	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.file.FileMessageReceiver.processFile(FileMessageReceiver.java:228)
	at com.mirth.connect.connectors.file.FileMessageReceiver.poll(FileMessageReceiver.java:118)
	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(Unknown Source)Caused by: java.sql.DataTruncation: Data truncation
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:379)
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)
	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:475)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:80)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteUpdate(MappedStatement.java:216)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:94)
	... 25 more
and The second error is:
Code:
[2011-08-18 16:59:01,224]  ERROR (org.mule.impl.DefaultComponentExceptionStrategy:95): Caught exception in Exception Strategy for: 0944f27f-9330-4f93-9227-f59ea34ebde0: java.lang.NullPointerException
java.lang.NullPointerException
	at com.mirth.connect.connectors.mllp.MllpMessageReceiver$TcpWorker.processHL7Data(MllpMessageReceiver.java:491)
	at com.mirth.connect.connectors.mllp.MllpMessageReceiver$TcpWorker.processData(MllpMessageReceiver.java:431)
	at com.mirth.connect.connectors.mllp.MllpMessageReceiver$TcpWorker.run(MllpMessageReceiver.java:348)
	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(Unknown Source)
The NullPointer exception occures every time when the filter returns false(even if MSH segment is present).

I m really stuck in this issue. Please help.
Thanks

Regards,
Raja
Reply With Quote
  #2  
Old 08-18-2011, 05:36 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

Hi;

Like most integration engines Mirth will have absolutely no idea on how to parse an HL7 message without the MSH segment.

I'm not 100% sure what the minimum standard is, but you need at least MSH.2 in order to tell Mirth how to break apart your message.

I haven't tested this, and there's probably a better way to do it, but try this in your pre-processor script

Code:
if (message.indexOf('MSH|')<0) {

     message = message + 'MSH|^~\&||SOURCE|||||MSG^TYP|||'
}
Try it first with just MSH.2, then again with the Source and Message Type (use values that you're system will accept)

If you keep getting the errors, or get different ones play around by adding the different fields and let us know how you get on.
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #3  
Old 08-18-2011, 11:14 PM
raja4web raja4web is offline
Mirth Newb
 
Join Date: Mar 2011
Posts: 12
raja4web is on a distinguished road
Default

Hi Bostad,
Thanx for the response. I tried adding MSH segment in postprocessor script, and message gets processed. But still i m getting the following error:
Code:
[2011-08-19 11:12:00,169]  ERROR (com.mirth.connect.server.controllers.DefaultMessageObjectController:248): could not log message: id=5400ebdb-2998-463a-87dd-6cc4d892acd8
com.ibatis.common.jdbc.exception.NestedSQLException:   --- The error occurred in sqlserver2000/sqlserver2000-message.xml.  --- The error occurred while applying a parameter map.  --- Check the Message.insert-message-param.  --- Check the statement (update failed).  --- Cause: java.sql.DataTruncation: Data truncation
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:393)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:58)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.writeMessageToDatabase(DefaultMessageObjectController.java:245)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.updateMessage(DefaultMessageObjectController.java:185)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.setStatus(DefaultMessageObjectController.java:894)
	at com.mirth.connect.server.controllers.DefaultMessageObjectController.setTransformed(DefaultMessageObjectController.java:822)
	at com.mirth.connect.server.mule.transformers.JavaScriptTransformer.transform(JavaScriptTransformer.java:305)
	at org.mule.transformers.AbstractEventAwareTransformer.doTransform(AbstractEventAwareTransformer.java:48)
	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:197)
	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
	at org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:200)
	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.file.FileMessageReceiver.processFile(FileMessageReceiver.java:228)
	at com.mirth.connect.connectors.file.FileMessageReceiver.poll(FileMessageReceiver.java:118)
	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(Unknown Source)Caused by: java.sql.DataTruncation: Data truncation
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:379)
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)
	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.execute(JtdsPreparedStatement.java:475)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:80)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteUpdate(MappedStatement.java:216)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:94)
	... 25 more
However this time No nullpointer erorr occures. What i could understand is may be the error text is too large to be stored in mirth's internal DB.

Regards,
Raja
Reply With Quote
  #4  
Old 08-19-2011, 05:08 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

I saw a problem in my script...it should've been

Code:
message = 'MSH..' + message
In looking a little closer at your error message I see that its actually SQL errors.

If you're using javascript in your filter can you post it here, or if not, post your channel? (After stripping out any confidential info)
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #5  
Old 08-22-2011, 04:46 AM
raja4web raja4web is offline
Mirth Newb
 
Join Date: Mar 2011
Posts: 12
raja4web is on a distinguished road
Default Receiving Message without MSH

Hi Bostad,

here is my channel source and a sample message without MSH. You r absolutely right that it is an sql error. may be it is caused due to the length of error message when i send a message without MSH segment.

Thanx for your concerns..

Regards,
Raja
Attached Files
File Type: xml Inbound Lab Result ORU - R01.xml (156.6 KB, 17 views)
File Type: txt sample message.txt (1.9 KB, 12 views)
Reply With Quote
  #6  
Old 08-22-2011, 08:01 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

Hi;

Okay, I've tested it out. You've got a SQL Server 2000 db as your mirthdb?
I received a postreg error when I ran your message through one of my channels (I use postreg on an appliace).

Put this code in your channel's pre-processor script and you should be good to go (you'll have to change the STO, Message Times and Control ID's etc programmatically, I don't know your system or what will work for you in those fields).

Code:
if (message.toString().indexOf('MSH|') == -1) {

	message = 'MSH|^~\&||STO|||201108161139||RDE^O01|OMNI-OUT.2.617158|P|2.4\n' +  message
}
return message;
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #7  
Old 08-25-2011, 12:23 AM
raja4web raja4web is offline
Mirth Newb
 
Join Date: Mar 2011
Posts: 12
raja4web is on a distinguished road
Default

Hello Bostad,

Thank you so much for the time and help u put in this issue. its working great now. u r the best!!

Regards,
Raja
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 04:53 PM.


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