Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException: org.w3c.dom.html2.HTMLDocument #22

Open
manuelp opened this issue Jan 2, 2012 · 1 comment
Open

ClassNotFoundException: org.w3c.dom.html2.HTMLDocument #22

manuelp opened this issue Jan 2, 2012 · 1 comment
Milestone

Comments

@manuelp
Copy link

manuelp commented Jan 2, 2012

When I try to render a PDF I get the following exception:

Oops: CConvertException
An unexpected error occured caused by exception CConvertException: ERROR: An unhandled exception occured: org/w3c/dom/html2/HTMLDocument

play.exceptions.UnexpectedException: Unexpected Error
    at play.modules.pdf.RenderPDFTemplate.apply(RenderPDFTemplate.java:102)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:244)
    at Invocation.HTTP Request(Play!)
Caused by: org.allcolor.yahp.converter.IHtmlToPdfTransformer$CConvertException: ERROR: An unhandled exception occured: org/w3c/dom/html2/HTMLDocument
    at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:809)
    at play.modules.pdf.RenderPDFTemplate.renderDoc(RenderPDFTemplate.java:142)
    at play.modules.pdf.RenderPDFTemplate.renderPDF(RenderPDFTemplate.java:118)
    at play.modules.pdf.RenderPDFTemplate.apply(RenderPDFTemplate.java:100)
    ... 2 more
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/html2/HTMLDocument
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.allcolor.xml.parser.CDomHandler.<init>(CDomHandler.java:135)
    at org.allcolor.xml.parser.CShaniDomParser.<init>(CShaniDomParser.java:382)
    at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.getCShaniDomParser(CHtmlToPdfFlyingSaucerTransformer.java:439)
    at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:581)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.html2.HTMLDocument
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 21 more
13:38:18,401 ERROR ~ 

Probably it's the same issue that arised in the closed issues #8 and #9 (caused by the YaHP library?).

I also have some dependencies to render XLS documents:

    - org.apache.poi -> poi 3.7
    - net.sf.jxls -> jxls-core 1.0-RC-2

Unfortunately, I'm currently unable to generate PDF documents.

@adrianhurt
Copy link

I had the same problem while trying to use excel and pdf modules together. I found a provisional solution updating the xml-apis.jar with xml-apis-2.0.2.jar because the libraries of pdf module were older than those the excel module needs. And then I got your exact problem. This is because after updating there were some classes missed. So I had to create a new custom jar with the classes contained in "org/w3c/dom/html2/" of the old xml-apis.jar. And that's all! For the time being it's working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants