• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot consume restful web services when size of xml is large

 
A.G Rajkotia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is my table

table: Product
id code itemName price description reportGroup inventory

I use restful web services to get this entity


I consume restful web services from java application using resteasy



Everything works fine when my product table has less than 67 rows

When table rows increase above 67 my application consuming does not get any response and freezes..
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "freeze" mean? Surely the app does not stop running...? Have you debugged the server side to see what's going on, meaning, how far it gets, and which methods are or are not being executed?

By the way, wherever there's I/O involved you should never write an empty catch handler. At least print the error message to where you will see it, so that you know if something goes wrong.
 
A.G Rajkotia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:What does "freeze" mean? Surely the app does not stop running...? Have you debugged the server side to see what's going on, meaning, how far it gets, and which methods are or are not being executed?

By the way, wherever there's I/O involved you should never write an empty catch handler. At least print the error message to where you will see it, so that you know if something goes wrong.



The server returns the response successfully. I even get the response with response code 200. After that the application get stuck on readEntity line and does not proceed to the next line. No exception is thrown (app freezes)

The real application does not have empty catch handler.

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so the actual code is different in several respects than what you posted; in the future, please post exactly what you're using to AvoidRedHerrings.

Have you tried both readEntity and getEntity separately? Trying them both in the same request (as the code you posted does) is not a good idea, especially as you're disregarding the result of the readEntity call.
 
A.G Rajkotia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:OK, so the actual code is different in several respects than what you posted; in the future, please post exactly what you're using to AvoidRedHerrings.

Have you tried both readEntity and getEntity separately? Trying them both in the same request (as the code you posted does) is not a good idea, especially as you're disregarding the result of the readEntity call.


Yes I have. Each of the separately and even together. Nothing works. After waiting for a few mins the application throws the following error (I've just discovered it)

Exception
org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException
- with linked exception:
[java.net.SocketException: Connection reset]
at org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.readFrom(AbstractJAXBProvider.java:105)
at org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.readFrom(AbstractJAXBProvider.java:105)
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:59)
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:51)
at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59)
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
at org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.aroundReadFrom(DigitalVerificationInterceptor.java:32)
at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:433)
at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:385)
at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:358)
at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:352)
at thebigapplication.StartBox.get(StartBox.java:144)
at thebigapplication.ProductItem.ProductItemDatabase.getAllItems(ProductItemDatabase.java:165)
at thebigapplication.MainGui.initializeApplication(MainGui.java:101)
at thebigapplication.MainGui.createAndShowGui(MainGui.java:42)
at thebigapplication.TheBigApplication.main(TheBigApplication.java:30)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[java.net.SocketException: Connection reset]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:261)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:125)
at org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.readFrom(AbstractJAXBProvider.java:101)
... 15 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:251)
at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:209)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:171)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:138)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream.read(SelfExpandingBufferredInputStream.java:57)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2844)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:302)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1753)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.peekChar(XMLEntityScanner.java:497)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2649)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:258)
... 19 more
 
A.G Rajkotia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to mention this again... The app runs perfectly when rows in table is less than 67. This only happens when rows exceed 67 rows
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The socket close by the server suggests to me that the client is choking and unable to continue reading the response stream.

Just throwing out ideas here:

Does the client have enough memory to build a DOM that big? Recall that a parsed XML document as a DOM uses a LOT more memory than the size of the document suggests.

Bill
 
A.G Rajkotia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:The socket close by the server suggests to me that the client is choking and unable to continue reading the response stream.

Just throwing out ideas here:

Does the client have enough memory to build a DOM that big? Recall that a parsed XML document as a DOM uses a LOT more memory than the size of the document suggests.

Bill



Maybe that's the problem, but how do we increase client's memory.
 
Ulf Dittmer
Rancher
Posts: 42970
73
 
A.G Rajkotia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Increasing the heap size does not help. Still Stuck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!