{"record":{"id":"e4efe1c5a12e6165","repo":"hibernate/hibernate-orm","slug":"unable-to-access-stream-from-jar-file-s-for-ent","errorCode":null,"errorMessage":"Unable to access stream from jar file [%s] for entry [%s]","messagePattern":"Unable to access stream from jar file \\[(.+?)\\] for entry \\[(.+?)\\]","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ExplodedArchiveDescriptor.java","lineNumber":152,"sourceCode":"\t\ttry (final JarFile jarFile = new JarFile(rootFile)) {\n\t\t\tfinal Enumeration<? extends ZipEntry> entries = jarFile.entries();\n\t\t\twhile ( entries.hasMoreElements() ) {\n\t\t\t\tfinal ZipEntry zipEntry = entries.nextElement();\n\t\t\t\tif ( zipEntry.isDirectory() ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfinal String name = extractName( zipEntry );\n\t\t\t\tif ( !name.endsWith(  \".class\" ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfinal String relativeName = extractRelativeName( zipEntry );\n\t\t\t\tfinal InputStreamAccess inputStreamAccess;\n\t\t\t\ttry {\n\t\t\t\t\tinputStreamAccess = buildByteBasedInputStreamAccess( name, jarFile.getInputStream( zipEntry ) );\n\t\t\t\t}\n\t\t\t\tcatch (IOException e) {\n\t\t\t\t\tthrow new ArchiveException(\n\t\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\t\"Unable to access stream from jar file [%s] for entry [%s]\",\n\t\t\t\t\t\t\t\t\tjarFile.getName(),\n\t\t\t\t\t\t\t\t\tzipEntry.getName()\n\t\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// todo (jpa4) : for now, pass null\n\t\t\t\tentryConsumer.accept( new ArchiveEntryImpl(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\trelativeName,\n\t\t\t\t\t\tnew URL( \"jar:\" + entryUriBase + \"!/\" + relativeName ).toURI(),\n\t\t\t\t\t\tinputStreamAccess\n\t\t\t\t) );\n\t\t\t}\n\t\t}\n\t\tcatch (IOException e) {","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ExplodedArchiveDescriptor.java#L134-L170","documentation":"While visiting entries of a jar during archive scanning, JarFile.getInputStream(zipEntry) throws IOException and Hibernate wraps it as ArchiveException naming the jar file and the zip entry. The original IOException is not chained, so the jar/entry names in the message are the only debugging clues — typically a corrupted, locked, or unreadable jar.","triggerScenarios":"Opening an input stream for a .class entry inside the scanned jar fails: broken zip central directory, truncated entry, jar locked by another process (most commonly Windows), or the file disappearing mid-scan.","commonSituations":"Windows file locks during redeploy; partially copied jars in container images; antivirus interfering with reads; parallel deployment tooling mutating archives during startup.","solutions":["Run jar tf <jar> / unzip -t <jar> on the named jar to verify integrity; replace it if broken.","Ensure nothing locks or rewrites the jar during Hibernate scanning (stop the server before redeploy, exclude the deploy dir from antivirus).","Adopt atomic deployments (copy to temp, then rename) so scanners never see partial archives."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Catch org.hibernate.boot.archive.spi.ArchiveException around SessionFactory build. The message names the jar and entry (the IOException is not chained): verify that jar with jar tf/ unzip -t; if a redeploy was in flight, retry once after it completes; if corrupted, replace the jar.","preventionTips":["Stop servers or quiesce redeploys before Hibernate scans archives.","Exclude deploy directories from antivirus real-time scanning on Windows.","Validate jars in CI so corrupted artifacts never reach deployment."],"tags":["hibernate","archive-scanning","io","file-lock","deployment"],"backgroundTag":"archive-read-io-error","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}