You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Da...@jbhunt.com on 2004/07/29 20:09:38 UTC

Problems running working XSLT scripts underTRAX




Situation:
      I have a set of XSLT scripts that function correctly under
interpreted xalan.  I am trying to test the performance benefit of shifting
to the TRAX compiler.  We are running  three successive transformations
(one to produce outbound data, two to take inbound data and convert it to a
form usable by another process).  The first of the three scripts is
failing. It is also the first loaded.



Environment:
      Sun client JDK 1.4.1
      Xalan 2.6.0 (as shipped)
      Windows XP



Requested Action:
      (a) confirm that this is or is not a bug in TRAX
      (b) suggest workarounds



Symptom:
      After cleaning up my scripts so that they compile correctly, and
confirming that they still function in interpreted mode, I am receiving
this exception when I try to execute the script:

org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.<init>(Lorg/apache/xml/dtm/DTMManager;Ljavax/xml/transform/Source;ILorg/apache/xml/dtm/DTMWSFilter;Lorg/apache/xml/utils/XMLStringFactory;ZIZZ)V

java.lang.NoSuchMethodError:
org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.<init>(Lorg/apache/xml/dtm/DTMManager;Ljavax/xml/transform/Source;ILorg/apache/xml/dtm/DTMWSFilter;Lorg/apache/xml/utils/XMLStringFactory;ZIZZ)V
      at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2.<init>(SAX2DTM2.java:1866)
      at org.apache.xalan.xsltc.dom.SAXImpl.<init>(SAXImpl.java:725)
      at
org.apache.xalan.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:351)
      at
org.apache.xalan.xsltc.dom.XSLTCDTMManager.getDTM(XSLTCDTMManager.java:228)
      at
org.apache.xalan.xsltc.trax.TransformerImpl.getDOM(TransformerImpl.java:437)
      at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:597)
      at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:277)
      at
com.xxxxx.apps.MapTuIt.GeocodeTransformerChain.transform(GeocodeTransformerChain.java:1312)
      at
com.xxxxx.apps.MapTuIt.GeocodeTransformerChain.main(GeocodeTransformerChain.java:1961)



-------------------------------------------------------------
Source data:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

<records>
    <record>
        <field name="GEOREQ-MESSAGE-TYPE">GEOREQ</field>
        <field name="GEOREQ-DATE-TIME">2004-07-29 12:28:15</field>
        <field name="GEOREQ-CLIENT-ID">xxxxx</field>
        <field name="GEOREQ-FLEET-ID"> </field>
        <field name="GEOREQ-TRUCK-ID"> </field>
        <field name="GEOREQ-DRIVER-ID"> </field>
        <field name="GEOREQ-LOAD-NUM"> </field>
        <field name="GEOREQ-REQUEST-ID"> </field>
        <field name="GEOREQ-ACTION">UPDATE</field>
        <field name="GEOREQ-OWNER-ID">SRMO42</field>
        <field name="GEOREQ-NAME">STONEY RIDGE TRUCK PLA</field>
        <field name="GEOREQ-STREET">125 HAMPTON LEBON RD</field>
        <field name="GEOREQ-STREET2">I75 EXIT 29 ROUTE 63 (TST)</field>
        <field name="GEOREQ-CITY">MONROE</field>
        <field name="GEOREQ-STATE">OH</field>
        <field name="GEOREQ-ZIP">45050 -</field>
        <field name="GEOREQ-COUNTRY">USA</field>
        <field name="GEOREQ-DEPT-ID">FUELSTN</field>
    </record>
</records>


-------------------------------------------------------------
Transformation script:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Doctype is handled by java wrapper transaction -->
    <xsl:output
            method="xml" version="1.0" encoding="UTF-8" indent="yes"
            doctype-public="__publicdoctype__"
            doctype-system="__systemdoctype__"
            omit-xml-declaration="no" />

<!-- xsl to convert JB Hunt "records/record/fields/field" XML layout to
Maptuit
     AttractionsML XML layout.

     Created: 20 March 2004
     Author: David Johnson JISADJ3
     Copyright (c) 2004 JB Hunt Transport Inc.       http://www.xxxxx.com

     Critical information:
         This is a configuration file.  Different versions exist for TEST
and
         PROD.

         The difference exists in the   <xsl:template name="Client">
element.
         ClientId for test is "xxxxxdev", and the ClientId for production
is
         "xxxxx".

     Basis of operation:
         Data is received from MQ in a COBOL copybook format and converted
to a
         "records/record/fields/field" xml format prior to this
transformation.

         The Attractions_ML DTD defines the calls as singletons, but this
         transform will also support batching by encapsulation in a batch
         parser within the master configuration file.

     See also:
         AttractionML_1.1.dtd from Maptuit corporation.
-->

<!-- todo: refactor and isolate ClientId into maptuit-environment.xml -->
  <xsl:template name="Client">
    <xsl:attribute name="ClientId">xxxxxdev</xsl:attribute>
  </xsl:template>




  <xsl:template match="/records">
    <Maptuit>
      <xsl:apply-templates select="record"/>
    </Maptuit>
  </xsl:template>





  <xsl:template match="record">
    <xsl:choose>
<!-- Fuel Request has separate DTD so it is in its own XSL transform -->

      <xsl:when test="field[@name='FUELREQ-FUNCTION'] = 'AddStations'">
        <xsl:call-template name="FuelLocation">
          <xsl:with-param name="operation" select="'AddStations'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="field[@name='FUELREQ-FUNCTION'] = 'UpdateStations'">
        <xsl:call-template name="FuelLocation">
          <xsl:with-param name="operation" select="'UpdateStations'"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="field[@name='FUELREQ-FUNCTION'] = 'DeleteStations'">
        <xsl:call-template name="FuelLocation">
          <xsl:with-param name="operation" select="'DeleteStations'"/>
        </xsl:call-template>
      </xsl:when>

      <xsl:when test="field[@name='GEOREQ-ACTION'] = 'INSERT'">
        <xsl:call-template name="AddAddressReq"/>
      </xsl:when>
      <xsl:when test="field[@name='GEOREQ-ACTION'] = 'UPDATE'">
        <xsl:call-template name="UpdateAddressReq"/>
      </xsl:when>
      <xsl:when test="field[@name='GEOREQ-ACTION'] = 'DELETE'">
        <xsl:call-template name="DelAddressReq"/>
      </xsl:when>

<!--      <xsl:when test="field[@name='DIRREQ-ACTION'] = 'DIRREQ'">-->
      <xsl:when test="field[@name='DIRREQ-MESSAGE-TYPE'] = 'DIRREQ'">
        <xsl:call-template name="TruckrouteReq"/>
      </xsl:when>
      <xsl:otherwise>
        <ERROR>FUELREQ-FUNCTION=&quot;<xsl:value-of
select="field[@name='FUELREQ-FUNCTION']"/>&quot;</ERROR>
        <ERROR>GEOREQ-FUNCTION=&quot;<xsl:value-of
select="field[@name='GEOREQ-ACTION']"/>&quot;</ERROR>
        <ERROR>DIRREQ-FUNCTION=&quot;<xsl:value-of
select="field[@name='DIRREQ-ACTION']"/>&quot;</ERROR>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>






  <xsl:template name="TruckrouteReq">
    <TruckrouteReq>

      <!--<xsl:attribute name="PlanType"></xsl:attribute>-->

      <xsl:attribute name="FleetId">
        <xsl:value-of select="field[@name='DIRREQ-FLEET-ID']"/>
      </xsl:attribute>

      <xsl:attribute name="TruckId">
        <xsl:value-of select="field[@name='DIRREQ-TRUCK-ID']"/>
      </xsl:attribute>

      <xsl:attribute name="DriverId">
        <xsl:value-of select="field[@name='DIRREQ-DRIVER-ID']"/>
      </xsl:attribute>

      <xsl:attribute name="LoadNum">
        <xsl:value-of select="field[@name='DIRREQ-LOAD-NUM']"/>
      </xsl:attribute>

      <xsl:attribute name="TransactionNum">
      <!--<xsl:attribute name="RequestId">-->
        <xsl:value-of select="field[@name='DIRREQ-REQUEST-ID']"/>
      </xsl:attribute>

      <xsl:attribute name="Units">
        <xsl:value-of select="'mi'"/>
      </xsl:attribute>

      <xsl:call-template name="Client"/>

      <RequestorType>
        <xsl:value-of
select="group-list[@name='DIRREQ-STOPS']/group[1]/field[@name='DIRREQ-REQUESTOR-TYPE']"/>
      </RequestorType>

      <Date>
        <xsl:value-of
select="group-list[@name='DIRREQ-STOPS']/group[1]/field[@name='DIRREQ-DATE-1']"/>
      </Date>

      <!-- Truck Stops -->
      <xsl:apply-templates select="group-list/group"/>

      <!--
      <Expired>
        <xsl:value-of
select="group-list[@name='DIRREQ-STOPS']/group[1]/field[@name='DIRREQ-EXPIRED-1']"/>
      </Expired>
      -->
    </TruckrouteReq>
  </xsl:template>


  <xsl:template match="group-list/group">
    <xsl:if test="@name='DIRREQ-STOPS'">
      <xsl:if test="string-length(field[@name='DIRREQ-TRUCK-STOP-TYPE']) >
0">

        <TruckStop>
          <xsl:if test="string-length(field[@name='DIRREQ-ACTION']) > 0">
            <Action>
              <xsl:value-of select="field[@name='DIRREQ-ACTION']"/>
            </Action>
          </xsl:if>

          <TruckStopType>
            <xsl:value-of select="field[@name='DIRREQ-TRUCK-STOP-TYPE']"/>
          </TruckStopType>



          <xsl:choose>

            <xsl:when test="string-length(field[@name='DIRREQ-OWNER-ID']) >
0">

              <OwnerID>
                <xsl:value-of select="field[@name='DIRREQ-OWNER-ID']"/>
              </OwnerID>

            </xsl:when>

            <xsl:otherwise>

              <Longitude>
                <xsl:value-of select="field[@name='DIRREQ-LONGITUDE']"/>
              </Longitude>

              <Latitude>
                <xsl:value-of select="field[@name='DIRREQ-LATITUDE']"/>
              </Latitude>

            </xsl:otherwise>

          </xsl:choose>

          <xsl:if test="string-length(field[@name='DIRREQ-CUSTOM-NOTE']) >
0">
            <CustomNote>
              <xsl:value-of select="field[@name='DIRREQ-CUSTOM-NOTE']"/>
            </CustomNote>
          </xsl:if>

        </TruckStop>
      </xsl:if>
    </xsl:if>

  </xsl:template>





  <xsl:template name="AddAddressReq">
    <AddAddressReq>
      <xsl:call-template name="Client"/>
      <AddLocationReq>
        <xsl:call-template name="Location"/>
      </AddLocationReq>
    </AddAddressReq>
  </xsl:template>






  <xsl:template name="UpdateAddressReq">
    <UpdateAddressReq>
      <xsl:call-template name="Client"/>

      <UpdateLocationReq>
        <xsl:call-template name="Location"/>
      </UpdateLocationReq>
    </UpdateAddressReq>
  </xsl:template>




  <xsl:template name="DelAddressReq">
    <DelAddressReq>
      <xsl:call-template name="Client"/>
      <xsl:call-template name="Location"/>
    </DelAddressReq>
  </xsl:template>





  <xsl:template name="Location">
    <!-- Kludge to allow MapTuit to identify fuel stations os that they
         can be added to the Fueling process after geocoding.  MapTuit
         has a trigger on the geocode table that recognizes this and
         migrates the geocoding to their fuel optimizing system.
    -->
    <xsl:choose>
      <xsl:when test="field[@name='GEOREQ-DEPT-ID']='FUELSTN'">
<!--        <OwnerID>fuel_<xsl:value-of
select="field[@name='GEOREQ-IDMS-ID']"/></OwnerID> -->
        <OwnerID>fuel_<xsl:value-of
select="field[@name='GEOREQ-OWNER-ID']"/></OwnerID>
      </xsl:when>

      <xsl:otherwise>
        <OwnerID><xsl:value-of
select="field[@name='GEOREQ-OWNER-ID']"/></OwnerID>
      </xsl:otherwise>
    </xsl:choose>

    <Name><xsl:value-of select="field[@name='GEOREQ-NAME']"/></Name>

    <Address>
      <Street><xsl:value-of
select="field[@name='GEOREQ-STREET']"/></Street>
      <xsl:if test="field[@name='GEOREQ-STREET2']!=''">
        <Street2><xsl:value-of
select="field[@name='GEOREQ-STREET2']"/></Street2>
      </xsl:if>
      <City><xsl:value-of select="field[@name='GEOREQ-CITY']"/></City>
      <State><xsl:value-of select="field[@name='GEOREQ-STATE']"/></State>
      <Zip><xsl:value-of select="field[@name='GEOREQ-ZIP']"/></Zip>
      <Country>
        <xsl:choose>
          <xsl:when test="field[@name='GEOREQ-COUNTRY'] =
'USA'">US</xsl:when>
          <xsl:when test="field[@name='GEOREQ-COUNTRY'] =
'MEX'">MX</xsl:when>
          <xsl:when test="field[@name='GEOREQ-COUNTRY'] =
'CAN'">CA</xsl:when>
        </xsl:choose>
      </Country>

    </Address>
  </xsl:template>







  <xsl:template name="FuelLocation">
    <xsl:param name="operation"/>
    <FuelManagementReq>
      <xsl:attribute name="Cmd"><xsl:value-of
select="$operation"/></xsl:attribute>
      <xsl:call-template name="Client"/>
      <Station>
        <xsl:attribute name="Id"><xsl:value-of
select="field[@name='FUELREQ-STA-ID']"/></xsl:attribute>

        <xsl:if test="boolean (number (field[@name='FUELREQ-ABS-PRICE']))">
          <AbsPrice><xsl:value-of
select="field[@name='FUELREQ-ABS-PRICE']"/></AbsPrice>
        </xsl:if>
        <xsl:if test="boolean (number (field[@name='FUELREQ-FEED-ID']))">
          <CostPlus><xsl:value-of
select="field[@name='FUELREQ-COST-PLUS']"/></CostPlus>
        </xsl:if>
        <FeedID><xsl:value-of
select="field[@name='FUELREQ-FEED-ID']"/></FeedID>
        <xsl:if test="field[@name='FUELREQ-NOTES'] != ''">
          <Note><xsl:value-of
select="field[@name='FUELREQ-NOTES']"/></Note>
        </xsl:if>
        <xsl:if test="boolean (number (field[@name='FUELREQ-RET-MINUS']))">
          <RetailMinus><xsl:value-of
select="field[@name='FUELREQ-RET-MINUS']"/></RetailMinus>
        </xsl:if>
        <StationID><xsl:value-of
select="field[@name='FUELREQ-STA-OWNER-ID']"/></StationID>
      </Station>
    </FuelManagementReq>
  </xsl:template>



</xsl:stylesheet>

David Johnson
Programmer Analyst
J. B. Hunt Transport
Information Services / OPR New Dev



Re: Problems running working XSLT scripts underTRAX

Posted by Da...@jbhunt.com.




... nevertheless, when I prepended the jar files to bootclasspath, it
worked.

Problem resolved.

Thanks

David Johnson
Programmer Analyst
J. B. Hunt Transport
Information Services / OPR New Dev




                                                                           
             David_Johnson@jbh                                             
             unt.com                                                       
                                                                        To 
             07/29/2004 01:43          xalan-j-users@xml.apache.org        
             PM                                                         cc 
                                                                           
                                                                   Subject 
                                       Re: Problems running working XSLT   
                                       scripts underTRAX                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           









I have also confirmed that I am running the correct version of xalan by
debugging into the xalan 2.6.0 source code.

David Johnson
Programmer Analyst
J. B. Hunt Transport
Information Services / OPR New Dev





Re: Problems running working XSLT scripts underTRAX

Posted by Da...@jbhunt.com.




I have also confirmed that I am running the correct version of xalan by
debugging into the xalan 2.6.0 source code.

David Johnson
Programmer Analyst
J. B. Hunt Transport
Information Services / OPR New Dev



Re: Problems running working XSLT scripts underTRAX

Posted by Da...@jbhunt.com.




Thanks for the response.  We are using the "endorsed standards" mechanism
to override this. The log indicates that we are using the correct xalan
version.

>From the configuration code:

    log.info( "JVM:\t" + System.getProperty("java.vm.vendor") +
                         " " + System.getProperty("java.vm.version") +
                         " (" + System.getProperty("java.vm.name") + ")");
    log.info( "JVM mode:\t" + System.getProperty("java.vm.info"));
    log.info( "Architecture:\t" + System.getProperty("os.arch"));
    log.info( "OS:\t" + System.getProperty("os.name"));
    log.info( "OS Version:\t" + System.getProperty("os.version"));
    log.info( "Xalan version:\t" +
                         org.apache.xalan.Version.getVersion());

>From the log file:

2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - Date:     Thu Jul 29
13:30:17 CDT 2004
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - Tester:   jisadj3
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - System:
XXXXXXXX/XXX.XXX.XXX.XXX
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - JVM:      Sun
Microsystems Inc. 1.4.1_02-b06 (Java HotSpot(TM) Client VM)
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - JVM mode: mixed mode
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - Architecture:   x86
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - OS: Windows XP
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - OS Version:     5.1
2004-07-29 13:30:17,226 [main] INFO
com.jbhunt.apps.MapTuIt.GeocodeTransformerChain - Xalan version:  Xalan
Java 2.6.0


David Johnson
Programmer Analyst
J. B. Hunt Transport
Information Services / OPR New Dev


Re: Problems running working XSLT scripts underTRAX

Posted by Joseph Kesselman <ke...@us.ibm.com>.



Looks like the standard version conflict. Start by checking:

http://xml.apache.org/xalan-j/faq.html#faq-N100CC

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk