Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime exception while running the java application`

 
kavitha ananya
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting a runtime exception when i try to run the following piece of code.

FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
/*Setup output*/
OutputStream fileOut = new java.io.FileOutputStream(pdfFilePath);
fileOut = new java.io.BufferedOutputStream(fileOut);
try {
/*Construct fop with desired output format*/
//foUserAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, fileOut);
/*Setup XSLT*/
TransformerFactory factory = TransformerFactory.newInstance();
}

An exception is thrown in runtime when the following line of code is executed
TransformerFactory factory = TransformerFactory.newInstance();

Could anyone of you have an idea as to why is this happening...

PLEASE PLEASE PLEASE help me in this.. I have been trying on this from past 2 days....

The error is not displayed in the console but in the UI, the following message is displayed..
"javax.servlet.ServletException: Error calling action method of component with id searchInvoiceResult:userSearchResult:_id94
javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)"
..........................
which is nowhere related to the code, but while debugging i came to know that the pplications stops debugging once the above line of code is debugged..

Thanks
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch!

Admin Matter: Please do put your code inside the UBB code tags so that it can be easily read, e.g. , thanks!

Have you been able to stop the code in a debugger, you need to find out what the real exception is (Hint the newInstance() method actually throws a TransformerFactoryConfigurationError), also take a look at hte Javadoc to see how you should configure a TransformerFactory.

Hope that helps!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic