Problem Deploying in Oracle Application Server

I have deployed the Interactive Test Application to Oracle Application Server (version 10.1.2.0.0) normally without any problems but an Internal Server Error 500 occurs when I am trying to view the page.
The error is:

500 Internal Server Error

java.io.IOException: Unable to write document to OutputStream: javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.
at nextapp.echo2.webrender.output.XmlDocument.render(XmlDocument.java:109)
at nextapp.echo2.webcontainer.WindowHtmlService.service(WindowHtmlService.java:101)
at nextapp.echo2.webcontainer.NewInstanceService.service(NewInstanceService.java:76)
at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
at nextapp.echo2.webrender.WebRenderServlet.doGet(WebRenderServlet.java:185)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)

The same application runs normally on Tomcat.
Is there any problem with the Oracle Application Server and Echo2?
How I can solve this problem?

Thanks in advance

ST

After making some tests I have found out that the problem is probably between the oc4j.jar library of the Oracle Application Server and the library of Echo2.
If the oc4j library exists in the classpath of the project the same exception is thrown, even if this library is not used inside the application.
I have found out this when I have tried to call an EJB remotely from the Oracle Application Server.
Is there any solution to this because I am evaluating the Echo2 framework to be used in a project using Oracle Application Server.

tliebeck's picture

I would recommend modifying the Echo2 source code and recompiling new libraries with additional error checking to determine the real cause of the exception. Line 109 of XMLDocument.java reads as follows:

throw new IOException("Unable to write document to OutputStream: " + ex.toString());

I'm curious to know what the real exception here is, as Echo2 is currently hiding the important bits of it and only handing to you its toString() value. Add in an "ex.printStackTrace()" line above this line, recompile, and post that exception.

Compiling Echo2 from the source is trivial, you'll only need ant and to have a "servlet.jar" file in your CLASSPATH providing the J2EE servlet API. Just run "ant dist".

This is the complete stacktrace running an Echo application in the Oracle Application
Server after adding the ex.printStackTrace() line in the XMLDocument.java

java.lang.UnsupportedClassVersionError: nextapp/echo2/webcontainer/WebContainerServlet (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.OC4JSecureClassLoader.defineClassEntry(OC4JSecureClassLoader.java:172)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.defineClass(ContextClassLoader.java:1170)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.findClass(ContextClassLoader.java:406)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.loadClass(ContextClassLoader.java:154)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.OC4JSecureClassLoader.defineClassEntry(OC4JSecureClassLoader.java:172)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.defineClass(ContextClassLoader.java:1170)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.findClass(ContextClassLoader.java:406)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.loadClass(ContextClassLoader.java:154)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpApplication.loadServlet(HttpApplication.java:2075)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpApplication.findServlet(HttpApplication.java:4582)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2608)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:640)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Echo2Test: Servlet error
java.lang.UnsupportedClassVersionError: nextapp/echo2/webcontainer/WebContainerServlet (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.OC4JSecureClassLoader.defineClassEntry(OC4JSecureClassLoader.java:172)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.defineClass(ContextClassLoader.java:1170)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.findClass(ContextClassLoader.java:406)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.loadClass(ContextClassLoader.java:154)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.OC4JSecureClassLoader.defineClassEntry(OC4JSecureClassLoader.java:172)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.defineClass(ContextClassLoader.java:1170)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.findClass(ContextClassLoader.java:406)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].naming.ContextClassLoader.loadClass(ContextClassLoader.java:154)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpApplication.loadServlet(HttpApplication.java:2075)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpApplication.findServlet(HttpApplication.java:4582)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2608)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:640)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)

tliebeck's picture

That acutally looks like a Java 1.4 VM tripping over a class compiled with J2SE 5.0. I think this might be unrelated to the previous exception.

Try compiling it again with JDK 1.4 (with the ex.printStackTrace() still in place) and run it again.

I have compiled it and I get the same stacktrace as in my first post:
The only think that is added is the last line:
"Caused by: java.lang.NullPointerException"

XML-22900: (Fatal Error) An internal error condition occurred.
05/12/14 11:12:06 Error Message
javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.
at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:737)
at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:348)
at nextapp.echo2.webrender.output.XmlDocument.render(XmlDocument.java:107)
at nextapp.echo2.webcontainer.WindowHtmlService.service(WindowHtmlService.java:101)
at nextapp.echo2.webcontainer.NewInstanceService.service(NewInstanceService.java:76)
at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
at nextapp.echo2.webrender.WebRenderServlet.doGet(WebRenderServlet.java:185)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
---------
java.lang.NullPointerException

If I run it in the Embedded Jetty importing the oc4j.jar library in my project then I get the following stacktrace

javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.
at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:737)
at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:348)
at nextapp.echo2.webrender.output.XmlDocument.render(XmlDocument.java:107)
at nextapp.echo2.webcontainer.WindowHtmlService.service(WindowHtmlService.java:101)
at nextapp.echo2.webcontainer.NewInstanceService.service(NewInstanceService.java:76)
at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
at nextapp.echo2.webrender.WebRenderServlet.doGet(WebRenderServlet.java:185)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1776)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1726)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:196)
at nextapp.es2.server.PrivateSocketListener.handleConnection(PrivateSocketListener.java:21)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:487)
Caused by: java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:333)
at oracle.xml.parser.v2.XSLSAXPrintDriver.endElement(XSLSAXPrintDriver.java:524)
at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2950)
at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:2960)
at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2949)
at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:2960)
at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2112)
at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:327)
... 21 more
---------
java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:333)
at oracle.xml.parser.v2.XSLSAXPrintDriver.endElement(XSLSAXPrintDriver.java:524)
at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2950)
at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:2960)
at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2949)
at oracle.xml.parser.v2.XMLElement.reportChildSAXEvents(XMLElement.java:2960)
at oracle.xml.parser.v2.XMLElement.reportSAXEvents(XMLElement.java:2112)
at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:327)
at nextapp.echo2.webrender.output.XmlDocument.render(XmlDocument.java:107)
at nextapp.echo2.webcontainer.WindowHtmlService.service(WindowHtmlService.java:101)
at nextapp.echo2.webcontainer.NewInstanceService.service(NewInstanceService.java:76)
at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
at nextapp.echo2.webrender.WebRenderServlet.doGet(WebRenderServlet.java:185)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1776)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1726)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:196)
at nextapp.es2.server.PrivateSocketListener.handleConnection(PrivateSocketListener.java:21)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:487)

tliebeck's picture

I'm not exactly sure what's going on here, but I think I can narrow it down to two possibilites: either something is wrong with Oracle's JAXP implementation or Echo2 is somehow misusing the JAXP API.

The following is pulled from Hashtable.java from the Sun JDK 1.4.2 (src.zip in JDK download):

331    public synchronized Object get(Object key) {
332	Entry tab[] = table;
333	int hash = key.hashCode();

..from that we can conclude that Hashtable.get() was called with a null key. Unfortunately I think that's where my investigation of this stack trace ends, unless Oracle's JAXP implementation has source available?

At this point I'm left to really just take guesses at the problem. One idea might be to play around with the render method XMLDocument a bit...perhaps first by checking to see if there's any way that PrintWriter might be null, i.e.:

    public void render(PrintWriter pw)
    throws IOException {
System.err.println("PrintWriter="+pw);
        try {
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();
            if (outputProperties != null) {
                transformer.setOutputProperties(outputProperties);
            }
            DOMSource source = new DOMSource(document);
            StreamResult result = new StreamResult(pw);
            transformer.transform(source, result);
        } catch (TransformerException ex) {
            throw new IOException("Unable to write document to OutputStream: " + ex.toString());
        }
    }

.....and then maybe seeing if commenting out the transformer.setOutputProperties() line has any effect.

I'll try and review the DOM buildup/rendering code and see if I can find anything out of spec. There's a chance suggestions above might help, but I don't have much faith that they will.

Nadir's picture

Tod Liebeck+Dec 14 2005, 12:19 PM(Tod Liebeck @ Dec 14 2005, 12:19 PM)

Quote:
.....and then maybe seeing if commenting out the transformer.setOutputProperties() line has any effect.

I tried doing that and it failed in the same way. I'll debug some more.

Tristan

Nadir's picture

Ok, I did some decompiling and debugging, and I've discovered that reportSAXEvents invokes the endElement() method of class XSLSAXPrintDriver with three params: a namespace a localname and a qualifiedname.
It fails looking up a hashtable of emptytags with the localname as key. the hashtable contains the following:

emptyTags = new Hashtable(20);
emptyTags.put("area", "area");
emptyTags.put("base", "base");
emptyTags.put("basefont", "basefont");
emptyTags.put("br", "br");
emptyTags.put("col", "col");
emptyTags.put("frame", "frame");
emptyTags.put("hr", "hr");
emptyTags.put("img", "img");
emptyTags.put("input", "input");
emptyTags.put("isindex", "isindex");
emptyTags.put("link", "link");
emptyTags.put("meta", "meta");
emptyTags.put("param", "param");

This part of the code is only executed if the outMethod (set via the properties of the transformer) is either HTML or XHTML. I'll see if forcing outMethod to XML.

Tristan

Has anyone made progress on this? we went pretty far into figuring out what echo2 is about before realizing this problem exists, which is a show stopper for us.

erksmaas+Jan 31 2006, 06:59 PM(erksmaas @ Jan 31 2006, 06:59 PM)

Quote:
Has anyone made progress on this? we went pretty far into figuring out what echo2 is about before realizing this problem exists, which is a show stopper for us.
[snapback]6078[/snapback]

The error has gone with the latest JDeveloper Release from Jan 06.

HMH

HMH+Feb 2 2006, 04:54 AM(HMH @ Feb 2 2006, 04:54 AM)

Quote:
The error has gone with the latest JDeveloper Release from Jan 06.

HMH

[snapback]6103[/snapback]

I have confirmed this - at least with IE 6, my apps work using latest jdev.

However, Mozilla Firefox does not work, using v. 1.5.0.1

Get the following alert/error - wondering if you can recreate as well?


The following client application error has occured:
--------------------------------
Connot process ServerMessage (Phase 2)

Error Name: TypeError
Error Message: eventSource has no properties
-------------------------------
Please contact your administrator.

erksmaas+Mar 1 2006, 12:02 AM(erksmaas @ Mar 1 2006, 12:02 AM)

Quote:
I have confirmed this - at least with IE 6, my apps work using latest jdev.

However, Mozilla Firefox does not work, using v. 1.5.0.1

Get the following alert/error - wondering if you can recreate as well?


The following client application error has occured:
--------------------------------
Connot process ServerMessage (Phase 2)

Error Name: TypeError
Error Message: eventSource has no properties
-------------------------------
Please contact your administrator.

[snapback]6553[/snapback]

We are having the same issue on Oracle AS 10.1.2. Anyone made any progress on this issue? It is a show stopper for us as well. We would like to use the framework for our customer, but we must run on Oracle AS.

LKF

lkfoss wrote:

We are having the same issue on Oracle AS 10.1.2. Anyone made any progress on this issue? It is a show stopper for us as well. We would like to use the framework for our customer, but we must run on Oracle AS.

Same problems here. Oracle AS is used a lot in big companies... it's realy a shame :( that the only working combination is OAS 10.1.2 and IE, since "everyone's" favourite browser is firefox :D

bbakerman's picture

Are you confirming that Echo2 works on IE but not on FireFox whe used OAS 10.1.2.

My guess woyuld be that some other issue has come into play because by the time the code gets down to the client browser, Oracles JAXP will have done its work.

As a guess, it could be producing "XML" output which is slightly different to the norm and it MAY make it through Ie but not FireFox but this is an unlikely situation.

I have seen this type of error when the SAX parser and the XSLT processors are in multiple locations in the classpath for the web application or when these libraries are not in sync with one another. The XSLT processor or the parser will give errors with little or no clues. I have few suggestions:

- To start with do not put any XML parser or XSLT processor in WEB-INF/lib.
- Make sure that you do not have multiple versons of the parser and XSLT processor in the classpath.
- Try after putting the latest version of the parser and the XSLT processor in the endorsed directory of the JRE and remove them from elsewhere in the app server classpath.

- Indra

I'm confirming that Echo2 does not work in combination with OC4J 10.1.3 (in JDeveloper 10.1.3) and firefox. Same echo2 distribution works in combination with OC4J 10.1.3 and IE.

OC4J is Oracle Container for Java - witch is part of OAS 10.1.3 (not released yet). Same OC4J 10.1.2 is in OAS 10.1.2 (in production) - with this one I cannot confirm above statements. 10.1.3 runs on java 5, 10.1.2 is stil on 1.4.

I will play around with libraries and report back. Thx for advices :D

bbakerman's picture

If its a FireFox issue, can you look in the FireFox JavaScript console and see if there are any errors being produced there. This may lead to an excplanation of why the "same XML messaging" is not running in one browser and working in another.

Same problem here. We plan to use Echo2 in the future (i'm testing it for usability) but we are highly dependent on Oracle AS 10.1.2.0.0, in JDeveloper it runs perfectly but when we deploy it to AS we get:

Unable to write document to OutputStream: javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.

Does anyone have a solution?

tliebeck's picture

Below is a servlet that reproduces the issue without Echo2. I'm currently working on the issue and will post any updates here. If anyone can find a problem with this servlet, please let me know. I'm using Oracle JDeveloper 10.1.2.1.0 on JDK 1.4.2_11 on Fedora Core 5 x86. Currently getting the previous reported exception (NullPointerExteption at HashTable.java line 333).

package mypackage1;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;

public class Servlet2 extends HttpServlet 
{
    private static final String XHTML_1_0_TRANSITIONAL_PUBLIC_ID = "-//W3C//DTD XHTML 1.0 Transitional//EN";
    private static final String XHTML_1_0_TRANSITIONAL_SYSTSEM_ID = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
    private static final String XHTML_1_0_NAMESPACE_URI = "http://www.w3.org/1999/xhtml";
    private static final String CONTENT_TYPE = "text/html; charset=UTF-8";

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) 
    throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();

        try {
            try {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                DOMImplementation dom = builder.getDOMImplementation();
                DocumentType docType = dom.createDocumentType("html", 
                        XHTML_1_0_TRANSITIONAL_PUBLIC_ID, XHTML_1_0_TRANSITIONAL_SYSTSEM_ID);
                Document document = dom.createDocument(XHTML_1_0_NAMESPACE_URI, "html", docType);
                Element htmlElement = document.getDocumentElement();
                htmlElement.setAttribute("xmlns", XHTML_1_0_NAMESPACE_URI);
                Element headElement = document.createElement("head");
                htmlElement.appendChild(headElement);
                TransformerFactory tFactory = TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer();
                DOMSource source = new DOMSource(document);
                StreamResult result = new StreamResult(out);
                transformer.transform(source, result);
            } catch (TransformerException ex) {
                throw new RuntimeException(ex);
            } catch (ParserConfigurationException ex) {
                throw new RuntimeException(ex);
            }
        } catch (RuntimeException ex2) {
            ex2.printStackTrace();
            throw(ex2);
        }
    }
}

tliebeck's picture

<strike>There may actually a problem with mixing DOM1 and DOM2 code in this example that will need to be rectified in Echo2 (will post more info on this later).</strike>
Edit: retracting that statement for the moment. I was thinking it might be illegal to use the DOM Level 2 DOMImplementation.createDocument() method and then use DOM Level 1 methods to work on it....but this appears not to be the case.

However, as far I can tell, Oracle simply refuses to handle DOM1 rendering w/ HTML. The following does NOT work, though if we change the element name from "html" to anything else, e.g. "foo", it works fine. Clearly they're treating html docs as a special case. Changing the code to use entirely DOM2 API calls (Edit: i.e., exclusively using methods that end in "NS") does work, even with an "html" root element.

package mypackage1;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;

public class Servlet2 extends HttpServlet 
{
    private static final String CONTENT_TYPE = "text/html; charset=UTF-8";

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) 
    throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            try {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = factory.newDocumentBuilder();
                Document document = builder.newDocument();
                Element htmlElement = document.createElement("html");
                document.appendChild(htmlElement);
                TransformerFactory tFactory = TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer();
                DOMSource source = new DOMSource(document);
                StreamResult result = new StreamResult(out);
                transformer.transform(source, result);
            } catch (TransformerException ex) {
                throw new RuntimeException(ex);
            } catch (ParserConfigurationException ex) {
                throw new RuntimeException(ex);
            }
        } catch (RuntimeException ex2) {
            ex2.printStackTrace();
            throw(ex2);
        }
    }
}

tliebeck's picture

One way around this problem is to manually specify an alternate TransformerFactory, e.g., the default Xalan one provided by the JDK rather than Oracle's seemingly broken implementation. There are several ways to do this:

"Sun's JDK Documentation"+("Sun's JDK Documentation")

Quote:

public static TransformerFactory newInstance()
throws TransformerFactoryConfigurationError

Obtain a new instance of a TransformerFactory. This static method creates a new factory instance This method uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load:

  • Use the javax.xml.transform.TransformerFactory system property.
  • Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.
  • Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime.
  • Platform default TransformerFactory instance.
Once an application has obtained a reference to a TransformerFactory it can use the factory to configure and obtain parser instances.

The JDK default TransformerFactory works fine and allows me to run a test app in Oracle JDeveloper. The standard Xalan implmentation is available at org.apache.xalan.processor.TransformerFactoryImpl

This document may also be of help:
http://www.oracle.com/technology/tech/java...doc/readme.html

I'm hopeful to discover a way to work around this problem, but at the moment it appears their Transformer is just plain broken and recommend this solution.

[/]
tliebeck's picture

One more update...I've posted an article on Oracle's developer forums here with a really simple test case:
http://forums.oracle.com/forums/thread.jspa?threadID=398110

Unable to write document to OutputStream: javax.xml.transform.Tr

Hi,

I am using Tomcat6.0, Echo2 and Oracle10.2.1.

When I am trying to connect to my application I am getting the below Exception

*******************************************

java.io.IOException: Unable to write document to OutputStream: javax.xml.transform.TransformerException: XSL-1900: (Fatal Error) An internal error condition occurred.
at nextapp.echo2.webrender.output.XmlDocument.render(XmlDocument.java:102)
at nextapp.echo2.webrender.service.SynchronizeService.service(SynchronizeService.java:284)
at nextapp.echo2.webrender.WebRenderServlet.process(WebRenderServlet.java:273)
at com.casper.web.portal.servlets.CASPERServlet.process(CASPERServlet.java:83)
at nextapp.echo2.webrender.WebRenderServlet.doPost(WebRenderServlet.java:189)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
*******************************************************************

The above exception occurred in the below code (calling the super.process(..,..))

@Override
protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

super.process(request, response); // WARNING: never remove this otherwise your echo application will never run
}

Thanks in advance
Gan

Oracle AS has always been a

Oracle AS has always been a pain with XML parsers. The problem is that they always shipped with an old version of the XML API implementation or a modified one. The oc4j.jar always loads the Oracle version, which has never ever worked for anything I ever needed. What you want to do is provide your own implementation (Xerxes) and then change the classloading policy for your application to be PARENT LAST or the equivalent. This way, your jars will be used before the OC4J jars and the problem should be resolved.

Oroborous
http://rpgworkbench.blogspot.com

This problem can easily be

This problem can easily be solved by setting a system property in the webservlet of echo2:

package myworld;
  import nextapp.echo2.app.ApplicationInstance;
  import nextapp.echo2.webcontainer.WebContainerServlet;
  import myworld.MyApplication;

  public class MyServlet extends WebContainerServlet {
    static{
		System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl");
    }
    public ApplicationInstance newApplicationInstance() {
        return new MyApplication();
    }
}

You need to add the following libraries (lib folder):

  • xalan.jar (from apache)
  • serializer.jar (from apache)
  • xercesImp.jar (from apache)

If you're stilling running an old Java version (1.3/1.4) you might also need to add orion-web.xml (beside the web.xml in the WEB-INF folder) and the following libraries:

  • xml-apis.jar
  • xsltc.jar

orion-web.xml:

<?xml version="1.0"?>
<orion-web-app>
  <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true"/>
</orion-web-app>