Where is the problem? If you look at
http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/model/Message.html#generateACK%28%29,
you will see that the following is stated:

The ACK generated will be of the same version as the value of MSH-12 in
this message (as opposed to the version of the message class instance, if
they are different)

- which essentially means that if 'messageString' MSH-12 component says
2.4, the parsed message that the parser returns will be of class type 2.6,
because of the CanonicalModelClassFactory("2.6"). However, generateACK does
not use the CanonicalModelClassFactory, as stated in the doc, and will
always return the correct class type version - in this example 2.4. So
according to the doc, it cannot be a bug

2012/1/11 Rahul Somasunderam <[email protected]>

> The bug Id is 3471571.
>
> On Jan 9, 2012, at 4:42 PM, James Agnew wrote:
>
> Hi Rahul,
>
> Looks like you have uncovered a bug in HAPI. I tried it locally and I see
> the same thing as you: Basically, the "generateACK()" method is not
> actually honoring your ModelClassFactory, so it's trying to instantiate the
> 2.4 version of the structure.
>
> The easiest workaround is probably to change the valud of MSH-12 on your
> message to "2.6" right before calling "generateACK". This will have the
> side effect that the MSH-12 value in the ACK message will then be set to
> "2.6", so you may need to change it back before doing whatever you are
> doing with it.
>
> If you don't mind to submit a report, that would be great. I'm sure we can
> get this fixed for the next release of HAPI (which we should have a beta of
> fairly soon).
>
> Cheers,
> James
>
> On Mon, Jan 9, 2012 at 12:36 PM, Rahul Somasunderam <
> [email protected]> wrote:
>
>> 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
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
>> infrastructure or vast IT resources to deliver seamless, secure access to
>> virtual desktops. With this all-in-one solution, easily deploy virtual
>> desktops for less than the cost of PCs and save 60% on VDI infrastructure
>> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
>> _______________________________________________
>> Hl7api-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>>
>>
>
>
>
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>


-- 
Med venlig hilsen / Kind regards

Jens Kristian Villadsen
cand.polyt
Systemudvikler / System developer
Cetrea A/S, Denmark

   phone : +45 38 40 05 81
   address: Brendstrupgårdsvej 21F, DK-8200 Aarhus N.
   e-mail : [email protected]
   w^3     : http://www.cetrea.com/
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to