You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Charles Moulliard <cm...@gmail.com> on 2010/01/15 09:55:39 UTC

Apache Felix Karaf (1.2.0) : ERROR: JarContent: Unable to read bytes. (java.lang.IllegalStateException: zip file closed)

Hi,

I get this error :

ERROR: JarContent: Unable to read bytes. (java.lang.IllegalStateException:
zip file closed)
java.lang.IllegalStateException: zip file closed
        at java.util.zip.ZipFile.ensureOpen(ZipFile.java:403)
        at java.util.zip.ZipFile.getEntry(ZipFile.java:148)
        at java.util.jar.JarFile.getEntry(JarFile.java:206)
        at
org.apache.felix.framework.util.JarFileX.getEntry(JarFileX.java:61)
        at
org.apache.felix.framework.cache.JarContent.getEntryAsBytes(JarContent.java:120)
        at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1696)
        at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:682)
        at
org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
        at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at
com.sun.jersey.core.spi.factory.AbstractRuntimeDelegate.createUriBuilder(AbstractRuntimeDelegate.java:101)
        at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69)
        at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80)
        at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:786)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:770)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:731)
        at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
        at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
        at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
        at
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
        at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
        at
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
        at
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
        at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:324)
        at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
        at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
        at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
        at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

Can someone explain the reason and how to avoid this ?

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm

Re: Apache Felix Karaf (1.2.0) : ERROR: JarContent: Unable to read bytes. (java.lang.IllegalStateException: zip file closed)

Posted by Charles Moulliard <cm...@gmail.com>.
Doing a apache felix karaf shutdown and restart has resolved the issue.

I think that jars files which are put under the folder WEB-INF/lib of my
bundle are responsible of this situation. I presume that the jars were
locked by another thread bundle and when updating it, this error has been
generated.

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Fri, Jan 15, 2010 at 4:31 PM, Richard S. Hall <he...@ungoverned.org>wrote:

> Typically when we see this sort of thing, people have multiple threads
> running with some trying to read stuff from bundles and others trying to
> update/uninstall/refresh bundles. We don't lock bundles for reads, so it is
> possible for it to go away in the middle of another thread's read.
>
> We've looked into this before and concluded that the approach is correct,
> however, maybe it would be possible to convert the IllegalStateException to
> a CNFE...if you open a JIRA issue I will look into it.
>
> -> richard
>
> p.s. We've also seen this issue in other weird cases
>
>
> On 1/15/10 3:55, Charles Moulliard wrote:
>
>> Hi,
>>
>> I get this error :
>>
>> ERROR: JarContent: Unable to read bytes. (java.lang.IllegalStateException:
>> zip file closed)
>> java.lang.IllegalStateException: zip file closed
>>         at java.util.zip.ZipFile.ensureOpen(ZipFile.java:403)
>>         at java.util.zip.ZipFile.getEntry(ZipFile.java:148)
>>         at java.util.jar.JarFile.getEntry(JarFile.java:206)
>>         at
>> org.apache.felix.framework.util.JarFileX.getEntry(JarFileX.java:61)
>>         at
>>
>> org.apache.felix.framework.cache.JarContent.getEntryAsBytes(JarContent.java:120)
>>         at
>>
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1696)
>>         at
>>
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:682)
>>         at
>> org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
>>         at
>>
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>         at
>>
>> com.sun.jersey.core.spi.factory.AbstractRuntimeDelegate.createUriBuilder(AbstractRuntimeDelegate.java:101)
>>         at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69)
>>         at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80)
>>         at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99)
>>         at
>>
>> com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:786)
>>         at
>>
>> com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:770)
>>         at
>>
>> com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:731)
>>         at
>>
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>>         at
>>
>> com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
>>         at
>>
>> com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
>>         at
>>
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>>         at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
>>         at
>>
>> org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
>>         at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>         at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>>         at
>>
>> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
>>         at
>>
>> org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
>>         at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>         at org.mortbay.jetty.Server.handle(Server.java:324)
>>         at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
>>         at
>>
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
>>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
>>         at
>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
>>         at
>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
>>         at
>>
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>>         at
>>
>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
>>
>> Can someone explain the reason and how to avoid this ?
>>
>> Regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Apache Felix Karaf (1.2.0) : ERROR: JarContent: Unable to read bytes. (java.lang.IllegalStateException: zip file closed)

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Typically when we see this sort of thing, people have multiple threads 
running with some trying to read stuff from bundles and others trying to 
update/uninstall/refresh bundles. We don't lock bundles for reads, so it 
is possible for it to go away in the middle of another thread's read.

We've looked into this before and concluded that the approach is 
correct, however, maybe it would be possible to convert the 
IllegalStateException to a CNFE...if you open a JIRA issue I will look 
into it.

-> richard

p.s. We've also seen this issue in other weird cases

On 1/15/10 3:55, Charles Moulliard wrote:
> Hi,
>
> I get this error :
>
> ERROR: JarContent: Unable to read bytes. (java.lang.IllegalStateException:
> zip file closed)
> java.lang.IllegalStateException: zip file closed
>          at java.util.zip.ZipFile.ensureOpen(ZipFile.java:403)
>          at java.util.zip.ZipFile.getEntry(ZipFile.java:148)
>          at java.util.jar.JarFile.getEntry(JarFile.java:206)
>          at
> org.apache.felix.framework.util.JarFileX.getEntry(JarFileX.java:61)
>          at
> org.apache.felix.framework.cache.JarContent.getEntryAsBytes(JarContent.java:120)
>          at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1696)
>          at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:682)
>          at
> org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
>          at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1650)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>          at
> com.sun.jersey.core.spi.factory.AbstractRuntimeDelegate.createUriBuilder(AbstractRuntimeDelegate.java:101)
>          at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69)
>          at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80)
>          at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99)
>          at
> com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:786)
>          at
> com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:770)
>          at
> com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:731)
>          at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>          at
> com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
>          at
> com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
>          at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>          at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
>          at
> org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
>          at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>          at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>          at
> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
>          at
> org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
>          at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>          at org.mortbay.jetty.Server.handle(Server.java:324)
>          at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
>          at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
>          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
>          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
>          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
>          at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>          at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
>
> Can someone explain the reason and how to avoid this ?
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>
>    

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org