• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Getting java.util.zip.ZipException: oversubscribed dynamic bit lengths tre

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

For the high performance and optimized caching mechanism, we're cashing java objects in-memory.

Following are the code snippets which I wrote to do in-memory compression / decompression of the java objects.

I'm compressing java objects in-memory and storing compressed data in bytes array, whenever it's required to use, I just uncompress it in memory and use it and then again dump (garbage) it when use is finished.

Instead of keeping real objects, I'm keeping compressed object bytes in memory to save huge memory.

I'm getting deadly java error while decompressing data, the error is as under,

Caused by: java.util.zip.ZipException: oversubscribed dynamic bit lengths tree

I don't know what's wrong with it.

I tried creating many sample programs also with huge data, but it worked fine in case of standalone applicatoin but in J2EE application its not working with real time data.

Following is the code to compress and decompress data.

Following is the code to compress the data

Object obj = new String("hello world"); // some objects
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZipOutputStream gos = new GZipOutputStream(baos);
ObjectOutputStream oos = new ObjectOutputStream(gos);
byte[] compressedData = baos.toBytesArray();

Following code is to decompress the data

ByteArrayInputStream baos = new ByteArrayInputStream(compressedData);
GZipInputStream gos = new GZipInputStream(baos);
ObjectInputStream oos = new ObjectInputStream(gos);
obj = oos.readObject();

Does any body have any idea about how to get a rid of this problem.

If it does happen due to GZip input/output stream, is there any alternate solutions to compress/decompress data and store as a bytes array in memory.

Thanks & Regards
Tanmay Parikh
    Bookmark Topic Watch Topic
  • New Topic