drmacro / wordinator

Generate high-quality DOCX files using a simplified XML format (simple word processing XML).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command line exception

jdwinfodesign opened this issue · comments

Downloaded Release 1.1.2 and ran successfully in Oxygen. I want to see the SWPX, so copied and pasted the command from the README:
java -jar wordinator.jar -i html/sample_web_page.html -o out -x xsl/html2docx/html2docx.xsl -t docx/Test_Template.dotx
The result:
`PS C:\Users\jdwin\Documents\wordinator-sandbox> java -jar wordinator.jar -i html/sample_web_page.html -o out -x xsl/html2docx/html2docx.xsl -t docx/Test_Template.dotx
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.

  • 2023-05-22 07:48:00,661 [INFO ] Input document or directory='html/sample_web_page.html'
  • 2023-05-22 07:48:00,661 [INFO ] Output directory ='out'
  • 2023-05-22 07:48:00,661 [INFO ] DOTX template ='docx/Test_Template.dotx'
  • 2023-05-22 07:48:00,661 [INFO ] XSLT template ='xsl/html2docx/html2docx.xsl'
  • 2023-05-22 07:48:00,661 [INFO ] Catalog =Not specified
  • 2023-05-22 07:48:00,661 [INFO ] Chunk level ='root'
  • 2023-05-22 07:48:01,084 [INFO ] Making output directory 'C:\Users\jdwin\Documents\wordinator-sandbox\out'...
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.wordinator.xml2docx.MakeDocx.transformXml(MakeDocx.java:249)
    at org.wordinator.xml2docx.MakeDocx.handleCommandLine(MakeDocx.java:204)
    at org.wordinator.xml2docx.MakeDocx.main(MakeDocx.java:86)
    Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
    at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:573)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:598)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:585)
    at org.wordinator.xml2docx.generator.DocxGeneratingOutputUriResolver.(DocxGeneratingOutputUriResolver.java:27)
    ... 3 more`

The problem is something to do with your classpath. To diagnose it we need to know how you invoked Java, what your classpath was, and how the jar you're referring to was built.

I believe this is fixed on the develop branch--it's an issue with how the logging libraries are used (52bbfc7).

If you can build from source, try checking out develop branch, do mvn clean install and run the all-dependencies jar from the target/ directory.

If you're not able to build from source, let me know and I can make a jar for you.

The problem is something to do with your classpath.

I was using the default JRE for Windows 11, which is a Java SE. I'm so used to running builds in Oxygen, I don't even have JAVA_HOME set on my machine. Should I set JAVA_HOME to a JDK instead?

I think @drmacro's tip is better than mine.

@drmacro Build failed. I ran it a second time with error and debug switches and info piped to a text file.

log.txt