I have been fighting a problem with writing an XSLT applet for several
days now.
The following code works in a command line application, and in the
applet viewer for provided with IBM eclipse. It fails in any browser,
and in the Java SDK's applet viewer.
The line marked below has an uncaught exception that shows the following
text:
Usually code that works in an application and fails in an applet is the
result of a classpath problem. I am using xalan and xerces in this
case, both of which are in the classpath.
Any suggestions regarding the origins of this problem are welcome.
Thank you,
Ben Jones
----------------------------------------------------------------------
java.lang.Excep tionInInitializ erError
at java.lang.Class .forName0(Nativ e Method)
at java.lang.Class .forName(Unknow n Source)
at org.apache.xala n.serialize.Ser ializerFactory. getSerializer(U nknown
Source)
at
org.apache.xala n.transformer.T ransformerImpl. createResultCon tentHandler(Unk nown
Source)
at
org.apache.xala n.transformer.T ransformerImpl. createResultCon tentHandler(Unk nown
Source)
at org.apache.xala n.transformer.T ransformerImpl. transform(Unkno wn Source)
at org.apache.xala n.transformer.T ransformerImpl. transform(Unkno wn Source)
at
com.integretech pub.mathmltools .EquationTransf ormer.appletEqu ationForm(Equat ionTransformer. java:109)
at
com.integretech pub.mathmltools .EquationTransf ormer.init(Equa tionTransformer .java:334)
at sun.applet.Appl etPanel.run(Unk nown Source)
at java.lang.Threa d.run(Unknown Source)
Caused by: java.lang.Runti meException: The resource [ XMLEntities.res ]
could not load: java.net.Malfor medURLException : no protocol:
XMLEntities.res
XMLEntities.res java.net.Malfor medURLException : no protocol:
XMLEntities.res
at org.apache.xala n.serialize.Cha rInfo.<init>(Un known Source)
at org.apache.xala n.serialize.Ser ializerToXML.<c linit>(Unknown Source)
... 11 more
java.lang.Excep tionInInitializ erError
at java.lang.Class .forName0(Nativ e Method)
at java.lang.Class .forName(Unknow n Source)
at org.apache.xala n.serialize.Ser ializerFactory. getSerializer(U nknown
Source)
at
org.apache.xala n.transformer.T ransformerImpl. createResultCon tentHandler(Unk nown
Source)
at
org.apache.xala n.transformer.T ransformerImpl. createResultCon tentHandler(Unk nown
Source)
at org.apache.xala n.transformer.T ransformerImpl. transform(Unkno wn Source)
at org.apache.xala n.transformer.T ransformerImpl. transform(Unkno wn Source)
at
com.integretech pub.mathmltools .EquationTransf ormer.appletEqu ationForm(Equat ionTransformer. java:109)
at
com.integretech pub.mathmltools .EquationTransf ormer.init(Equa tionTransformer .java:334)
at sun.applet.Appl etPanel.run(Unk nown Source)
at java.lang.Threa d.run(Unknown Source)
Caused by: java.lang.Runti meException: The resource [ XMLEntities.res ]
could not load: java.net.Malfor medURLException : no protocol:
XMLEntities.res
XMLEntities.res java.net.Malfor medURLException : no protocol:
XMLEntities.res
at org.apache.xala n.serialize.Cha rInfo.<init>(Un known Source)
at org.apache.xala n.serialize.Ser ializerToXML.<c linit>(Unknown Source)
... 11 more
----------------------------------------------------------------------
public String appletEquationF orm(){
String eqnForm=new String();
eqnForm="thangs ";
String xsl=this.getXSL Transform();
String xml=this.mathML Input;
Source xmlSource=new StreamSource(ne w StringReader(xm l));
Source xslSource=new StreamSource(ne w StringReader(xs l));
StringWriter eqnWriter=new StringWriter(40 96);
StreamResult eqnResult=new StreamResult(eq nWriter);
Result eqnTestResult=n ew StreamResult(Sy stem.out);
javax.xml.trans form.Transforme rFactory transFact=
javax.xml.trans form.Transforme rFactory.newIns tance();
StringWriter osw = new StringWriter();
PrintWriter pw = new PrintWriter(osw , false);
try{
javax.xml.trans form.Transforme r
trans=transFact .newTransformer (xslSource);
//
//-----------------------------------------------------------------------------------------------------
// THIS IS THE LINE THE BLOWS AN UNCAUGHT EXCEPTION
//-------------------------------------------------------------------------------------------------------
trans.transform (xmlSource,new StreamResult(pw ));
//StringBuffer sb=eqnWriter.ge tBuffer();
//eqnForm=sb.toSt ring();
}
catch(Transform erConfiguration Exception e){
System.out.prin tln("Caught Exception "+e);
e.printStackTra ce();
return("<math>< matherr/><text>Configur ation Exception</text></math>");
}
catch(Transform erException f){
System.out.prin tln("Caught Exception "+f);
f.printStackTra ce(System.out);
return("<math>< matherr/><text>Configur ation Exception</text></math>");
}
return(eqnForm) ;
}