commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Youngho Cho (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JCS-149) When reading keys from disk StreamCorruptedException happen when custom serialzer applied.
Date Sat, 09 May 2015 12:28:59 GMT

     [ https://issues.apache.org/jira/browse/JCS-149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Youngho Cho updated JCS-149:
----------------------------
    Description: 
When reading keys from disk, following StreamCorruptedException happen when custom serialzer
applied.

I attached the patch for this bug.

2015-05-09 21:15:41,368 [main] ERROR org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache
- Region [com_nannet_fulcrum_morphology_ko_entry_WordEntry] Problem loading keys for file
com_nannet_fulcrum_morphology_ko_entry_WordEntry
java.io.StreamCorruptedException: invalid stream header: 78DA5BF3
	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
	at org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware.<init>(ObjectInputStreamClassLoaderAware.java:33)
	at org.apache.commons.jcs.utils.serialization.StandardSerializer.deSerialize(StandardSerializer.java:79)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDisk.readObject(IndexedDisk.java:118)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.loadKeys(IndexedDiskCache.java:333)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeStoreFromPersistedData(IndexedDiskCache.java:285)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeKeysAndData(IndexedDiskCache.java:249)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:182)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:154)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory.createCache(IndexedDiskCacheFactory.java:61)


Here is a patch.
We need an ElementSerializer during IndexedDiskCache object creation because when key read
from disk, we need serializer info.

Index: indexed/IndexedDiskCacheFactory.java
===================================================================
--- indexed/IndexedDiskCacheFactory.java	(revision 1678464)
+++ indexed/IndexedDiskCacheFactory.java	(working copy)
@@ -57,9 +57,8 @@
             log.debug( "Creating DiskCache for attributes = " + idca );
         }
 
-        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca );
+        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca, elementSerializer);
         cache.setCacheEventLogger( cacheEventLogger );
-        cache.setElementSerializer(elementSerializer);
 
         return cache;
     }


Thanks

Youngho

  was:
2015-05-09 21:15:41,368 [main] ERROR org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache
- Region [com_nannet_fulcrum_morphology_ko_entry_WordEntry] Problem loading keys for file
com_nannet_fulcrum_morphology_ko_entry_WordEntry
java.io.StreamCorruptedException: invalid stream header: 78DA5BF3
	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
	at org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware.<init>(ObjectInputStreamClassLoaderAware.java:33)
	at org.apache.commons.jcs.utils.serialization.StandardSerializer.deSerialize(StandardSerializer.java:79)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDisk.readObject(IndexedDisk.java:118)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.loadKeys(IndexedDiskCache.java:333)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeStoreFromPersistedData(IndexedDiskCache.java:285)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeKeysAndData(IndexedDiskCache.java:249)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:182)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:154)
	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory.createCache(IndexedDiskCacheFactory.java:61)


> When reading keys from disk StreamCorruptedException happen when custom serialzer applied.
> ------------------------------------------------------------------------------------------
>
>                 Key: JCS-149
>                 URL: https://issues.apache.org/jira/browse/JCS-149
>             Project: Commons JCS
>          Issue Type: Bug
>          Components: Indexed Disk Cache
>    Affects Versions: jcs-2.0-beta-1, jcs-2.0
>            Reporter: Youngho Cho
>
> When reading keys from disk, following StreamCorruptedException happen when custom serialzer
applied.
> I attached the patch for this bug.
> 2015-05-09 21:15:41,368 [main] ERROR org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache
- Region [com_nannet_fulcrum_morphology_ko_entry_WordEntry] Problem loading keys for file
com_nannet_fulcrum_morphology_ko_entry_WordEntry
> java.io.StreamCorruptedException: invalid stream header: 78DA5BF3
> 	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
> 	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
> 	at org.apache.commons.jcs.io.ObjectInputStreamClassLoaderAware.<init>(ObjectInputStreamClassLoaderAware.java:33)
> 	at org.apache.commons.jcs.utils.serialization.StandardSerializer.deSerialize(StandardSerializer.java:79)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDisk.readObject(IndexedDisk.java:118)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.loadKeys(IndexedDiskCache.java:333)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeStoreFromPersistedData(IndexedDiskCache.java:285)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.initializeKeysAndData(IndexedDiskCache.java:249)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:182)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCache.<init>(IndexedDiskCache.java:154)
> 	at org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory.createCache(IndexedDiskCacheFactory.java:61)
> Here is a patch.
> We need an ElementSerializer during IndexedDiskCache object creation because when key
read from disk, we need serializer info.
> Index: indexed/IndexedDiskCacheFactory.java
> ===================================================================
> --- indexed/IndexedDiskCacheFactory.java	(revision 1678464)
> +++ indexed/IndexedDiskCacheFactory.java	(working copy)
> @@ -57,9 +57,8 @@
>              log.debug( "Creating DiskCache for attributes = " + idca );
>          }
>  
> -        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca
);
> +        IndexedDiskCache<K, V> cache = new IndexedDiskCache<K, V>( idca,
elementSerializer);
>          cache.setCacheEventLogger( cacheEventLogger );
> -        cache.setElementSerializer(elementSerializer);
>  
>          return cache;
>      }
> Thanks
> Youngho



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message