You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Robert Koberg <ro...@koberg.com> on 2001/10/02 22:15:33 UTC
XSLTC Xalan samples
I am trying to get some of the translet examples to work but I keep getting
an error(as in my previous post about XSLTC today):
java.lang.NoClassDefFoundError: de/fub/bytecode/generic/InstructionConstants
etc...
Can anybody tell me what is causing this? Or tell me just how to fix the
problem?
My jdk1.3/jre/lib/jaxp.properties has the following:
javax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.runtime.Transf
ormerFactoryImpl
javax.xml.parsers.DocumentBuilderFactory=javax.xml.parsers.DocumentBuilderFa
ctory
javax.xml.parsers.SAXParserFactory=javax.xml.parsers.SAXParserFactory
-- Please help!!!
thanks,
-Rob
RE: Templates object created but still TransformerConfigurationException
Posted by Robert Koberg <ro...@koberg.com>.
I did not mention this, but I did change the filename to use and underscore
char instead of a dash, but I still get the same error. THat is why I was
wondering about WEB-INF.
best,
-Rob
> -----Original Message-----
> From: Robert Koberg [mailto:rob@koberg.com]
> Sent: Friday, October 05, 2001 12:22 PM
> To: xalan-dev@xml.apache.org
> Cc: xsltc-team@east.sun.com
> Subject: RE: Templates object created but still
> TransformerConfigurationException
>
>
> When I set the template I use the full path to the file:
> file:/home/gudgeon/sites/master/WEB-INF/tool/site_chooser.xsl
> // /WEB-INF/tool/site_chooser.xsl
> String value = (String) CONTEXT.getInitParameter("site_chooser");
> xsl = CONTEXT.getResource(value).toString();
>
> Since I am not in the same directory as the servlet will the base name use
> the entire URI? If this is the case, it is a MAJOR problem
> because I cannot
> rename WEB-INF. Is this the case?
>
> WEB-INF in a j2ee servlet container is a protected directory.
> ANything below
> will be blocked by an http request. So I keep all my XML content and XSL
> stylesheets under there.
>
> Note: this works fine when I don't use templates.
>
> best,
> -Rob
>
>
> > -----Original Message-----
> > From: Tom Amiro [mailto:Tom.Amiro@sun.com]
> > Sent: Friday, October 05, 2001 12:05 PM
> > To: Robert Koberg
> > Cc: Tom.Amiro@sun.com; xalan-dev@xml.apache.org; xsltc-team@east.sun.com
> > Subject: Re: Templates object created but still
> > TransformerConfigurationException
> >
> >
> > Hi Robert,
> >
> > Thanks for sending the files. I know what the problem is and
> > you can work around it for now. The stylesheet has a hypen
> > in the name (site-chooser.xsl). The generated class file
> > and auxilliary files get the basename site_chooser. So
> > the class is not being found. For now could you name
> > your stylesheets without any hyphens in them?
> >
> > I know realize that this problem is a duplicate of
> > bug 2399 on "ClassLoaders for WAS Often Fail on compiled
> > classes". I'll add some info to that bug.
> >
> > Tom
> >
>
RE: Templates object created but still TransformerConfigurationException
Posted by Robert Koberg <ro...@koberg.com>.
When I set the template I use the full path to the file:
file:/home/gudgeon/sites/master/WEB-INF/tool/site_chooser.xsl
// /WEB-INF/tool/site_chooser.xsl
String value = (String) CONTEXT.getInitParameter("site_chooser");
xsl = CONTEXT.getResource(value).toString();
Since I am not in the same directory as the servlet will the base name use
the entire URI? If this is the case, it is a MAJOR problem because I cannot
rename WEB-INF. Is this the case?
WEB-INF in a j2ee servlet container is a protected directory. ANything below
will be blocked by an http request. So I keep all my XML content and XSL
stylesheets under there.
Note: this works fine when I don't use templates.
best,
-Rob
> -----Original Message-----
> From: Tom Amiro [mailto:Tom.Amiro@sun.com]
> Sent: Friday, October 05, 2001 12:05 PM
> To: Robert Koberg
> Cc: Tom.Amiro@sun.com; xalan-dev@xml.apache.org; xsltc-team@east.sun.com
> Subject: Re: Templates object created but still
> TransformerConfigurationException
>
>
> Hi Robert,
>
> Thanks for sending the files. I know what the problem is and
> you can work around it for now. The stylesheet has a hypen
> in the name (site-chooser.xsl). The generated class file
> and auxilliary files get the basename site_chooser. So
> the class is not being found. For now could you name
> your stylesheets without any hyphens in them?
>
> I know realize that this problem is a duplicate of
> bug 2399 on "ClassLoaders for WAS Often Fail on compiled
> classes". I'll add some info to that bug.
>
> Tom
>
Re: Templates object created but still TransformerConfigurationException
Posted by Tom Amiro <To...@sun.com>.
Hi Robert,
Thanks for sending the files. I know what the problem is and
you can work around it for now. The stylesheet has a hypen
in the name (site-chooser.xsl). The generated class file
and auxilliary files get the basename site_chooser. So
the class is not being found. For now could you name
your stylesheets without any hyphens in them?
I know realize that this problem is a duplicate of
bug 2399 on "ClassLoaders for WAS Often Fail on compiled
classes". I'll add some info to that bug.
Tom
Templates object created but still TransformerConfigurationException
Posted by Robert Koberg <ro...@koberg.com>.
I have tried Tom's example but I am still having problems. I am attaching my
file for Tom (if anybody else is willing to take a look I would be more than
happy to send it!). The template is created as it shows in the console
output. I explicitly set the system properties for the factories like this:
System.setProperty("javax.xml.transform.TransformerFactory",
"org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory",
"org.apache.xerces.jaxp.SAXParserImpl");
The ERROR that is thrown says there is a TransformerConfigurationException
and that the template does not contain a valid translet class definition.
What do I do to fix this?
TIA,
-Rob
---------------------------
My CONSOLE says that the template is created:
xsl: file:/home/gudgeon/sites/master/WEB-INF/tool/site-chooser.xsl
in the try
xslSource is javax.xml.transform.stream.StreamSource@52c4d9
tFactory is org.apache.xalan.xsltc.trax.TransformerFactoryImpl@72380
template is org.apache.xalan.xsltc.trax.TemplatesImpl@7725c4
in doPost, templates is org.apache.xalan.xsltc.trax.TemplatesImpl@7725c4
---------------------------
But I get this error in the browser (any ideas???):
javax.xml.transform.TransformerConfigurationException: This template does
not contain a valid translet class definition.
at
org.apache.xalan.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.java:
199)
at com.koberg.makecontent.MasterLogin.doPost(MasterLogin.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:8
2)
at com.caucho.server.http.Invocation.service(Invocation.java:277)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:216)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:158)
at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java:484)
Re: XSLTC Xalan samples
Posted by Tom Amiro <To...@Sun.COM>.
Sorry I didn't think of this before, but the exception
>de/fub/bytecode/generic/InstructionConstants
>java.lang.NoClassDefFoundError: de/fub/bytecode/generic/InstructionConstants
implies you don't have BCEL.jar in your CLASSPATH.
I'm using Tomcat and have the following classpath, which lets me run both Xalan and XSLTC
servlets.
setenv CLASSPATH
.:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/crimson.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/jaxp.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/xerces.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/xsltc.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/xalan.jar:/usr/local/tomcat/webapps/calendar/WEB_INF/classes/calendar:/usr/local/tomcat/webapps/calendar/WEB-INF/classes::/usr/local/tomcat/webapps/calendar/WEB-INF/lib/runtime.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/BCEL.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/java_cup.jar:/usr/local/tomcat/webapps/calendar/WEB-INF/lib/JLex.jar:/usr/local/tomcat/lib/ant.jar:/usr/local/tomcat/lib/jasper.jar:/usr/local/tomcat/lib/jaxp.jar:/usr/local/tomcat/lib/parser.jar:/usr/local/tomcat/lib/servlet.jar:/usr/local/tomcat/lib/test:/usr/local/tomcat/lib/webserver.jar:/usr/local/j2sdk/lib/tools.jar:/usr/local/j2sdk/lib/dt.jar
Tom
RE: XSLTC Xalan samples
Posted by Robert Koberg <ro...@koberg.com>.
Hi, Thanks for answering!
I am using xalan-j_2_1_0 (the latest stable build, which I should have
mentioned...) and when I look in the xsltc.jar I see the path I am using -
so that can't be it. Or should I be using the beta code? I haven't been
having problems with SAX, so I think those lines are OK. I made a simple
example to hopefully narrow it down but I still get the same message (which
is useless to me, unfortunately).
Here is the simple servlet:
package com.koberg.makecontent;
import java.io.*;
import java.util.*;
import java.net.URL;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xalan.xsltc.compiler.*;
import org.apache.xalan.xsltc.compiler.util.*;
import org.apache.xalan.xsltc.util.getopt.*;
public class Test extends HttpServlet {
public void init() throws ServletException {
newTransformer();
}
public void newTransformer() {
XSLTC xsltc = new XSLTC();
}
}
------------------------------------------------
This still gives the error:
[2001/10/02 13:37:28] com.koberg.makecontent.Test: init
[2001/10/02 13:37:28] de/fub/bytecode/generic/InstructionConstants
java.lang.NoClassDefFoundError: de/fub/bytecode/generic/InstructionConstants
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at org.apache.xalan.xsltc.compiler.XSLTC.<init>(XSLTC.java:138)
at com.koberg.makecontent.Test.newTransformer(Test.java:21)
at com.koberg.makecontent.Test.init(Test.java:17)
at javax.servlet.GenericServlet.init(GenericServlet.java:82)
at com.caucho.server.http.Application.createServlet(Application.java:2212)
at com.caucho.server.http.Application.loadServlet(Application.java:2169)
at com.caucho.server.http.Application.initServlets(Application.java:1404)
at com.caucho.server.http.Application.init(Application.java:1359)
at com.caucho.server.http.VirtualHost.init(VirtualHost.java:456)
at com.caucho.server.http.ServletServer.initHosts(ServletServer.java:480)
at com.caucho.server.http.ServletServer.init(ServletServer.java:386)
at com.caucho.server.http.ServletServer.<init>(ServletServer.java:214)
at com.caucho.server.http.ResinServer.init(ResinServer.java:279)
at com.caucho.server.http.ResinServer.main(ResinServer.java:852)
at com.caucho.server.http.HttpServer.main(HttpServer.java:93)
[2001/10/02 13:37:28] can't load servlet `Test'
> -----Original Message-----
> From: Tom Amiro [mailto:Tom.Amiro@Sun.COM]
> Sent: Tuesday, October 02, 2001 1:47 PM
> To: xalan-dev@xml.apache.org
> Subject: Re: XSLTC Xalan samples
>
>
>
>
> Robert Koberg wrote:
> >
> > I am trying to get some of the translet examples to work but I
> keep getting
> > an error(as in my previous post about XSLTC today):
> >
> > java.lang.NoClassDefFoundError:
> de/fub/bytecode/generic/InstructionConstants
> > etc...
> >
> > Can anybody tell me what is causing this? Or tell me just how to fix the
> > problem?
> >
> > My jdk1.3/jre/lib/jaxp.properties has the following:
> >
> javax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.runt
> ime.Transf
> > ormerFactoryImpl
>
> There was a change in the location of the TransformerFactoryImpl. It is
> under org.apache.xalan.xsltc.trax.TransformerFactoryImpl.
>
>
> >
> javax.xml.parsers.DocumentBuilderFactory=javax.xml.parsers.Documen
> tBuilderFa
> > ctory
> > javax.xml.parsers.SAXParserFactory=javax.xml.parsers.SAXParserFactory
>
> The above line doesn look right. I think it should be
>
>
> javax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserImpl
>
> or
>
>
> javax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserImpl
>
> /tom
> >
> > -- Please help!!!
> >
> > thanks,
> > -Rob
>
Re: XSLTC Xalan samples
Posted by Tom Amiro <To...@Sun.COM>.
Robert Koberg wrote:
>
> I am trying to get some of the translet examples to work but I keep getting
> an error(as in my previous post about XSLTC today):
>
> java.lang.NoClassDefFoundError: de/fub/bytecode/generic/InstructionConstants
> etc...
>
> Can anybody tell me what is causing this? Or tell me just how to fix the
> problem?
>
> My jdk1.3/jre/lib/jaxp.properties has the following:
> javax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.runtime.Transf
> ormerFactoryImpl
There was a change in the location of the TransformerFactoryImpl. It is
under org.apache.xalan.xsltc.trax.TransformerFactoryImpl.
> javax.xml.parsers.DocumentBuilderFactory=javax.xml.parsers.DocumentBuilderFa
> ctory
> javax.xml.parsers.SAXParserFactory=javax.xml.parsers.SAXParserFactory
The above line doesn look right. I think it should be
javax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserImpl
or
javax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserImpl
/tom
>
> -- Please help!!!
>
> thanks,
> -Rob