ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Apache FOP - PDF generation in the broker

Post new topic  Reply to topic
 Apache FOP - PDF generation in the broker « View previous topic :: View next topic » 
Author Message
nickkirk
PostPosted: Wed Nov 03, 2010 10:49 am    Post subject: Apache FOP - PDF generation in the broker Reply with quote

Apprentice

Joined: 26 Sep 2008
Posts: 48

I am using fop-1.0.

The intension is to be able to create PDF docs using a Java Compute node.

The PDFs get converted to a BASE64 stream and sent to an external party.

I am getting an exception;
java.lang.UnsatisfiedLinkError: Can't load library: /opt/IBM/mqsi/7.0/lib/headless/libmawt.so

libmawt.xo is not at the requested directory.
Unfortunaely, I do not have root access to link to where it is ( /opt/IBM/mqsi/7.0/jre16/lib/amd64/headless ).

I have tried adding the /opt/IBM/mqsi/7.0/jre16/lib/amd64/headless path to PATH and LD_LIBRARY_PATH but with no luck.

Any help would be much appreciated.
Has anyone used FOP within the broker before ?
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Nov 03, 2010 10:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

libmawt sounds like it's binary support files for the Abstract Window Toolkit.

Likely you are not using a standalone version of fop, that can run in a displayless/headless mode, or you are otherwise doing something with fop to cause it to want to open up a user interface element.
Back to top
View user's profile Send private message
skidewd
PostPosted: Wed Nov 03, 2010 12:58 pm    Post subject: Re: Apache FOP - PDF generation in the broker Reply with quote

Novice

Joined: 20 Mar 2010
Posts: 12

nickkirk wrote:
I am using fop-1.0.
The intension is to be able to create PDF docs using a Java Compute node.


Are you trying to generate PDF docs for your flows or what else? Just as an FYI, Toolkit has an option for generating PDF docs - use toobar button next to 'print'.
Back to top
View user's profile Send private message
vikasmq
PostPosted: Thu Nov 04, 2010 8:15 am    Post subject: Reply with quote

Newbie

Joined: 17 Aug 2010
Posts: 7

If you called the FOP command line application from some other program, for example from Java using Runtime.exec(), it may hang while trying to write log entries to the output pipe. You have to read the FOP output regularly to empty the pipe buffer. It is best to avoid exec'ing FOP, use the library interface instead.
Back to top
View user's profile Send private message
vikasmq
PostPosted: Thu Nov 04, 2010 8:29 am    Post subject: Reply with quote

Newbie

Joined: 17 Aug 2010
Posts: 7

I was just hoping may be this code could help you a bit
Adding XSL tranformation (XSLT)
A common requirement is to transform an XML source to XSL-FO using an XSL transformation. It is recommended to use JAXP for this task. The following snippet shows the basic code:

private FopFactory fopFactory = FopFactory.newInstance();
private TransformerFactory tFactory = TransformerFactory.newInstance();

public void init() throws ServletException {
//Optionally customize the FopFactory and TransformerFactory here
}

[..]

//Setup a buffer to obtain the content length
ByteArrayOutputStream out = new ByteArrayOutputStream();

//Setup FOP
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);

//Setup Transformer
Source xsltSrc = new StreamSource(new File("foo-xml2fo.xsl"));
Transformer transformer = tFactory.newTransformer(xsltSrc);

//Make sure the XSL transformation's result is piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());

//Setup input
Source src = new StreamSource(new File("foo.xml"));

//Start the transformation and rendering process
transformer.transform(src, res);

//Prepare response
response.setContentType("application/pdf");
response.setContentLength(out.size());

//Send content to Browser
response.getOutputStream().write(out.toByteArray());
response.getOutputStream().flush();
Back to top
View user's profile Send private message
JLRowe
PostPosted: Wed Nov 10, 2010 5:11 am    Post subject: Re: Apache FOP - PDF generation in the broker Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

nickkirk wrote:
I am using fop-1.0.

The intension is to be able to create PDF docs using a Java Compute node.

The PDFs get converted to a BASE64 stream and sent to an external party.

I am getting an exception;
java.lang.UnsatisfiedLinkError: Can't load library: /opt/IBM/mqsi/7.0/lib/headless/libmawt.so

libmawt.xo is not at the requested directory.
Unfortunaely, I do not have root access to link to where it is ( /opt/IBM/mqsi/7.0/jre16/lib/amd64/headless ).

I have tried adding the /opt/IBM/mqsi/7.0/jre16/lib/amd64/headless path to PATH and LD_LIBRARY_PATH but with no luck.

Any help would be much appreciated.
Has anyone used FOP within the broker before ?


Yes, some java libs have dependencies on AWT or Swing classes, this has also been a problem with deploying code to the google app engine which has a similar restriction. Some libraries have responded to this by refactoring out the need for AWT/Swing libraries (e.g. freemarker).

You need to look a bit further into getting the native shared libraries picked up properly, otherwise use a different library that doesn't use AWT/Swing classes.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Apache FOP - PDF generation in the broker
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.