cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Got an IllegalStateException: unread block data while Querying on WTPart

Highlighted
Granite

Got an IllegalStateException: unread block data while Querying on WTPart

Hi All,

I need to export all WTparts from Windchill DB, so i used below code, it previously works but it suddenly gives an such errors,, i also observerd that it related to only WTPart.. any query on WTPart is not Working.. each query gives same error: java.lang.IllegalStateException: unread block data

my Query is here..

QuerySpec qs = new QuerySpec(WTPart.class);

QueryResult qr = PersistenceHelper.manager.find(qs);

while (qr.hasMoreElements()) {

prt = (WTPart)qr.nextElement();

cName = prt.getContainerName();

partNum = prt.getNumber();

system.out.println("*******" +partNum);

}

Exception in thread "main" java.lang.IllegalStateException: unread block data

at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2419)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1380)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)

at wt.method.MethodResult.readExternal(MethodResult.java:152)

at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1835)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1794)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)

at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:324)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173)

at wt.method.MethodServerImpl_Stub.invoke(Unknown Source)

at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:647)

at wt.services.ServiceFactory$ClientInvocationHandler.invoke(ServiceFactory.java:349)

at com.sun.proxy.$Proxy0.find(Unknown Source)

at ext.util.WindVUtil.getLatestParts(WindVUtil.java:690)

at ext.util.ExportParts.exportParts(ExportParts.java:125)

at ext.util.ExportParts.main(ExportParts.java:101)

7 REPLIES 7

Re: Got an IllegalStateException: unread block data while Querying on WTPart

Hi, have you found a solution?

Re: Got an IllegalStateException: unread block data while Querying on WTPart

Hi, I'm facing this exception too (for EPMDocuments). Have you found a solution?

Re: Got an IllegalStateException: unread block data while Querying on WTPart

Hi Sampurna,

Sorry, I also not able to find the solution for this.

Regards,

Vivek.

Re: Got an IllegalStateException: unread block data while Querying on WTPart

It looks like the method is being invoked remotely, correct?

Are the following helpful at all?

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS72059

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS177598

Re: Got an IllegalStateException: unread block data  while Querying on WTPart

Hi Lori,

Thanks so much for the help! I was hoping we could at least catch the IllegalStateException so that it doesn't interrupt my execution. However this exception refuses to be caught. The first link you suggested (https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS72059‌) helped in changing the Exception (we are doing a similar thing with EPMDocumentMaster), but even the new WTRemoteException could not be caught.

Regards,

Sampurna

Re: Got an IllegalStateException: unread block data while Querying on WTPart

My first guess would be that your client and server classes do not match in some nuances of serialization format, i.e. that you have different class files on your client and server and the server is writing more or less than the other expects to read.

Re: Got an IllegalStateException: unread block data  while Querying on WTPart

Hi Jess,

In my case the client and the server are one and the same. Using API, I am attempting to read one EPMDocument number at a time from a .txt file and deleting that EPMDocument (and all objects in its ReferencedBy and UsedByReference list). For most EPMDocuments, the deletion is working fine. For about 1 in 500 EPMDocuments, we are facing IllegalStateException

Exception in thread "main" java.lang.IllegalStateException: unread block data

at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2421)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1382)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)

at wt.method.MethodResult.readExternal(MethodResult.java:153)

at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1837)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)

at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:325)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:174)

at wt.method.MethodServerImpl_Stub.invoke(Unknown Source)

at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:646)

at wt.services.ServiceFactory$ClientInvocationHandler.invoke(ServiceFactory.java:349)

at com.sun.proxy.$Proxy11.navigateReferencedBy(Unknown Source)

at ext.audco.utility.EPMDocumentMassDeleteUtil.getEPMDocReferences(EPMDocumentMassDeleteUtil.java:197)

at ext.audco.utility.EPMDocumentMassDeleteUtil.processInputFile(EPMDocumentMassDeleteUtil.java:119)

at ext.audco.utility.EPMDocumentMassDeleteUtil.main(EPMDocumentMassDeleteUtil.java:348)

and that is interrupting the execution. I was wondering if we could catch this exception so that the program continues to run. We have attempted using try..catch, throws, https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS72059‌, using UTF-8 explicitly instead of ANSI and using FileReader instead of InputStreamReader

Thanks so much,

Sampurna