简体   繁体   中英

Barcode4j generate barcode error

I'm using Barcode4j and FOP to generate a PDF that contains a barcode. It works perfect on my Eclipse local environment, but after deploying to weblogic and accessing the function via web I get the following error:

ERROR: 'The first argument to the non-static Java function 'org.krysalis.barcode4j.xalan.BarcodeExt.generate(result-tree, result-tree)' is not a valid object reference.' FATAL ERROR: 'Could not compile stylesheet'

These are the sections of the stylesheet:

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:barcode="org.krysalis.barcode4j.xalan.BarcodeExt"
extension-element-prefixes="barcode"
exclude-result-prefixes="fo">

barcode generation:

<fo:instream-foreign-object>
<xsl:variable name="barcodeNumber">
  <xsl:value-of select="barcodeNumber" />
</xsl:variable>
<xsl:variable name="barcode-cfg">
  <barcode>
    <intl2of5>
    <height>18mm</height>
    <module-width>0.28mm</module-width>
    <human-readable><placement>none</placement>
            </human-readable>
    </intl2of5>
  </barcode>
</xsl:variable>
<xsl:copy-of select="barcode:generate($barcode-cfg, $barcodeNumber)" />

I'm using jdk 1.5.0_22, xalan-2.7.0, fop 1.1

Any help will be appreciated.

If you define a namespace prefix for the barcode extension, you also have to use it. Otherwise, Xalan won't find the Java class necessary. So, write "barcode:barcode" and not just "barcode".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM