Hi everyone,
I am using the forward2 service to trigger forwarding of studies received on a dcm4chee server (2.17.1) based on some relatively simple rules.
The forward.xsl file looks like this:
<xsl:template match="/dataset">
<destinations>
<xsl:variable name="somevar1" select="normalize-space(attr[@tag='11112222'])" />
<xsl:choose>
<xsl:when test="$somevar1='VAR1'"><destination aet="DST1" priority="medium"/></xsl:when>
<xsl:when test="$somevar1='VAR2'"><destination aet="DST2" priority="medium"/></xsl:when>
<xsl:when test="$somevar1='VAR3'"><destination aet="DST3" priority="medium"/></xsl:when>
<xsl:when test="$somevar1='VAR4'"><destination aet="DST4" priority="medium"/></xsl:when>
</xsl:choose>
</destinations>
</xsl:template>
(there are actually a few more variables that get set from a few dicom tags, but the basic approach is the same. Make a forwarding destination decision based on some variables set from dicom tags...)
The template has been working fine for a long time, though growing in size as more rules have been added.
At some point, after adding a few new rules to the template, I started seeing the following error, and the forwarding stopped working. I had to undo my changes:
2013-11-18 21:17:57,411 ERROR -> (Thread-134) [org.dcm4chex.archive.dcm.movescu.ForwardService2] Applying forwarding rules to SeriesStored[sourceAET=SRC1, retrieveAET=DCM4CHEE, modality=CT, numOfInst=1, study-iuid=1.3.12.2.1107.5.1.4.24742.5.0.777777777, series-iuid=1.3.12.2.1107.5.1.4.24742.5.0.8888888888888] fails:
javax.xml.transform.TransformerConfigurationException: Could not load the translet class 'forward'.
at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.defineTransletClasses(TemplatesImpl.java:331)
at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.getTransletInstance(TemplatesImpl.java:349)
at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.java:382)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformerHandler(TransformerFactoryImpl.java:923)
at org.dcm4chex.archive.dcm.movescu.ForwardService2.prepareTransformHandler(ForwardService2.java:488)
at org.dcm4chex.archive.dcm.movescu.ForwardService2.xslt(ForwardService2.java:478)
at org.dcm4chex.archive.dcm.movescu.ForwardService2.onSeriesStored(ForwardService2.java:219)
at org.dcm4chex.archive.dcm.movescu.ForwardService2.access$000(ForwardService2.java:93)
at org.dcm4chex.archive.dcm.movescu.ForwardService2$1.handleNotification(ForwardService2.java:108)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
at $Proxy11.handleNotification(Unknown Source)
at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:110)
at org.dcm4chex.archive.dcm.AbstractScpService.sendJMXNotification(AbstractScpService.java:856)
at org.dcm4chex.archive.dcm.storescp.StoreScpService.sendSeriesStoredNotification(StoreScpService.java:898)
at org.dcm4chex.archive.dcm.storescp.StoreScpService.checkPendingSeriesStored(StoreScpService.java:928)
at org.dcm4chex.archive.dcm.storescp.StoreScpService.access$300(StoreScpService.java:106)
at org.dcm4chex.archive.dcm.storescp.StoreScpService$3$1.run(StoreScpService.java:146)
at java.lang.Thread.run(Thread.java:662)
I am able to compile the (non-working) stylesheet using the command line, it doesn't give me any errors, and generates a class file as expected:
java -classpath /opt/dcm4chee-2.17.1-psql/lib/endorsed com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile forward.xsl
Based on some searching, there appears to be a limitation in java that limits the maximum size of methods to 64K.
http://xml.apache.org/xalan-j/xsltc_usage.html#constraintsIs it possible that my large forward.xsl is generating a method that is too large for java to handle?
Has anyone else had issues with large (thousands of lines) forward.xsl templates? Is there a way to specify multiple forward.xsl templates in dcm4chee (other than putting them in sub-folders based on the AE of the StoreSCU - sadly that is not an option for me, as the Source AEs are unknown and may change at any time...). Would using xsl:import, xsl:include or xsl:call-template allow me to work around this problem, maybe by having a main 'forward.xsl' file which then calls (includes?) multiple other ones as needed?
any ideas are appreciated,
Jordan