Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

JAXP 1.2

  Asked By: Aditi    Date: Jul 01    Category: Java    Views: 772
  

I have an issue with JAXP 1.2 in my current (hobby) project. I am
trying to write a multithreaded server that accepts XML from a socket,
parses the information into a HashMap, and sends the HashMap as string
as a response. (There will of course be more functionality than this
later, this is merely my current goal.)
I am trying to use DocumentBuilder.parse(InputStream) in my worker
thread. I am using validation against a DTD that I wrote. Everytime I
attempt to parse I get the following error message (with stack trace):

java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.DataInputStream.read(DataInputStream.java:167)
at
org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityMana\
ger.java:3305)

at org.apache.xerces.impl.io.UTF8Reader.read(UTF8Reader.java:298)
at
org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java\
:3186)

at
org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEntityManage\
r.java:2861)

at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XM\
LDocumentScannerImpl.java:987)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFr\
agmentScannerImpl.java:333)

at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfig\
uration.java:529)

at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfig\
uration.java:585)

at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:221)
at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)

at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
at
net.merchantconsulting.TakeCharge.Server.Worker.handleClient(SocketServer.java:1\
88)

at
net.merchantconsulting.TakeCharge.Server.Worker.run(SocketServer.java:131)
at java.lang.Thread.run(Thread.java:536)

If the XML statement does not conform to the DTD I get the following
error message:
Error: URI=null Line=1: The content of element type "USER" must match
"(ACTION,USERID,USERPW)".

followed by the previous error message.

I wanted to see if anyone knew the cause of this problem before I
sent the code involved. I googled for a solution, but I could find
nothing. Any help would be appreciated. If you do need to see the
code, I will post it or email it privately.

Share: 



Tagged: