question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalStateException: zip file closed

See original GitHub issue

When using version 9.12 on kubernetes 1.15 with spring boot 2.2.4 we get following error. When using version 9.11 we do not have this issue.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [x.x.x.SerializedTypeNameResolver]: Factory method 'serializedTypeNameResolver' threw exception; nested exception is java.lang.IllegalStateException: zip file closed
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
	... 95 common frames omitted
Caused by: java.lang.IllegalStateException: zip file closed
	at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:915) ~[na:na]
	at java.base/java.util.zip.ZipFile.stream(ZipFile.java:647) ~[na:na]
	at java.base/java.util.zip.ZipFile$1.stream(ZipFile.java:1131) ~[na:na]
	at java.base/java.util.jar.JarFile.stream(JarFile.java:534) ~[na:na]
	at org.reflections.vfs.ZipDir.lambda$getFiles$2(ZipDir.java:21) ~[reflections-0.9.12.jar!/:na]
	at org.reflections.Reflections.scan(Reflections.java:260) ~[reflections-0.9.12.jar!/:na]
	at org.reflections.Reflections.scan(Reflections.java:216) ~[reflections-0.9.12.jar!/:na]
	at org.reflections.Reflections.<init>(Reflections.java:137) ~[reflections-0.9.12.jar!/:na]
	at org.reflections.Reflections.<init>(Reflections.java:182) ~[reflections-0.9.12.jar!/:na]
	at org.reflections.Reflections.<init>(Reflections.java:155) ~[reflections-0.9.12.jar!/:na]
	at x.x.x.serializedTypeNameResolver.getTypesForName(SerializedTypeNameResolver.java:44) ~[integration-axondb-11.369.0.jar!/:11.369.0]
	at x.x.x.serializedTypeNameResolver.<init>(GSerializedTypeNameResolver.java:23) ~[integration-axondb-11.369.0.jar!/:11.369.0]
	at x.x.x.serializedTypeNameResolver(AxonServerSharedConfiguration.java:115) ~[integration-axondb-11.369.0.jar!/:11.369.0]

Our config is as follows:

private Map<String, Class<?>> getTypesForName() {
        Reflections reflections = new Reflections("x.x.x");
        return reflections.getTypesAnnotatedWith(JsonTypeInfo.class).stream()
            .map(clazz -> clazz.getAnnotationsByType(JsonSubTypes.class))
            .flatMap(Arrays::stream)
            .flatMap(annotation -> Arrays.stream(annotation.value()))
            .filter(type -> isValidType(type.value()))
            .collect(toMap(JsonSubTypes.Type::name, JsonSubTypes.Type::value, (name1, name2) -> name1));
    }

“edit” It runs on adoptOpenJdk 11.0.6_10

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:26
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
yotamshtosselfgcommented, Jul 16, 2020

#me_too --> downgraded to 0.9.11 as suggested.

7reactions
nachomezzadracommented, Nov 13, 2020

This seems to have been fixed now in Spring boot 2.3.6.RELEASE

  • “java.lang.IllegalStateException: zip file closed” when call JarFileWrapper.stream() of spring-boot-loader #23821

https://github.com/spring-projects/spring-boot/releases/tag/v2.3.6.RELEASE

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jetty - java.lang.IllegalStateException: zip file closed
A bad/corrupt JAR file in your classpath. The JVM built-in URL caching getting in the way. For a bad/corrupt JAR file, you'll have...
Read more >
IllegalStateException "zip file closed" occurring in plugins
It is possible that restarting Confluence after installing the plugin is a workaround for this error.
Read more >
JAVA.LANG.ILLEGALSTATEEXCEPTION: ZIP FILE CLOSED
Error Message: java.lang.IllegalStateException: zip file closed . Stack Trace: java.lang.IllegalStateException: zip file closed at java.lang.Throwable.<init> ...
Read more >
java.lang.IllegalStateException(zip file closed)
We are currently using CDH 5.8.3 and most of our oozie hive actions are failing frequently because of following - 50836.
Read more >
hive: 'java.lang.IllegalStateException(zip file closed)' - Apache
hive: 'java.lang.IllegalStateException(zip file closed)'. Status: Assignee: Priority: Resolution: Open. Unassigned. Major. Unresolved.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found