hibernate/hibernate-orm · error · ArchiveException

Error accessing JarFile entry

Error message

Error accessing JarFile entry [{}]

What it means

Catch-all wrapper around iteration of entries inside a nested jar found within the archive: any unexpected Exception while reading sub-entries or building the stream access for a nested jar is rethrown as this ArchiveException with the offending outer entry name. Usually indicates a corrupt or unreadable nested jar.

Solutions

  1. Rebuild or re-download the jar file to fix corruption.
  2. Verify jar integrity with 'jar tf file.jar' or 'unzip -t file.jar'.
  3. Avoid replacing jar files in a running deployment; redeploy instead.

Example fix

The jar entry could not be read. Verify the jar file is not corrupted (run 'jar tf' on it), that it is fully written before Hibernate scans it, and that the process has read access to it.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: The jar referenced by a <jar-file> entry or the persistence unit root is corrupt, truncated, or becomes unreadable while Hibernate iterates its entries.

Common situations: Corrupted jar from a partial download or failed build; jar modified/replaced while the application is running; disk I/O errors.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/d73159caa5efa733. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/archive/internal/JarFileBasedArchiveDescriptor.java:96

						while ( subZipEntry != null ) {
							if ( ! subZipEntry.isDirectory() ) {

								final String name = extractName( subZipEntry );
								final String relativeName = extractRelativeName( subZipEntry );

								entryConsumer.accept( new ArchiveEntryImpl(
										name,
										relativeName,
										URI.create( "jar:" + archiveUrl.toExternalForm() + "!/" + relativeName ),
										buildByteBasedInputStreamAccess( name, jarInputStream )
								) );
							}

							subZipEntry = jarInputStream.getNextEntry();
						}
					}
					catch (Exception e) {
						throw new ArchiveException( "Error accessing JarFile entry [" + zipEntry.getName() + "]", e );
					}
				}
				else {
					final String name = extractName( zipEntry );
					final String relativeName = extractRelativeName( zipEntry );
					final InputStreamAccess inputStreamAccess;
					try (InputStream is = jarFile.getInputStream( zipEntry )) {
						inputStreamAccess = buildByteBasedInputStreamAccess( name, is );
					}
					catch (IOException e) {
						throw new ArchiveException(
								String.format(
										"Unable to access stream from jar file [%s] for entry [%s]",
										jarFile.getName(),
										zipEntry.getName()
								)
						);
					}

View on GitHub (pinned to fad1729dce)