Xalan transformer

Hello,
the code below is giving me the exception below.
I would greatly appreciate if anyone cud tell me the solution.
fin = new FileInputStream("c:/input.xml");
fout = new FileOutputStream("c:/html/output.html");
                    try
                    fullTransformer.transform(new StreamSource(fin), new
StreamResult(fout));
               catch (Exception ex1)
                    System.out.println("Null Pointer exception thrown in Full");
                    ex1.printStackTrace();
Null Pointer exception thrown in Full
javax.xml.transform.TransformerException:
java.lang.NullPointerException
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1212)
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:479)
java.lang.NullPointerException
at org.apache.xpath.objects.XObject.str(XObject.java:250)
at org.apache.xalan.templates.AVTPartXPath.evaluate(AVTPartXPath.java:161)
at org.apache.xalan.templates.AVT.evaluate(AVT.java:523)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:722)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2154)

The first thing to try is add a few lines of code to check that fin and fout are not null. Maybe for some reason the file could not be opened.
How does your stylesheet look? Is it simple or complicated? Which version of Xalan are you using? Try downloading a new version at http://xml.apache.org. I once had a NullPointerException with Xalan which was caused by a bug in Xalan.
Jesper

Similar Messages

  • TransformerException -- possible bug in weblogic.apache.xalan.transformer.TransformerImpl

    Using WebLogic Server 6.1 SP2. Am using xslt to transform xml into html. After
    repeatedly
    using the same Transformer object to transform different xml documents, the Transformer
    eventually becomes corrupt – sometimes after 20 or so transforms, sometimes only
    after
    thousands.
    Once the Transformer object becomes corrupt, any additional attempt to call the
    transform
    method results in the following exception:
    =============================
    javax.xml.transform.TransformerException: -1
    at weblogic.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1248)
    at weblogic.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:483)
    at weblogic.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1153)
    at … <snip>
    Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at weblogic.apache.xml.utils.NodeVector.popQuick(NodeVector.java:247)
    at weblogic.apache.xpath.XPathContext.popCurrentNode(XPathContext.java:552)
    at weblogic.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2100)
    at weblogic.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1225)
    at … <snip>
    =============================
    Using cavaj to decompile weblogic.apache.xalan.transformer.TransformerImpl yields:
    Method: applyTemplateToNode:
    try
    pushElemTemplateElement(elemtemplateelement1);
    m_xcontext.pushCurrentNode(node);
         <snip>
    catch(SAXException saxexception)
    throw new TransformerException(saxexception);
    finally
    m_xcontext.popCurrentNode();
         <snip>
    So what appears to be happening is that one of the two push calls at the beginning
    of the try
    block is throwing an Exception, causing the pop method to be called in the finally
    block without
    first having had a successful call to push. The corresponding NodeVector inside
    m_xcontext
    thereupon becomes corrupt, and it is only a matter of time before the above
    ArrayIndexOutOfBoundsException appears.
    Unfortunately, we are unable to consistently reproduce this Transformer corruption
    and
    currently have no idea how it happens in the first place. We figure there’s probably
    some sort
    of error in our xsl stylesheet which is at the root of all this, but have had
    no luck in finding it.
    So, two questions:
    1.) Has anyone encountered this problem of having a bad xsl stylesheet which,
    when applied
    repeatedly on certain xml documents, can cause the Transformer to become corrupt
    as a result
    of calling NodeVector.pop without a corresponding call to NodeVector.push? If
    so, do you have
    a simple example of the type of xsl template and/or xml document which might reproduce
    the
    scenario.
    2.) Would not the above code snippet in TransformerImpl be considered buggy in
    any case,
    since it should not be possible for an invalid xsl stylesheet to permanently corrupt
    the
    Transformer? If there’s agreement that this represents a bug in TransformerImpl,
    has it been
    fixed in 6.1 SP3 or higher, or in subsequent versions of the Weblogic Server?
    Thanks,
    John

    hi,
    I've just recently started getting this error too. It's completely random as
    to when it occurs. My system can process hundreds of translations with no problems
    and then once and awhile I get this exact error.
    I'm using WebLogic v7.0 sp2. I've noticed however that this only happens on my
    Windows system - I've got it running on a solairs box with no problems.
    Has anyone else seen this ?
    Thanks.
    Jerry
    "John Lame" <[email protected]> wrote:
    >
    Using WebLogic Server 6.1 SP2. Am using xslt to transform xml into html.
    After
    repeatedly
    using the same Transformer object to transform different xml documents,
    the Transformer
    eventually becomes corrupt – sometimes after 20 or so transforms, sometimes
    only
    after
    thousands.
    Once the Transformer object becomes corrupt, any additional attempt to
    call the
    transform
    method results in the following exception:
    =============================
    javax.xml.transform.TransformerException: -1
    at weblogic.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1248)
    at weblogic.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:483)
    at weblogic.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1153)
    at … <snip>
    Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at weblogic.apache.xml.utils.NodeVector.popQuick(NodeVector.java:247)
    at weblogic.apache.xpath.XPathContext.popCurrentNode(XPathContext.java:552)
    at weblogic.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2100)
    at weblogic.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1225)
    at … <snip>
    =============================
    Using cavaj to decompile weblogic.apache.xalan.transformer.TransformerImpl
    yields:
    Method: applyTemplateToNode:
    try
    pushElemTemplateElement(elemtemplateelement1);
    m_xcontext.pushCurrentNode(node);
         <snip>
    catch(SAXException saxexception)
    throw new TransformerException(saxexception);
    finally
    m_xcontext.popCurrentNode();
         <snip>
    So what appears to be happening is that one of the two push calls at
    the beginning
    of the try
    block is throwing an Exception, causing the pop method to be called in
    the finally
    block without
    first having had a successful call to push. The corresponding NodeVector
    inside
    m_xcontext
    thereupon becomes corrupt, and it is only a matter of time before the
    above
    ArrayIndexOutOfBoundsException appears.
    Unfortunately, we are unable to consistently reproduce this Transformer
    corruption
    and
    currently have no idea how it happens in the first place. We figure
    there’s probably
    some sort
    of error in our xsl stylesheet which is at the root of all this, but
    have had
    no luck in finding it.
    So, two questions:
    1.) Has anyone encountered this problem of having a bad xsl stylesheet
    which,
    when applied
    repeatedly on certain xml documents, can cause the Transformer to become
    corrupt
    as a result
    of calling NodeVector.pop without a corresponding call to NodeVector.push?
    If
    so, do you have
    a simple example of the type of xsl template and/or xml document which
    might reproduce
    the
    scenario.
    2.) Would not the above code snippet in TransformerImpl be considered
    buggy in
    any case,
    since it should not be possible for an invalid xsl stylesheet to permanently
    corrupt
    the
    Transformer? If there’s agreement that this represents a bug in TransformerImpl,
    has it been
    fixed in 6.1 SP3 or higher, or in subsequent versions of the Weblogic
    Server?
    Thanks,
    John

  • Awkward NullPointerException in Xalan transformations

    L.S,
    I'm having a serious problem with XSL transformations using Apache Xalan 2.6.0: a transformation works once, but multiple calls to the method will cause a null-pointer exception to occur within the TrAXFilter object taking care of the transformation.
    The class responsible for transforming any XML messages in our system looks like this (class MessageWriter appearing at line 14 is a JAXB marshalling class we've developed; class FilterManager appearing at line 21 returns an array of 1 hard-coded XMLFilter object):
    public class MessageBuilder {
      private final static SAXParserFactory XML_PARSER = SAXParserFactory.newInstance();
      public static String getXmlMessage(MessageSDO message) {
        String xml = MessageWriter.doMarshal(message);
        try {
          SAXParser parser = XML_PARSER.newSAXParser();
          XMLReader reader = XMLReaderFactory.createXMLReader();
          InputSource srcInput = new InputSource(new StringReader(xml));
          FilterManager ftrManager = (FilterManager) ConfigurationManager.
            getInstance(ConfigurationManager.BOUNDARY).getBean(FilterManager.class);
          XMLFilter[] filters = ftrManager.getOutputFilters(message);
          if (filters.length > 0) {
            for (int i=0;i<filters.length;i++) {
              filters.setParent((i==0)? reader : filters[i-1]);
    Serializer serializer = SerializerFactory.getSerializer(OutputPropertiesFactory.getDefaultMethodProperties("xml"));
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    serializer.setOutputStream(output);
    filters[filters.length-1].setContentHandler(serializer.asContentHandler());
    filters[filters.length-1].parse(srcInput);
    xml = output.toString();
    } catch (Exception e) {
    throw new RuntimeException(e);
    return xml;
    The test I've run (if 2nd block commented out test succeeds, otherwise it fails on that 2nd attempt):
    public void testTransformedOutput() {
      System.out.println("Transformed output test:\n\n");
      MessageSDO msg = MockSDOFactory.getInstance().getMessageSDO();
      String xmlMsg = MessageBuilder.getXmlMessage(msg);
      /*System.out.println("Transformed output test, 2nd pass:\n\n");
        MessageSDO msg2 = MockSDOFactory.getInstance().getMessageSDO();
        String xmlMsg2 = MessageBuilder.getXmlMessage(msg2);*/
    }The exception message:
    java.lang.RuntimeException: java.lang.NullPointerException
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:334)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
    at org.boundary.helper.MessageBuilder.getXmlMessage(MessageBuilder.java:36)
    // Line 36 in MessageBuilder is:
    // filters[filters.length-1].parse(srcInput);What I don't yet understand is how TrAXFilter manages to somehow not have a parent in the 2nd pass of the test, while it does in the 1st pass. I've tried a few things already, but so far haven't been able to find a solution.
    Does anyone know of a bug like this? Or is it clear to someone what I'm doing completely wrong here? I'd appreciate any help you can offer.

    I've been able to solve this problem and since others might be interested, I thought I'd post the solution here as well.
    It turns out that XMLFilter objects cannot be reused. This isn't documented very well, and undoubtedly doesn't come as a surprise to the more experienced XML specialists out there, but it's something you need to know. As a result, instead of using XMLFilter objects for repetetive transformations, you need to use an alternative, namely [url http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/Templates.html]Templates objects:
    final SAXTransformerFactory FACTORY = (SAXTransformerFactory) TransformerFactory.newInstance();
    File xslFile = new File("someStylesheet.xsl");
    StreamSource src = new StreamSource(xslFile);
    Templates template = FACTORY.newTemplates(src);
    // Later on, you can repeatedly do this:
    String xml = getSomeXMLDocument();
    InputSource srcInput = new InputSource(new StringReader(xml));
    XMLFilter filter = FACTORY.newXMLFilter(template); // Use cached template instead of parsing XSL file every time...
    XMLReader reader = XMLReaderFactory.createXMLReader();
    filter.setParent(reader);
    Serializer serializer = SerializerFactory.getSerializer(OutputPropertiesFactory.getDefaultMethodProperties("xml"));
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    serializer.setOutputStream(output);
    filter.setContentHandler(serializer.asContentHandler());
    filter.parse(srcInput);
    String xml = output.toString();

  • Org.apache.xalan.transformer.TransformerImpl

    I have an ecr.index servlet which is run on Tomcat, here is the part of it's code:
               javax.xml.transform.sax.SAXTransformerFactory factory = ( javax.xml.transform.sax.SAXTransformerFactory ) javax.xml.transform.TransformerFactory.newInstance();
               Source ss = new StreamSource( new FileInputStream( context.getRealPath( xsl_file ) ) );
               ss.setSystemId( context.getRealPath( xsl_file ) );
               javax.xml.transform.sax.TransformerHandler handler = factory.newTransformerHandler( ss );
           131:handler.setResult( new StreamResult( response.getOutputStream() ) );When I access the page the exception is thrown:
    org.apache.xml.utils.WrappedRuntimeException: The output format must have a '{http://xml.apache.org/xalan}content-handler' property!
         at org.apache.xalan.serialize.SerializerFactory.getSerializer(SerializerFactory.java:142)
         at org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:1048)
         at org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:975)
         at org.apache.xalan.transformer.TransformerHandlerImpl.setResult(TransformerHandlerImpl.java:209)
         at ecr.index.service(index.java:131)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
         at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:339)
         at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:415)
         at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:716)
         at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:650)
         at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:829)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
         at java.lang.Thread.run(Thread.java:534)But I don't use org.apache.xalan.transformer.TransformerImpl, even the package org.apache.xalan.transformer isn't imported, but this package is present in classpath, where is the error?

    Here is the reason for this problem....
    JDK 1.4 comes with a version of Xalan...
    Somewhere around 1.4.2_03 the Xalan version that shipped with the JDK was upgraded because the XSLT spec was completed/revised or something like that.. When this happend the namespace identifier for xalan custom 'tags' changed. The content-handler tag used to be in the xslt name space.. now it is in the xalan namespace.
    Problem is many stylesheets don't specifically set the output format so the defaults are used and the values are initialized from a properties file. However.... and this is where the problems comes in...
    The Namespaces are used as prefixes to the keys in the file... AND... Tomcat''s WebappClassLoader is not safe about ensuring that a resource is loaded from the same Jar file as the classes that use it....
    So what is happening is... the Xalan from your JVM is being used... but it is loading the formatting properties from a Xalan that is included in your Webapp.... which of course don't match....
    All you need to do is remove the xalanXXX.jar from WEB-INF/lib and this problem will go away...
    Matt Brozowski
    The OpenNMS Group, Inc...

  • How can I Serialize the Object of org.apache.xalan.transformer.TransformerI

    Teachers:
    How can I Serialize the Object of org.apache.xalan.transformer.TransformerImpl.

    org.apache.xalan.transformer.TransformerImpl doesn't appear to be serializable... what do you try to achieve?

  • Standalone deployment & the Xalan transformer

    Hi,
    I'm using JDev and deploying/running against to a standalone instance.
    Everything was fine until I upgraded my XSL transformer to the latest version of Xalan ( from the default Oracle Provided transformer).
    Now I am getting an error when I deploy.
         "Neither this XML document's public nor system id's could be resolved: java.net.UnknownHostException: java.sun.com java.sun.com"
    The top line of my ejb-jar.xml has the following line
         <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    so I think the standalone instance is trying to access the internet for the DTD during the deployment process & failing.
    I note that I am not having this problem when I deploy to a real 9iAS Applicvation server.
    It is not an option to roll back to the Oracle XSL transformer as it is too slow for our application ( with Xalan & using translets we get a throughput increase of approx 350%).
    Can anyone help we with this?
    thanks in advance,
    Kevin

    Are you transforming the ejb-jar.xml with an XSLT?
    The DOCTYPE declaration is not required for the transformation; and may be removed from the ejb-jar.xml.

  • Interrupt xalan transformer

    Is there anybody that knows how to interrupt xalan when processing.
    There is a method stopTransformation() but it is not implemented
    There are transformations running for a very long time(20 min) giving 100% load and i want to interrupt them.
    It is for a very large database rapporting web application.

    The first thing to try is add a few lines of code to check that fin and fout are not null. Maybe for some reason the file could not be opened.
    How does your stylesheet look? Is it simple or complicated? Which version of Xalan are you using? Try downloading a new version at http://xml.apache.org. I once had a NullPointerException with Xalan which was caused by a bug in Xalan.
    Jesper

  • Stop Xalan Transform From Resolves Entities

    I'm trying to write a DOM tree to an XML file, so I've been using Xalan to do a transformation. My code is quite simple:
    DOMSource source = new DOMSource( domDocument );
    StreamResult result = new StreamResult( new File( "out.xml" ));
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    transformer.setOutputProperty( OutputKeys.METHOD, "xml" );
    transformer.setOutputProperty( OutputKeys.ENCODING, "utf-8" );
    transformer.transform( source, result )
    The problem is that my DOM document has character entity references that the transformer seems intent on converting. For example XML that looks like this in the DOM tree:
    <value>Here is a weird character: &eacute;</value>
    Gets output like this in the xml file:
    <value>Here is a weird character: ?</value>
    Since I'm not actually transforming anything, just outputting the XML, I need to preserve any character entity references. Oddly enough the source XML file contains the &amp; entity, which gets converted to a regular & character when the file is parsed into the DOM tree. It's the only character entity that isn't stored as an actual EntityReference object in the tree, but the only one that gets converted back to &amp; on a transform. Any help would be greatly appreciated.

    Yes, the character entities are declared in the DTD. At one point in development I was including it with:
    transformer.setOutputProperty( OutputKeys.DOCTYPE_PUBLIC,domDocument.getDoctype().getPublicId());
    transformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM,domDocument.getDoctype().getSystemId());
    transformer.transform( source, result );
    (I'm writing this code from memory; sorry if there are any syntax errors)
    The code compiled and did correctly add the DOCTYPE entry to the file, but the references are still being converted. It does matter for us that the references remain intact. Eventually the XML will go into a publishing system that uses a different set of proprietary character codes for that software; utf-8 won't work :-(

  • Error with xalan xsltc transformation

    Hi Everybody,
    I am currently working on a performance enhancement change for my project which uses xsl for jsp html display. Due to some client requirement, we have decided to convert all our xsl stylesheets to XSLTC translet class files. Although I have managed to compile all the stylesheets to java classes, I am getting a strange runtime error for some of the xsl-jsp pages. please kindly help me as I have no clue about this error. It has now become a showstopper issue for my project delivery. I am using Websphere 5.1 jre and xml jar libraries for doing the transform. The tranformation works fine with the default xalan transformer(not xsltc). The XSLTC version is 4.0 .
    [2/6/06 17:41:33:979 IST] beb3ed2 WebGroup E SRVE0026E: [Servlet Error]-[&#40;class: com/synergy/xsl/translet/mmtoolb, method: topLevel signature: &#40;Lorg/apache/xalan/xsltc/DOM&#59;Lorg/apache/xml/dtm/DTMAxisIterator&#59;Lorg/apache/xml/serializer/SerializationHandler&#59;&#41;V&#41; Incompatible object argument for method call]: java.lang.VerifyError: (class: com/synergy/xsl/translet/mmtoolb, method: topLevel signature: (Lorg/apache/xalan/xsltc/DOM;Lorg/apache/xml/dtm/DTMAxisIterator;Lorg/apache/xml/serializer/SerializationHandler;)V) Incompatible object argument for method call
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java(Compiled Code))
         at java.lang.Class.getConstructor1(Class.java(Compiled Code))
         at java.lang.Class.newInstance3(Class.java(Compiled Code))
         at java.lang.Class.newInstance(Class.java(Compiled Code))
         at org.apache.xalan.xsltc.trax.TemplatesImpl.getTransletInstance(TemplatesImpl.java:345)
         at org.apache.xalan.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.java:374)
         at org.apache.xalan.xsltc.trax.TemplatesImplProxy.newTransformer(TemplatesImplProxy.java:106)
         at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:570)
         at com.synergy.service.XSLTTransformServiceHelper.getTransformer(XSLTTransformServiceHelper.java:296)
         at com.synergy.service.XSLTTransformServiceHelper.getTransformer(XSLTTransformServiceHelper.java:243)
         at com.synergy.service.XSLTTransformServiceHelper.transform(XSLTTransformServiceHelper.java:155)
         at com.synergy.tags.xslt.XSLTTransformTag.doEndTag(Unknown Source)
         at org.apache.jsp._mmtoolb._jspService(_mmtoolb.java:2392)
         at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
         at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java(Compiled Code))
         at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
         at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Compiled Code))
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:61)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
         at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
         at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
         at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
         at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
    Please reply incase you need more information about the error.
    Thanks and Regards,
    sunil kumar
    Polaris software lab ltd
    India

    The XSLTC version is 4.0Is that the version under which you compiled the classes, or the version in Websphere where you are running the classes? The error message seems to suggest there is some incompatibility happening.

  • Xalan.jar ----- javax.xml.transform.TransformerException

    Hi,
    I am using Pramati 4.1 Server.
    My application is working fine for a single or few more users. But In Performance Testing when more than 100 users hit the same link at a time, it throws lots of Transformer Exception such as �
    Exception in quicklinks.jsp: javax.xml.transform.TransformerException: java.net.SocketException: Connection reset
    javax.xml.transform.TransformerException: java.lang.ArrayIndexOutOfBoundsException: 8195
         at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:725)
         at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
         at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
         at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
         at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160)
         at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
         at com.niit.cliks.control.web.tagext.viewmenu.doStartTag(Unknown Source)
         at com.pramati.jsp.generated.jsp_p2f_common_p2f_menu._pramati_tag_var_cliks_viewmenu12_method(jsp_p2f_common_p2f_menu.java:315)
         at com.pramati.jsp.generated.jsp_p2f_common_p2f_menu._jspService_delegate(jsp_p2f_common_p2f_menu.java:599)
         at com.pramati.jsp.generated.jsp_p2f_common_p2f_menu._jspService(jsp_p2f_common_p2f_menu.java:623)
         at com.pramati.jsp.runtime.HttpJspSuper.service(HttpJspSuper.java:64) ....
    .....................Can anybody please help me out to resolve this problem?
    Thank you.

    I've found that using the document() function in XSL is the trigger for this bug.
    The Xalan JAXP implementation caches any document() calls. A workaround apparerently is to put in the processing instruction <?xalan-doc-cache-off?>.

  • Problem with Xalan and JDK and Tomcat

    hi all,
    i have a webapplication under Apache Tomcat 4.1.30/Linux which use an XML/XSL transformation.
    I got the following error:
    org.apache.xml.utils.WrappedRuntimeException: The output format must have a '{http://xml.apache.org/xalan}content-handler' property!
         at org.apache.xalan.serialize.SerializerFactory.getSerializer(SerializerFactory.java:142)
         at org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:1048)
         at
    Any suggestion ?
    Cheers.
    Stefano

    Here is an anwser for you
    http://testdrive.mapinfo.com/TECHSUPP/MIPROD.NSF/0/4a9bc2a8f684237f85256e63006f9ad4?OpenDocument
    JDK 1.4 and above, I believe, is packaged with an old version of Xalan jar. So sometimes, like when trying to run XSLTC, you have to override the JDK 1.4 Xalan version with the newer Xalan.jar. Or else your newer Xalan.jar classes are not looked at. You do this by putting your Xalan.jar in the /lib/endorsed directory. or /common/endorsed in this case.
    http://xml.apache.org/xalan-j/faq.html#faq-N100CC
    Hope this helps

  • Can anybody help me?? (Transformer.transform)

    I am trying to use Transformer.transform with a DOM object.
    Something like this
              Document doc = null;
              try
                   DOMParser parser = new DOMParser();
                   parser.parse(args[0]);
                   doc = parser.getDocument();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
              Transformer transformer = tFactory.newTransformer(new StreamSource(args[2]));
                   transformer.transform(new StreamSource(args[0]), new StreamResult(new FileOutputStream(args[1])));          }
              catch (Exception e)
                   System.err.println("Sorry, an error occurred: " + e);
    where:
    args[0] is xml file
    args[1] is html file
    args[2] is xsl file
    but it throw an exception. Why?
    Exception in thread "main" java.lang.AbstractMethodError
    at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.addNode(DOM2DTM.java:262)
    at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.<init>(DOM2DTM.java:155)
    at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:189)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:630)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
    at xml2html.main(xml2html.java:27)
    Thank you very much

    You can perform the transformation without using DOM. Here's the code:
    public class SimpleTransformation {  
    public static void main(String[] args) throws Exception {
    File sourceXML = new File(args[0]);
    File output = new File(args[1]);
    File stylesheet = new File(args[2]);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer t = factory.newTransformer(new StreamSource(stylesheet));
    t.transform(new StreamSource(sourceXML), new StreamResult(output));
    I've tested it and it's ok.

  • Swapping XML Parser and XSLT to Xalan 2.7.0 - Not Working (OC4J 10.1.3)

    Hi-
    I'm trying to use the latest Xercies/Xalan classes in OC4J 10.1.3 as described in the How-To swap XML Parsers document:
    http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html
    What I can see happening is that the oracle.xml shared library is successfully 'turned off', but the xalan libraries are not added. Instead, the default xml classes that are distributed with the JDK become visible. For instance, using a slightly modified version of the index.jsp page from the how-to, I get this result:
    ------ Output from JSP page ----------------
    TransformerFactory Instance: org.apache.xalan.processor.TransformerFactoryImpl
    Transformer Instance: org.apache.xalan.transformer.TransformerIdentityImpl
    Transformer Version: Xalan Java 2.4.1 (!!)
    What I expect is for that last line to say version 2.7.0, which is the version of the xalan.jar included in my shared library (code to add that line to the how-to shown below).
    I suspect what is happening is that the class loader is simply not letting a shared library override a system library - to do that you probably need to place the jar files in system endorsed directory.
    Has anyone gotten this how-to to work - actually replacing the XML parser/transform classes with the latest Xalan classes? Are you sure it is seeing the current version you placed in the shared library?
    Thanks,
    Eric Everman
    ---- My modified getXSLTDetails() method in the index.jsp page of the how-to -------
    <!-- Additional Import -->
    <%@ page import="org.apache.xalan.Version" %>
    public static String getXSLTDetails()
    Transformer transformer=null;
    TransformerFactory transformerfactory = TransformerFactory.newInstance();
         Version ver = null;
         String br = "<" + "br" + ">"; //otherwise the otn forum chocks on the break.
    try
    transformer = transformerfactory.newTransformer();
              ver = (Version) transformer.getClass().forName("org.apache.xalan.Version").newInstance();
              String ret_val =
                   "TransformerFactory Instance: "+transformerfactory.getClass().getName() + br +
                   "Transformer Instance: "+transformer.getClass().getName() + br;
              if (ver != null) {
                   ret_val = ret_val + "Transformer Version: " + ver.getVersion() + br;
              } else {
                   ret_val = ret_val + "Transformer Version not Available" + br;
              return ret_val;
    catch (Exception e)
    e.printStackTrace();
    return e.getMessage();
    }--------------------------------------------------------------------

    Steve - Thanks for responding on this.
    The Xalan SQL extension is built into Xalan. The most painless way to try it out is to run it via JEdit: www.jedit.org
    JEdit a OS Java application with a fairly painless install process (I'm assuming you already have a current JRE installed). Once its installed, you'll need to install the XSLT plugin - in JEdit goto Plugins | Plugin Manager | Install and pick the XSLT plugin. You'll need the Oracle JDBC classes on your classpath - this can be done by copying the oracle_jdbc4.jar into the [JEdit install directory]/jars directory.
    Restart to load that jar and you should be all set.
    I included a sample XSLT page at the bottom of this post that is somewhat of a template transform for the SQL extension - its more complicated then it needs to be, but it does some nice things with the results of the query. Save it as a file and make the appropriate changes to the 'datasource' parameter near the top of the file.
    Then in JEdit, open the file and make sure the XSLT plugin is visible (Plugins | XSLT | XSLT Processor Toggle - or alternately dock it in the window via global prefs). In the XSLT plugin: Allow the current buffer to be used as the source, Add that same file as a stylesheet via the '+' button, and pick a result file at the bottom. Then click the 'Transform XML' button.
    Troubleshooting: I seem to remember having some classpath errors when I tried this on windows, but others have had it work w/o issues. I do remeber that the XSLT plugin had a popup window that gave a pretty good explaintion of the problem, if it occurs. Also, for some reason the XSLT plugin will not create a new file for the output, so its often best to create a file first, then choose it as the output. Of course, you can always run a transformation from the command line or w/in an applicatoin. Full docs on the Xalan SQL extension can be found at: http://xml.apache.org/xalan-j/extensionslib.html#sql
    Here is my sample XSLT transform using the SQL extension:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:sql="http://xml.apache.org/xalan/sql"
              xmlns:str="http://exslt.org/strings"
              xmlns:xalan="http://xml.apache.org/xalan"
              extension-element-prefixes="sql str xalan">
         <xsl:output indent="yes"/>
         <xsl:param name="driver">oracle.jdbc.OracleDriver</xsl:param>
         <xsl:param name="datasource">jdbc:oracle:thin:jqpublic/jqpublic@server_name:1521:dbname</xsl:param>
         <xsl:param name="jndiDatasource"><!-- jndi source for production use w/in enterprise environment --></xsl:param>
         <xsl:param name="debug">true</xsl:param>
         <xsl:variable name="connection" select="sql:new()"/>
         <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
         <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
         <!--
              The query:  You could pass parameters in to this query to build a where clause, but here is a simple example.
              Also, its nice to wrap the query with a max row number to prevent huge results.
         -->
         <xsl:param name="query">
         select * from (
      SELECT
              'One' FIELD_1,
              'Two' FIELD_2
         FROM DUAL
         ) where rownum < 100
         </xsl:param>
         <!-- Essentially, create a XConnection object -->
         <xsl:variable name="connection" select="sql:new()"/>
         <xsl:template match="/">
        <xsl:choose><!-- Connect using JNDI -->
          <xsl:when test="$jndiDatasource != ''">
            <xsl:if test="not(sql:connect($connection, $jndiDatasource))">
              <xsl:message>Failed to connect to db via jndi connection</xsl:message>
              <xsl:comment>Failed to connect to db via jndi connection</xsl:comment>
              <xsl:if test="$debug = 'true'">
                <xsl:copy-of select="sql:getError($connection)/ext-error"/>
              </xsl:if>
            </xsl:if>
          </xsl:when>
          <xsl:otherwise><!-- Connect using connection string -->
            <xsl:if test="not(sql:connect($connection, $driver, $datasource))">
              <xsl:message>Failed to connect to db via driver/url connection</xsl:message>
              <xsl:comment>Failed to connect to db via driver/url connection</xsl:comment>
              <xsl:if test="$debug = 'true'">
                <xsl:copy-of select="sql:getError($connection)/ext-error"/>
              </xsl:if>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>
              <!--
              The results of the query.  The rowset is brought back in 'streaming' mode,
              so its not possible to ask it for the number of rows, or to check for zero
              rows.  There is a switch to disable streaming mode, but this requires all
              rows to be brought into memory.
              -->
              <xsl:variable name="table" select="sql:query($connection, $query)"/>
              <xsl:if test="not($table)">
                   <xsl:message>Error in Query</xsl:message>
                   <xsl:copy-of select="sql:getError($connection)/ext-error"/>
              </xsl:if>
              <page>
                   <!-- Your xalan environment -->
                   <xsl:copy-of select="xalan:checkEnvironment()"/>
                   <!-- Build a bunch of metadata about the rows -->
                   <meta>
                        <cols>
                             <xsl:apply-templates select="$table/sql/metadata/column-header"/>
                        </cols>
                   </meta>
                   <rowset>
                        <!--
                             With streaming results, you must use the apply-temmplates contruct,
                             not for-each, since for-each seems to attempt to count the rows, which
                             returns zero.
                        -->
                        <xsl:apply-templates select="$table/sql/row-set"/>
                   </rowset>
              </page>
              <xsl:value-of select="sql:close($connection)"/><!-- Always close -->
         </xsl:template>
         <xsl:template match="row">
              <row>
                   <xsl:apply-templates select="col"/>
              </row>
         </xsl:template>
         <xsl:template match="column-header">
              <col>
                   <xsl:attribute name="type">
                        <xsl:value-of select="@column-typename"/>
                   </xsl:attribute>
                   <xsl:attribute name="display-name">
                        <xsl:call-template name="create-display-name"/>
                   </xsl:attribute>
                   <xsl:value-of select="@column-name"/>
              </col>
         </xsl:template>
         <!-- Convert column names to proper caps: MY_FIELD becomes My Field -->
         <xsl:template name="create-display-name">
              <xsl:variable name="col-name">
                   <xsl:for-each select="str:tokenize(@column-name, '_')">
                        <xsl:value-of
                             select="concat(translate(substring(., 1, 1), $lowercase, $uppercase), translate(substring(.,2), $uppercase, $lowercase), ' ')"/>
                   </xsl:for-each>
              </xsl:variable>
              <xsl:value-of select="substring($col-name, 1, string-length($col-name) - 1)"/>
         </xsl:template>
         <!-- Creates data columns named 'col' with a column-name attribute -->
         <xsl:template match="col">
              <col>
                   <xsl:attribute name="column-name"><xsl:value-of select="@column-name"/></xsl:attribute>
                   <xsl:value-of select="."/>
              </col>
         </xsl:template>
    </xsl:stylesheet>

  • XML : Transform DOM Tree to XML String in an applet since the JRE 1.4.2_05

    Hello,
    I build a DOM tree in my applet.
    Then I transform it to XML String.
    But since the JRE 1.4.2_05 it doesn't work.
    These lines failed because these variables became final:
    org.apache.xalan.serialize.CharInfo.XML_ENTITIES_RESOURCE = getClass().getResource("XMLEntities.res").toString();
    org.apache.xalan.processor.TransformerFactoryImpl.XSLT_PROPERTIES = getClass().getResource("XSLTInfo.properties").toString();The rest of the code :
    DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = domFactory.newDocumentBuilder();
    Document domXML = builder.newDocument();
    // I build my DOM Tree
    StringWriter xmlResult = new StringWriter();
    Source source = new DOMSource(domXML);
    Result result = new StreamResult(xmlResult);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT,"yes");
    xformer.transform(source,result);Is there any other way to get an XML String from a DOM tree in an applet ?
    I'm so disappointed to note this big problem.

    Does anyone have an idea why I get this error message when try to use transform in an applet?
    Thanks...
    java.lang.ExceptionInInitializerError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at org.apache.xalan.serialize.SerializerFactory.getSerializer(Unknown Source)
         at org.apache.xalan.transformer.TransformerIdentityImpl.createResultContentHandler(Unknown Source)
         at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Unknown Source)
         at matrix.CreateMtrx.SaveDoc(CreateMtrx.java:434)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at thinlet.Thinlet.invokeImpl(Unknown Source)
         at thinlet.Thinlet.invoke(Unknown Source)
         at thinlet.Thinlet.handleMouseEvent(Unknown Source)
         at thinlet.Thinlet.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.RuntimeException: The resource [ XMLEntities.res ] could not load: java.net.MalformedURLException: no protocol: XMLEntities.res
    XMLEntities.res      java.net.MalformedURLException: no protocol: XMLEntities.res
         at org.apache.xalan.serialize.CharInfo.<init>(Unknown Source)
         at org.apache.xalan.serialize.SerializerToXML.<clinit>(Unknown Source)
         ... 28 more

  • NoSuchMethodError in XSL Transformation

    I am trying to run this piece of code to transform an xml file to html.
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document docData = builder.parse("orders.xml");
    DOMSource sourceDom = new DOMSource(docData.getDocumentElement());
    Document docResult = builder.newDocument();
    Result resultDom = new DOMResult(docResult);
    //stylesheet
    Source srcStyle = new StreamSource("Orders.xsl");
    TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer transformer = transFactory.newTransformer(srcStyle);
    // This is the line giving the error
    transformer.transform(sourceDom, new StreamResult(System.out));
    I get the following error :
    java.lang.NoSuchMethodError
         at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.addNode(DOM2DTM.java:262)
         at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.<init>(DOM2DTM.java:151)
         at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:189)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:630)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
         at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
         at tryJavaXml.main(tryJavaXml.java:42)

    I already fixed this one..but thanks all the same..n yes, the classpath contained references to jars used by Weblogic which in turn contained the same class files. Removing these from the classpath solved the problem..

Maybe you are looking for

  • I know have a document and data storage on my iTunes. how do you get rid of it

    i know have a document and data storage on my iTunes. how do you get rid of it

  • HT6154 Issues downloading photos with version 7.1

    since i updated to 7.1 on my iphone 5 I can't download photos anymore.  when i hit trust after connecting it appears to disconnect the phone instead of making photos available for download.

  • Drive Mapping will not stick.

    We went from a Novell 6.0 server to the new sbe2.5 All computers are xp sp3 with the 4.91 SP5 Novell Clients. You can remap a drive to the new server but the next time you start the computer it reverts back to the directory from the old server. I hav

  • Are multiple captures of the same clip identical?

    Should multiple captures of exactly the same footage be exactly identical? I would expect them to be, but I am doubtful. Here is what I did: 1) Created a new offline clip, specifying media start, media end, and reel number. 2) Captured the clip creat

  • Infoobject Specific Properties

    Hi All, I'm trying to create a multiprovider based on an IfoCube which has the characterics with navigational attributes but when i select that infocube for the multiprovider then cube doesnt show those 2 charactericstics and the navigational attribu