JAXP XSLT - TransformerConfigurationException

A

asd

Hi all,

I am making a simple application which would transform a xml file
according to an xsl file.

There is an exception of which I have no clue what it is?

My code:
----------
import java.io.*;
import javax.xml.transform.*;
//import javax.xml.transform.stream.*;

public class Jax{
public static void main(String args[]) throws FileNotFoundException{

try{
File xmlFile = new File(args[0]);
File xslFile = new File(args[1]);

System.out.println("Created the file");

Source xmlSource = new
javax.xml.transform.stream.StreamSource(xmlFile);
System.out.println("Created XmlSource");

Source xslSource = new
javax.xml.transform.stream.StreamSource(xslFile);

Result result = new
javax.xml.transform.stream.StreamResult(System.out);
System.out.println("Created result");

TransformerFactory transFact = TransformerFactory.newInstance();
System.out.println("Created transFact" + transFact);

Transformer trans = transFact.newTransformer(xslSource);
System.out.println("Created trans");

trans.transform(xmlSource, result);
}catch(TransformerException tex){
System.out.println("tex occured :");

File output = new File("error.txt");
PrintStream ps = new PrintStream(new FileOutputStream(output));
tex.printStackTrace(ps);
ps.close();

}catch(Exception ex){
System.out.println("something else occured :");
System.out.println(ex.getMessage());
}
}
}

XML file:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<message>Yep, it worked!</message>

XSL file:
-----------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="text" encoding="UTF-8"/>

<!-- simply copy the message to the result tree -->
<xsl:template match="/">
<xsl:value-of select="message"/>
</xsl:template>
</xsl:stylesheet>

The error:
-------------
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.lang.NullPointerException
at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String)
(/usr/lib/./libgcj.so.3)
at 0x4025bcd2: java.lang.Exception.Exception(java.lang.String)
(/usr/lib/./libgcj.so.3)
at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
at 0x402306e8:
_Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
(/usr/lib/./libgcj.so.3)
at 0x40230ff4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
........
 
A

asd

diagnosed and terminated the error !!!!
PATH env variable did not have JAVA_HOME/bin

So some other jre was being used for execution of my simple application
and thus the crazy exceptions.

cheers,
ASD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top