Page 1 of 1

Couldn't get resource: docx4j.properties

PostPosted: Wed Feb 08, 2012 1:43 pm
by rocha
Hi,

I'm trying to replace some code using the code below (inside a grails application). The replacement *seems* to be ok, but I get this error saving the file: "Couldn't get resource: docx4j.properties".

The docx file is attached (it contains brazilian words with accents)

Environment:
docx4j 2.7.1
JRE 1.6.0_29
Grails 2.0.0
Mac OS X (Lion)

Could some one please throw a light on this?

Thanks,
Andre

Code
Code: Select all
   def apply(docxTemplate) {
   
      Map sections = new HashMap()
      sections.put("educacao", "Andre")

      final String XPATH_TO_SELECT_TEXT_NODES = "//w:t"
      
      WordprocessingMLPackage template = WordprocessingMLPackage.load(docxTemplate)

      List texts = template.getMainDocumentPart()
            .getJAXBNodesViaXPath(XPATH_TO_SELECT_TEXT_NODES, true)
      for (Object obj : texts) {
         Text text = (Text) ((JAXBElement) obj).getValue()
         String textValue = text.getValue()
         for (Object key : sections.keySet()) {
            textValue = textValue.replaceAll(key, sections.get(key))
         }
         text.setValue(textValue)
      }

      // error happens here
      template.save(new File("/tmp/report11.docx"))
   }


Error
Code: Select all
Error 2012-02-08 10:54:16,899 [main] ERROR utils.ResourceUtils  - Couldn't get resource: docx4j.properties
Error 2012-02-08 10:54:16,901 [main] ERROR docx4j.Docx4jProperties  - Error reading docx4j.properties
2012-02-07 23:30:55,620 [main] ERROR StackTrace  - Full Stack Trace:
java.lang.NullPointerException
   at org.docx4j.utils.ResourceUtils.getResource(ResourceUtils.java:45)
   at org.docx4j.Docx4jProperties.init(Docx4jProperties.java:19)
   at org.docx4j.Docx4jProperties.getProperties(Docx4jProperties.java:34)
   at org.docx4j.openpackaging.io.SaveToZipFile.saveRawXmlPart(SaveToZipFile.java:207)
   at org.docx4j.openpackaging.io.SaveToZipFile.saveRawXmlPart(SaveToZipFile.java:194)
   at org.docx4j.openpackaging.io.SaveToZipFile.savePart(SaveToZipFile.java:410)
   at org.docx4j.openpackaging.io.SaveToZipFile.addPartsFromRelationships(SaveToZipFile.java:373)
   at org.docx4j.openpackaging.io.SaveToZipFile.save(SaveToZipFile.java:164)
   at org.docx4j.openpackaging.io.SaveToZipFile.save(SaveToZipFile.java:105)
   at org.docx4j.openpackaging.packages.WordprocessingMLPackage.save(WordprocessingMLPackage.java:219)
   at org.docx4j.openpackaging.packages.WordprocessingMLPackage$save.call(Unknown Source)

Re: Couldn't get resource: docx4j.properties

PostPosted: Wed Feb 08, 2012 3:08 pm
by rocha
The code is working fine with docx4j 2.7.0

Re: Couldn't get resource: docx4j.properties

PostPosted: Wed Feb 08, 2012 7:06 pm
by jason
You can add a file like http://www.docx4java.org/svn/docx4j/tru ... properties to your path if you want that to go away.

Re: Couldn't get resource: docx4j.properties

PostPosted: Fri Mar 17, 2017 9:28 pm
by Frederic
Not Found

The requested URL /svn/docx4j/trunk/docx4j/src/main/resources/docx4j.properties was not found on this server.

Apache/2.4.18 (Ubuntu) Server at www.docx4java.org Port 80


:(

Re: Couldn't get resource: docx4j.properties

PostPosted: Sat Mar 18, 2017 10:42 am
by jason
The thread you have replied to is over 5 years old.

We moved to GitHub a long time ago:-

https://github.com/plutext/docx4j/blob/ ... properties