This seems very similar to issue 4267. The issue is the GWT is
setting a system property, overriding the default transformer
factory. This causes the appengine server to get the wrong
transformer factory. The exception you are getting is not exactly the
same as the bug, but the circumstances are very similary. A
workaround is, in your servlet, set the system property yourself to
the java default. This should fix the server (although it might cause
an issue in the GWT client, if you are using XML). Note that this is
only an issue in the development server and not in production.
Here is the issue:
http://code.google.com/p/google-web-toolkit/issues/detail?id=4267
Please go and check this issue so it get's some attention.
Here is the line of code to set the property on the server to work
around the GWT bug:
//
// When using GWT with appengine, we must override
the
// default TransformerFactory because GWT writes an
invalid
// default that causes an exception when trying to
// render a XML Representation. This works around the
bug.
//
System.setProperty("javax.xml.transform.TransformerFactory",
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
On Jul 21, 5:42 am, Jan <
jan.morl...@googlemail.com> wrote:
> Hi,
>
> I would like to use an xsl transformation inside an HttpServlet. The
> code is essentially the following:
>
> File xslfile = new File("test.xsl");
> TransformerFactory factory = TransformerFactory.newInstance();
> factory.setAttribute( "debug", true );
> Transformer transformer = factory.newTransformer(new
> StreamSource( xslfile ) );
>
> I already made sure that the xsl file is valid and I defined it as
> resource-file inside appengine-web.xml
>
> If I now call the servlet the first time, the following error occurs:
>
> java.lang.ExceptionInInitializerError
> at
> com.sun.org.apache.bcel.internal.classfile.JavaClass.<init>(JavaClass.java:
> 109)
> at
> com.sun.org.apache.bcel.internal.classfile.JavaClass.<init>(JavaClass.java:
> 228)
> at
> com.sun.org.apache.bcel.internal.generic.ClassGen.getJavaClass(ClassGen.jav a:
> 174)
> at
> com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.translate(Style sheet.java:
> 735)
> at
> com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:
> 354)
> at
> com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:
> 429)
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemp lates(TransformerFactoryImpl.java:
> 795)
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTran sformer(TransformerFactoryImpl.java:
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemp lates(TransformerFactoryImpl.java:
> 828)
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTran sformer(TransformerFactoryImpl.java:
> com.sun.org.apache.bcel.internal.generic.ClassGen.getJavaClass(ClassGen.jav a:
> 174)
> at
> com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.translate(Style sheet.java:
> 735)
> at
> com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:
> 354)
> at
> com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:
> 429)
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemp lates(TransformerFactoryImpl.java:
> 795)
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTran sformer(TransformerFactoryImpl.java:
> 617)
> at com.axag.invoiceedit.server.PDFServlet.doGet(PDFServlet.java:240)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> 511)
> at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1166)
> at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFi lter.java:
> ...
>
> read more »