sitimoen / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

Packaging xdocreport as a single JAR #310

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Unzip xdocreport JARs
2. Zip up xdocreport files to a single JAR
3. Deploy xdocreport uber-jar & invoke (generate DOCX from DOCX/Freemarker 
template)

What is the expected output? What do you see instead?
Expect DOCX generation as normal.

What version of the product are you using? On what operating system?
1.0.2. Windows 7.

Please provide any additional information below.
I'm attempting to use xDocreport with a commercial product called Documentum. 
I'm using it to read a DOCX/Freemarker template from a Documentum content 
repository then generate a DOCX document & save to the repository. In order to 
do this I'm having to use a Documentum extension framework called BOF. Now BOF 
isn't very good to be honest. I can register extensions with it but I am 
limited to how many JARs I can specify for the extension (its a hard-coded 
limit). The extension that I developed goes over this limit. So what I did was 
to merge all of the Xdocreport JARs into a single uber-jar. Registration of the 
extension now works but Xdocreport now throws errors like this:

DOCX merge failed: fr.opensagres.xdocreport.core.XDocReportException: Null 
template engine. Set template engine with IXDocReport#setTemplateEngine.

Is it OK to merge the Xdocreport JARs in this way or does it mess with how it 
performs its capability checks?

I should point out that Xdocreport works fine when I create DOCX documents 
outside Documentum using separate JARs.

Thanks

Mark

Original issue reported on code.google.com by ukdavo on 27 Sep 2013 at 12:47

GoogleCodeExporter commented 8 years ago
Hi Mark,

At first 1.0.3 will provide one JAR for XDocReport (but I think without 
dependencies like velocity.jar etc) . See 
https://code.google.com/p/xdocreport/issues/detail?id=264

I don't know if Pascal have finished this work. 
@Pascal could you tell me more information about your work please? Thank's!

> DOCX merge failed: fr.opensagres.xdocreport.core.XDocReportException: Null 
template > engine. Set template engine with IXDocReport#setTemplateEngine.
XDocReport uses SPI to register services, so your JAR should contains 

1) the META-INF/services files to regsiter velocity/freemarker template engine. 
2) You need to have velocity, freemarker etc JAR in your classpath.

Hope it will help you.

Regards Angelo

Original comment by angelo.z...@gmail.com on 27 Sep 2013 at 12:57

GoogleCodeExporter commented 8 years ago
Hi,

for 1.0.3-SNAPSHOT there a "uberjar" created to facilitate integration.
If you use maven,  coordinates are :

<dependency>

 <groupId>fr.opensagres.xdocreport</groupId>

 <artifactId>xdocreport</artifactId>

 <version>1.0.3-SNAPSHOT</version>

 </dependency>

You''ll need to add this repo is your pom.xml :
https://oss.sonatype.org/content/repositories/snapshots/

alternatively you can download directly the jar here :

https://oss.sonatype.org/content/repositories/snapshots/fr/opensagres/xdocreport
/xdocreport/1.0.3-SNAPSHOT/xdocreport-1.0.3-20130927.085906-10.jar

There is no transitive dependency declared so you may need add some other
jars :

- velocity (version 1.7) or freemaker  (version 2.3.16)

- iText 2.1.7

- odfdom-java 0.8.7

- poi-ooxml  3.8 & ooxml-schemas version 1.1

Please let me know if It works / how I can help. This is a new feature and
some improvement can be made...

Best regards.

Original comment by pascal.leclercq on 28 Sep 2013 at 9:45

GoogleCodeExporter commented 8 years ago
I've modified the POM to include the following dependencies:

freemarker 2.3.20
velocity 1.7
xdocreport 1.0.3-SNAPSHOT

Although I don't use Velocity templates I found that it threw a 
NoClassDefFoundError unless I included the Velocity JAR as a dependency. I then 
got an xDocReportException - 'Null template engine'. Do I need to add in POI 
now? I noticed that it wasn't a dependency under XDocReport 1.0.2.

Regards

Mark

Original comment by ukdavo on 30 Sep 2013 at 10:02

GoogleCodeExporter commented 8 years ago
Hi Mark, Pascal,

I have seen quickly the uber JAR (just downloaded 
xdocreport-1.0.3-20130927.085906-10.jar) and there are 2 problems : 

1) META-INF/services/* doesn't contains the whoel XDocReport discovery classes. 
For instance 
"META-INF/services/fr.opensagres.xdocreport.template.discovery.ITemplateEngineDi
scovery" contains only : 

--------------------------------------------------------------------------------
----
fr.opensagres.xdocreport.template.velocity.discovery.VelocityTemplateEngineDisco
very
--------------------------------------------------------------------------------
----

It should contains the 2 template engine implementation : 

--------------------------------------------------------------------------------
----
fr.opensagres.xdocreport.template.velocity.discovery.VelocityTemplateEngineDisco
very
fr.opensagres.xdocreport.template.freemarker.discovery.FreemarkerTemplateEngineD
iscovery
--------------------------------------------------------------------------------
----

I think it explains the error "'Null template engine'"

2) When discoveries are loaded (If I remember it's done ine AbstractRegistry) 
it throws an error when discovery cannot be done. It's the case when Velocity 
JAR is not in the  classpath and 
fr.opensagres.xdocreport.template.velocity.discovery.VelocityTemplateEngineDisco
very is loaded. 

To fix this problem, a try/catch should be done (is it possible?) as soon as a 
discovery is loaded, but if we do that, we must log the error.

Regards Angelo

Original comment by angelo.z...@gmail.com on 30 Sep 2013 at 12:27

GoogleCodeExporter commented 8 years ago
Ok the problem 2) (when Velocity JAR is not in the classpath) should be fixed 
(see 
https://code.google.com/p/xdocreport/source/diff?spec=svn2b28cf569ebe1bdba7bfa64
810501c633fdd3b10&r=2b28cf569ebe1bdba7bfa64810501c633fdd3b10&format=side&path=/c
ore/fr.opensagres.xdocreport.core/src/main/java/fr/opensagres/xdocreport/core/re
gistry/AbstractRegistry.java)

For the problem 1), Pascal will try to fix it as soon as possible when he will 
have time.

Original comment by angelo.z...@gmail.com on 30 Sep 2013 at 1:55

GoogleCodeExporter commented 8 years ago
Hi,

as Angelo said Problem 1) is now fixed.

You can use xdocreport with a maven pom containing.
<dependencies>
        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>xdocreport</artifactId>
            <version>1.0.3-SNAPSHOT</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>sonatype</id>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <url>http://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>

Or download directly here : 
https://oss.sonatype.org/content/repositories/snapshots/fr/opensagres/xdocreport
/xdocreport/1.0.3-SNAPSHOT/xdocreport-1.0.3-20130930.205913-11.jar (URL has 
changed)
Or use the jar attached...

Original comment by pascal.leclercq on 30 Sep 2013 at 9:20

Attachments:

GoogleCodeExporter commented 8 years ago
@Pascal, I have tested quicly and it works great. Well done!

I have modified the log level error to warn when discovery fails when it is 
loaded.

Original comment by angelo.z...@gmail.com on 1 Oct 2013 at 7:40

GoogleCodeExporter commented 8 years ago
Available for 1.0.3

Original comment by angelo.z...@gmail.com on 24 Oct 2013 at 12:02

GoogleCodeExporter commented 8 years ago
Issue 264 has been merged into this issue.

Original comment by angelo.z...@gmail.com on 24 Oct 2013 at 12:06

GoogleCodeExporter commented 8 years ago
cleanup

Original comment by pascal.leclercq on 10 Oct 2014 at 7:37