Need to know Class of a Byte Array saved in MySQL Database

纵然是瞬间 提交于 2019-12-11 03:39:02

问题


I am stuck at strange issue.

I have a jbpm5.3 web panel and what i am trying to do it to create web services in servlets by manipulating mysql database. i have done all the things but stuck in one byte array. this web panel uses a table workiteminfo in which it saves all the details and uses this byte array for further processing.

My problem is that i do not have information about this byte array, but what i got to know is that this byte array is an object an unknown class. If i have this class skeleton my problem will be solved.

Here im giving screenshot of that table, NULL entries are from my code :(

http://s9.postimg.org/hbgz6kar3/issue.png

What i have tried:

  1. Used random byte array [Not worked]
  2. Used byte array from another row [Web Panel gone mad]
  3. I can not change even a single line from web panel's code, everything need to be done at my end.

Please guys help me out, what approaches can i use to solve this issue?


回答1:


jBPM use protobuf to serialize the work item Data. It doesn't use common java serialization.

If you want to add some work items for jBpm you can launch a jBpm workflow with one UserTask or something similar.




回答2:


Not sure what are you trying to do, but hey, who am I to judge you ;) The ByteArray can't be de-serialized to any java class because it is not just 1 serialized object. In fact, it appears to be 4 or more. As Fernando mentioned, jbpm uses protobuf to de/serialize its own state. In version 5.3, the Serializer implementation is this:

https://github.com/droolsjbpm/drools/blob/5.3.x/drools-core/src/main/java/org/drools/marshalling/impl/OutputMarshaller.java#L1067

You can see there how the writeWorkItem method is implemented. The analogous class of OutputMarshaller is InputMarshaller:

https://github.com/droolsjbpm/drools/blob/5.3.x/drools-core/src/main/java/org/drools/marshalling/impl/InputMarshaller.java#L1132

This class contains a readWorkItem method that knows how to marshall the byte array into a WorkItem class.

The serialization is triggered from the WorkItemInfo class.

One idea could be to use this class to de-serialize the whole table.

Hope it helps,



来源:https://stackoverflow.com/questions/23935935/need-to-know-class-of-a-byte-array-saved-in-mysql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!