Skip to main content
1-Visitor
Sep 12, 2013 6:58 AM UTC
Question

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

1-Visitor
Sep 24, 2013 7:42 AM UTC

Hi, have you found a solution?

Translate
1-Visitor
Mar 16, 2015 12:46 PM UTC

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

Translate
vuchekar1-VisitorAuthor
1-Visitor
Mar 17, 2015 7:20 AM UTC

Hi Sampurna,

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

Regards,

Vivek.

Translate
23-Emerald II
Mar 24, 2015 12:30 AM UTC

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

Translate
1-Visitor
Mar 30, 2015 3:31 PM UTC

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

Translate
12-Amethyst
Mar 31, 2015 10:23 AM UTC

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.

Translate
1-Visitor
Mar 31, 2015 2:27 PM UTC

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

Translate