Yes I have only the 2.6 structures in my classpath. And Canonical should look 
for 2.6 classes, however the stack trace says it's looking for 2.4 classes.
Everything is fine until I try to create the ACK. So I've used some duct tape 
to get over the problem like this:

    MSH requestMsh = message.MSH
    def version = requestMsh.msh12_VersionID.versionID.value
    requestMsh.msh12_VersionID.versionID.value = "2.6"
    def ack = message.generateACK()
    MSH ackMsh = ack.MSH
    ackMsh.msh12_VersionID.versionID.value = version

Again, Groovy code, so don't worry about Java syntax.

R,
rahul

On Jan 9, 2012, at 10:43 AM, Sharma, Niranjan K (GE Healthcare) wrote:

> Rahul,
>  
> Do you have structure classes in your path?
> CMCF will look for 2.6 structure.
>  
> Thanks.
>  
> Regards
> -Niranjan.
>  
>  
> From: Rahul Somasunderam [mailto:r...@certifydatasystems.com] 
> Sent: Monday, January 09, 2012 10:36 AM
> To: hl7api-devel@lists.sourceforge.net
> Subject: [HAPI-devel] generateACK and CanonicalMCF
>  
> Hi,
>  
> I'm using Canonical MCF to parse a message. Then I'm using generateACK on the 
> message. This causes a ClassNotFoundException. I'm using HAPI 1.2, if that 
> matters.
>  
> This is my code (in Groovy)
>  
>     def messageString = context.messageContent
>     def cmcf = new CanonicalModelClassFactory("2.6")
>     def parser = new PipeParser(cmcf)
>     parser.setValidationContext(new NoValidation())
>     def message = parser.parse(messageString)
>  
>     ... (app logic) ...
>  
>     def ack = message.generateACK()
>     return ack.encode()
>  
> This is the most significant part of the exception:
>  
> ca.uhn.hl7v2.HL7Exception: Can't instantiate ACK of class 
> ca.uhn.hl7v2.model.v24.message.ACK: java.lang.ClassNotFoundException
>             at 
> ca.uhn.hl7v2.app.DefaultApplication.makeACK(DefaultApplication.java:150)
>             at 
> ca.uhn.hl7v2.model.AbstractMessage.generateACK(AbstractMessage.java:213)
>             at 
> ca.uhn.hl7v2.model.AbstractMessage.generateACK(AbstractMessage.java:205)
>             at 
> messaging.MessageReceiverService$$ENLWsoN6.process(MessageReceiverService.groovy:24)
>  
>  
> Is there a known workaround for this? Do you want me to submit a test 
> case/file a report?
>  
> R,
> rahul

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to