hydralix / docbkx-tools

Automatically exported from code.google.com/p/docbkx-tools
0 stars 0 forks source link

NullPointerException in docbkx:generate-pdf 2.0.8 #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  mvn -e clean install

2. Plugin-declaration in the POM:

 <plugin>
                <groupId>com.agilejava.docbkx</groupId>
                <artifactId>docbkx-maven-plugin</artifactId>
                <version>2.0.8</version>
                <configuration>

<sourceDirectory>${basedir}/src/docbkx/sad</sourceDirectory>
                    <chapterAutolabel>1</chapterAutolabel>
                    <sectionAutolabel>1</sectionAutolabel>
                    <appendixAutolabel>1</appendixAutolabel>
                    <sectionLabelIncludesComponentLabel>
                        1
                    </sectionLabelIncludesComponentLabel>
                    <bodyStartIndent>0pt</bodyStartIndent>
                    <paperType>A4</paperType>
                    <fopExtensions>1</fopExtensions>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-html</goal>
                            <goal>generate-pdf</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.docbook</groupId>
                        <artifactId>docbook-xml</artifactId>
                        <version>4.4</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
            </plugin>

I can send you the docbook xml source separately if you need it to
reproduce this problem.

What is the expected output? What do you see instead?

Expected "BUILD SUCCESFUL" and a pdf-file.

Instead:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to transform document.

Embedded error: java.lang.NullPointerException
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to transform
document.
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycl
eExecutor.java:564)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(Def
aultLifecycleExecutor.java:480)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycle
Executor.java:459)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:311)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultL
ifecycleExecutor.java:278)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExec
utor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to
transform document.
        at
com.agilejava.docbkx.maven.AbstractPdfMojo.postProcessResult(AbstractPdfMojo.jav
a:93)
        at
com.agilejava.docbkx.maven.AbstractTransformerMojo.execute(AbstractTransformerMo
jo.java:174)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.ja
va:447)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycl
eExecutor.java:539)
        ... 16 more
Caused by: javax.xml.transform.TransformerException:
java.lang.NullPointerException
        at
com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:61)
        at
com.agilejava.docbkx.maven.AbstractPdfMojo.postProcessResult(AbstractPdfMojo.jav
a:85)
        ... 19 more
Caused by: java.lang.NullPointerException
        at
org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:264)
        at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:171)
        at com.icl.saxon.aelfred.SAXDriver.parse(SAXDriver.java:334)
        at
com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:59)
        ... 20 more
[INFO] ------------------------------------------------------------------------

What version of the product are you using? On what operating system?

Maven version: 2.0.8
Java version: 1.6.0_03
OS name: "linux" version: "2.6.22-14-generic" arch: "i386" Family: "unix"

Original issue reported on code.google.com by emalo...@gmail.com on 10 Mar 2008 at 10:05

GoogleCodeExporter commented 9 years ago
Hello,

can you send me the XML file cause I am not able to find the error in the stack
trace. More debug is needed ...

Regards,
Mimil

Original comment by MimilO...@gmail.com on 30 Jun 2008 at 9:04

GoogleCodeExporter commented 9 years ago

Original comment by emalo...@gmail.com on 20 Jan 2009 at 10:34

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

I tested on trunk and I do not have NPE by the way I had a strange exception:

Embedded error: org.apache.fop.apps.FOPException: null:1:29350: Error(1/29350):
No element mapping definition found for (Namespace URI: "http://xml.apache.org/f
op/extensions", Local Name: "destination")
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to transform to P
DF
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:583)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:499)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:478)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:330)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:291)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to transform t
o PDF
        at com.agilejava.docbkx.maven.AbstractPdfMojo.postProcessResult(Abstract
PdfMojo.java:117)
        at com.agilejava.docbkx.maven.AbstractTransformerMojo.execute(AbstractTr
ansformerMojo.java:227)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:451)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:558)
        ... 16 more
Caused by: javax.xml.transform.TransformerException: org.apache.fop.apps.FOPExce
ption: null:1:29350: Error(1/29350): No element mapping definition found for (Na
mespace URI: "http://xml.apache.org/fop/extensions", Local Name: "destination")
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:501)
        at com.agilejava.docbkx.maven.AbstractPdfMojo.postProcessResult(Abstract
PdfMojo.java:105)
        ... 19 more
Caused by: org.apache.fop.apps.FOPException: null:1:29350: Error(1/29350): No el
ement mapping definition found for (Namespace URI: "http://xml.apache.org/fop/ex
tensions", Local Name: "destination")
        at org.apache.fop.fo.ElementMappingRegistry.findFOMaker(ElementMappingRe
gistry.java:143)
        at org.apache.fop.fo.FOTreeBuilder.findFOMaker(FOTreeBuilder.java:190)
        at org.apache.fop.fo.FOTreeBuilder.access$300(FOTreeBuilder.java:51)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
der.java:275)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
nsformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
ce)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:484)
        ... 20 more

Not sure we are for something here maybe a catalogue entry somewhere.
By the way I did the following modifications on your pom to have something 
working:

-<fopExtensions>1</fopExtensions>
+<useExtensions>1</useExtensions>

I will check at work because I am sure to have something working with both of 
these
attributes in the same time.

So is there any luck you can try with the latest docbkx-tools version 
(2.0.9-SNAPSHOT)?

PS: I added the generated PDF

Original comment by MimilO...@gmail.com on 2 Mar 2009 at 9:04

Attachments:

GoogleCodeExporter commented 9 years ago
Hi MimilOwns:
  If we change the <fopExtensions>1</fopExtensions> to
<useExtensions>1</useExtensions>, there would be no "bookmark" in the generated 
pdf. 

  I had done some searching in the google, then somebody said that is because The
http://xml.apache.org/fop/extensions namespace has changed to
http://xmlgraphics.apache.org/fop/extensions for FOP versions 0.90 and higher.

  So if docbkx-tools could fix this bug, it will be a big help for me.

  Thank you.

Original comment by xyz20...@gmail.com on 7 Jul 2009 at 10:56

GoogleCodeExporter commented 9 years ago
Hi,

Did you try with 2.0.9 version of the plugin? Because all this stuff is on the
docbook stylesheets side.
The 2.0.9 use a more recent version of docbook stylesheets so I hope it is 
synched
with fop namespaces.

Regards,
Mimil,

Original comment by MimilO...@gmail.com on 7 Jul 2009 at 3:21

GoogleCodeExporter commented 9 years ago
After some search in google, I found the problem is I used wrong property.
I changed <fop.extensions> to <fop1.extensions>, then it works well.
Sorry for that.
Thank you for reply.

PS: I saw there is "docbook-xsl-ns-1.73.2.zip" and "xslthl-1.3.zip" in the 
trunk, why
not using the latest "docbook-xsl-ns-1.75.1.zip" and "xslthl-2.0.1.zip"?

Original comment by xyz20...@gmail.com on 7 Jul 2009 at 3:58

GoogleCodeExporter commented 9 years ago
okay, nice you found out how to solve the problem, it will certainly help other 
users.

concerning the latest docbook versions, I started on the trunk 
(2.0.10-SNAPSHOT) to
directly reply on the docbook artifacts I also made:

<dependency>
      <groupId>net.sf.xslthl</groupId>
      <artifactId>xslthl</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>net.sf.docbook</groupId>
      <artifactId>docbook-xsl</artifactId>
      <version>1.75.0</version>
      <type>zip</type>
      <classifier>ns-resources</classifier>
    </dependency>
    <dependency>
      <groupId>net.sf.docbook</groupId>
      <artifactId>docbook-xsl-saxon</artifactId>
      <version>1.0.0</version>
    </dependency>

Concerning the xslthl lib, I asked if they can (or I can) make it available in 
maven
repositories.

Regards,
Mimil,  

Original comment by MimilO...@gmail.com on 7 Jul 2009 at 5:20

GoogleCodeExporter commented 9 years ago
- xslthl is now synched with maven central repository
- concerning this issue I think we can say that this error is related to 
docbook and
fop, so I will close it.

Mimil,

Original comment by MimilO...@gmail.com on 24 Aug 2009 at 8:57