Hi, I've been debugging a problem with an older Cocoon (2.1.8) application. There was a sporadic bug that turned out to be the consequence of a swallowed exception in a piece of code that some other guy wrote. I also noticed that this piece of code, which parses some XML fragments, was horribly slow, and that there was no EntityResolver set on the parser. So I fixed the swallowed exception, and while I was at it, I set the parser to use Cocoon catalog-based EntityResolver.

The result is that (a) this bottleneck runs about 3 times faster, although it's still slower than I'd like it to be, and (b) about every 10-12 times that I ran it last night, it would still die with a (no longer swallowed!) java.net.ConnectException. I think this is the exception that was getting buried before.

So anyway, the question is: why am I still getting network errors now that I'm using the Cocoon EntityResolver? The stack trace looks like this:

Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java: 195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:520)
    at java.net.Socket.connect(Socket.java:470)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:387)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:522)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
    at sun.net.www.http.HttpClient.New(HttpClient.java:304)
    at sun.net.www.http.HttpClient.New(HttpClient.java:321)
at sun .net .www .protocol .http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:813) at sun .net .www .protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java: 765) at sun .net .www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:690) at sun .net .www .protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java: 934) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.startPE(Unknown Source)

My DTD looks like this:

<!DOCTYPE xhtml-fragment
[
 <!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent";>
 %HTMLlat1;
 <!ENTITY % HTMLspecial PUBLIC
    "-//W3C//ENTITIES Special for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent";>
  %HTMLspecial;
]>

I looked at the Xerces source code and found that my EntityResolver is invoked by XMLEntityManager.resolveEntity(), but not by XMLEntityManager.startEntity() which is what is being called by XMLDTDScannerImpl.startPE(), which is what's trying to make the network connection... for whatever that's worth.

Any ideas?

thx-a-lot
—ml—



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to