You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a program that uses the original JDBM and I am trying to port it to JDBM3.
My use case is to use String as a key and either HashSet of Strings or a custom Java object as a value.
When I substitute JDBM3 code I get an error related to object serealiation
Exception in thread "Thread-0" java.lang.InternalError: Unknown serialization header: 97
at org.apache.jdbm.Serialization.deserialize(Serialization.java:962)
at org.apache.jdbm.Serialization.deserializeArrayList(Serialization.java:1136)
at org.apache.jdbm.Serialization.deserialize(Serialization.java:919)
at org.apache.jdbm.Serialization.deserialize(Serialization.java:623)
at org.apache.jdbm.DBStore.fetch2(DBStore.java:400)
at org.apache.jdbm.DBStore.fetch(DBStore.java:366)
at org.apache.jdbm.DBCacheRef.fetch(DBCacheRef.java:213)
at org.apache.jdbm.BTreeLazyRecord.get(BTreeLazyRecord.java:28)
at org.apache.jdbm.HTreeBucket.getValue(HTreeBucket.java:219)
at org.apache.jdbm.HTreeDirectory.get(HTreeDirectory.java:160)
at org.apache.jdbm.HTree.get(HTree.java:199)
at org.apache.jdbm.HTree.containsKey(HTree.java:248)
at edu.pitt.terminology.util.JDBMMap.containsKey(JDBMMap.java:83)
Which looks like it is trying to deserealize HashSet as an ArrayList.
Here is my initialization code:
// init record manager
DBMaker d = DBMaker.openFile(filename);
// set options
d.disableTransactions();
d.closeOnExit();
d.enableHardCache();
d.disableLocking();
db = d.make();
// create or load hashtable from given file
map = db.getTreeMap(tablename);
if(map == null)
map = db.createTreeMap(tablename);
Here is where I invoke a wrapper function
Set termList = new HashSet(filterTerms(word,terms));
if(wordMap.containsKey(word)){
termList.addAll(getWordTerms(word));
}
wordsMap.put(word,termList);
It fails on containsKey() line, however I have a hunch that the issue is with serializing HashSet incorrectly.
The text was updated successfully, but these errors were encountered:
Sorry for the post. I resolved this issue. It had to do with me wanting to use the same file for multiple tables, like I did it in JDBM v1. Once each table got its own file, it worked.
I did encounter issues though with serializing Objects that contained arrays of String. When I switched arrays to Lists it worked.
I have a program that uses the original JDBM and I am trying to port it to JDBM3.
My use case is to use String as a key and either HashSet of Strings or a custom Java object as a value.
When I substitute JDBM3 code I get an error related to object serealiation
Exception in thread "Thread-0" java.lang.InternalError: Unknown serialization header: 97
at org.apache.jdbm.Serialization.deserialize(Serialization.java:962)
at org.apache.jdbm.Serialization.deserializeArrayList(Serialization.java:1136)
at org.apache.jdbm.Serialization.deserialize(Serialization.java:919)
at org.apache.jdbm.Serialization.deserialize(Serialization.java:623)
at org.apache.jdbm.DBStore.fetch2(DBStore.java:400)
at org.apache.jdbm.DBStore.fetch(DBStore.java:366)
at org.apache.jdbm.DBCacheRef.fetch(DBCacheRef.java:213)
at org.apache.jdbm.BTreeLazyRecord.get(BTreeLazyRecord.java:28)
at org.apache.jdbm.HTreeBucket.getValue(HTreeBucket.java:219)
at org.apache.jdbm.HTreeDirectory.get(HTreeDirectory.java:160)
at org.apache.jdbm.HTree.get(HTree.java:199)
at org.apache.jdbm.HTree.containsKey(HTree.java:248)
at edu.pitt.terminology.util.JDBMMap.containsKey(JDBMMap.java:83)
Which looks like it is trying to deserealize HashSet as an ArrayList.
Here is my initialization code:
Here is where I invoke a wrapper function
Set termList = new HashSet(filterTerms(word,terms));
if(wordMap.containsKey(word)){
termList.addAll(getWordTerms(word));
}
wordsMap.put(word,termList);
It fails on containsKey() line, however I have a hunch that the issue is with serializing HashSet incorrectly.
The text was updated successfully, but these errors were encountered: