Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » DocX Template filling error
DocX Template filling error [message #1383959] Tue, 27 May 2014 12:53 Go to next message
Tim Schwalbe is currently offline Tim SchwalbeFriend
Messages: 27
Registered: May 2014
Junior Member
Hello I just started with Scout and I want to fill some Wordtemplates, but when I do so, there are some Failures.
Don't get confused because the excelFile Stuff, this is for a later functionality.
I Uploaded a docx for sure.
Can anyone help me please?
Shocked


private Boolean runReport() throws ProcessingException {
    //  copy original template file into temp file
    System.out.println("Inside Runreport: " + excelFile.getPath());
    File tmpFile = IOUtility.createTempFile(IOUtility.getTempFileName(".docx"), IOUtility.getContent(excelFile.getPath()));
    DocxAdapter docxFile = new DocxAdapter(tmpFile);
    //Map<String, String> variables = new HashMap<String, String>();

    // populate doc variables
    //variables.put("Unterschrift", "John");

    // fill in doc variables and create output file
    //docxFile.setFields(variables);
    // docxFile.saveAs("Testout");

    return true;
  }




Inside Runreport:C:\Users\Jack\Documents\FileName.docx
!SESSION 2014-05-27 14:48:19.384 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product de.mind.conversation.ui.swing.product
Command-line arguments:  -product de.mind.conversation.ui.swing.product -data C:\Users\Jack\workspace/../runtime-conversation-swing-client-dev.product -dev file:C:/Users/Jack/workspace/.metadata/.plugins/org.eclipse.pde.core/conversation-swing-client-dev.product/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.scout.commons 4 0 2014-05-27 14:48:39.043
!MESSAGE org.apache.log4j.Category.log(Category.java:272) Cannot initialize context
!STACK 0
javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index
 - with linked exception:
[javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index]
	at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
	at javax.xml.bind.ContextFinder.find(Unknown Source)
	at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
	at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
	at org.docx4j.jaxb.Context.<clinit>(Context.java:147)
	at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:665)
	at org.docx4j.openpackaging.io3.Load3.get(Load3.java:133)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:333)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:273)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:223)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:206)
	at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:159)
	at org.eclipse.scout.docx4j.DocxAdapter.createPackageFromFile(DocxAdapter.java:162)
	at org.eclipse.scout.docx4j.DocxAdapter.<init>(DocxAdapter.java:113)
	at de.mind.conversation.client.services.FillTemplateService.runReport(FillTemplateService.java:57)
	at de.mind.conversation.client.services.FillTemplateService.getFilledTemplate(FillTemplateService.java:76)
	at de.mind.conversation.client.PtrTool0Form$MainBox$UploadButton.execClickAction(PtrTool0Form.java:140)
	at org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton.doClick(AbstractButton.java:317)
	at org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton$P_UIFacade.fireButtonClickedFromUI(AbstractButton.java:446)
	at org.eclipse.scout.rt.ui.swing.form.fields.button.SwingScoutButton$3.run(SwingScoutButton.java:314)
	at org.eclipse.scout.rt.ui.swing.concurrency.SwingScoutSynchronizer$1.runVoid(SwingScoutSynchronizer.java:71)
	at org.eclipse.scout.rt.client.ClientJob.runStatus(ClientJob.java:189)
	at org.eclipse.scout.rt.client.ClientJob.runTransactionWrapper(ClientJob.java:172)
	at org.eclipse.scout.rt.client.ClientJob.run(ClientJob.java:159)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index
	at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
	... 25 more

!ENTRY org.eclipse.scout.commons 4 0 2014-05-27 14:48:39.059
!MESSAGE org.apache.log4j.Category.log(Category.java:272) Warning: Xalan jar missing from classpath; xslt not supported
!STACK 0
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
	at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
	at org.docx4j.XmlUtils.instantiateTransformerFactory(XmlUtils.java:209)
	at org.docx4j.XmlUtils.<clinit>(XmlUtils.java:120)
	at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:672)
	at org.docx4j.openpackaging.io3.Load3.get(Load3.java:133)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:333)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:273)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:223)
	at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:206)
	at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:159)
	at org.eclipse.scout.docx4j.DocxAdapter.createPackageFromFile(DocxAdapter.java:162)
	at org.eclipse.scout.docx4j.DocxAdapter.<init>(DocxAdapter.java:113)
	at de.mind.conversation.client.services.FillTemplateService.runReport(FillTemplateService.java:57)
	at de.mind.conversation.client.services.FillTemplateService.getFilledTemplate(FillTemplateService.java:76)
	at de.mind.conversation.client.PtrTool0Form$MainBox$UploadButton.execClickAction(PtrTool0Form.java:140)
	at org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton.doClick(AbstractButton.java:317)
	at org.eclipse.scout.rt.client.ui.form.fields.button.AbstractButton$P_UIFacade.fireButtonClickedFromUI(AbstractButton.java:446)
	at org.eclipse.scout.rt.ui.swing.form.fields.button.SwingScoutButton$3.run(SwingScoutButton.java:314)
	at org.eclipse.scout.rt.ui.swing.concurrency.SwingScoutSynchronizer$1.runVoid(SwingScoutSynchronizer.java:71)
	at org.eclipse.scout.rt.client.ClientJob.runStatus(ClientJob.java:189)
	at org.eclipse.scout.rt.client.ClientJob.runTransactionWrapper(ClientJob.java:172)
	at org.eclipse.scout.rt.client.ClientJob.run(ClientJob.java:159)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassNotFoundException: org/apache/xalan/processor/TransformerFactoryImpl
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at javax.xml.transform.FactoryFinder.getProviderClass(Unknown Source)
	at javax.xml.transform.FactoryFinder.newInstance(Unknown Source)
	at javax.xml.transform.FactoryFinder.find(Unknown Source)
	... 23 more
Re: DocX Template filling error [message #1383993 is a reply to message #1383959] Tue, 27 May 2014 17:38 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 990
Registered: October 2011
Senior Member
Have xalan in your classpath?

Please check in the client product file (Dependency tab).
index.php/fa/18148/0/

Do you see in the client product file, if you see these bundles:
* org.apache.xalan
* org.apache.xml.serializer

If not you need to add them with the "Add..." button.

When you choose the bundles, if you do not see the two bundles in the list, it means that you do not have them in the target platform.

The bundles are available on the Eclipse Orbit update site.

Do you know how to add them? If not feel free to ask.

* * *

If you use a target platform file (for the maven tycho build) the units you are looking for are:
<unit id="org.apache.xalan" version="2.7.1.v201005080400" />
<unit id="org.apache.xml.serializer" version="2.7.1.v201005080400" />

You can add them in the location corresponding to Orbit.

.

[Updated on: Tue, 27 May 2014 17:40]

Report message to a moderator

Re: DocX Template filling error [message #1384704 is a reply to message #1383959] Fri, 30 May 2014 14:56 Go to previous message
Clemens Stukenbrock is currently offline Clemens StukenbrockFriend
Messages: 1
Registered: May 2014
Junior Member
Hi,

furthermore you need to add a fragment to your product files.
This Fragment exports the necessary class entries which are required for docx4j.

Please find attached a sample fragement. If you encounter any problems while importing please let me know.

Kind regards
Previous Topic:Adding dynamic UI elements in scout
Next Topic:Scout & Swing LAF
Goto Forum:
  


Current Time: Fri Sep 04 01:53:41 GMT 2015

Powered by FUDForum. Page generated in 0.01479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software