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
>
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel