<p>I have a docker image which is been deployed into kubernetes.</p>

<p>The docker file is as follows.</p>

<pre><code>FROM alpine/jdk1.8:latest
RUN mkdir -p /opt/test/app
COPY app.war /opt/test/app/app.war

CMD java -jar /opt/test/app/app.war
</code></pre>

<p>This application uses hibernate and getting the below error when trying to load jar file for connection.</p>

<pre><code>loggerName="org.hibernate.orm.url" threadName="main" txnId="" HHH10000002: File or directory named by URL [file:/opt/test/app/app.war!/WEB-INF/classes] could not be found.  URL will be ignored
java.io.FileNotFoundException: /opt/test/app/app.war!/WEB-INF/classes (No such file or directory)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:225)
    at java.util.zip.ZipFile.&lt;init&gt;(ZipFile.java:155)
    at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:166)
    at java.util.jar.JarFile.&lt;init&gt;(JarFile.java:103)
    at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.resolveJarFileReference(JarFileBasedArchiveDescriptor.java:165)
    at org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:51)
    at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:47)
    at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:75)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:98)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:199)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34)
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165)
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:114)
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:71)
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
</code></pre>

<p>Is there any permission to be given in docker file or in kubernetes deployment yaml file?</p>

<p>Hibernate config,</p>

<pre><code>Map&lt;String, String&gt; Props = new HashMap&lt;String, String&gt;();
        conProps.put("javax.persistence.jdbc.url", "JDBC_URL");
        conProps.put("javax.persistence.jdbc.password", "PASSWORD");
        conProps.put("javax.persistence.jdbc.user", "USER");
        conProps.put("oracle.net.ssl_cipher_suites","CIPHER");
        conProps.put("javax.persistence.jdbc.driver", "oracle.jdbc.OracleDriver");

         Persistence.createEntityManagerFactory("appjdbc", conProps);
</code></pre>

<p>I checked the hibernate-core.jar and the below code gets executed.
Not sure, if it is supposed to return JarProtocolArchiveDescriptor but returns JarFileBasedArchiveDescriptor.</p>

<pre><code>public ArchiveDescriptor buildArchiveDescriptor(URL url, String entry) {
        final String protocol = url.getProtocol();
        if ( "jar".equals( protocol ) ) {
            return new JarProtocolArchiveDescriptor( this, url, entry );
        }
        else if ( StringHelper.isEmpty( protocol )
                || "file".equals( protocol )
                || "vfszip".equals( protocol )
                || "vfsfile".equals( protocol ) ) {
            final File file = new File( extractLocalFilePath( url ) );
            if ( file.isDirectory() ) {
                return new ExplodedArchiveDescriptor( this, url, entry );
            }
            else {
                return new JarFileBasedArchiveDescriptor( this, url, entry );
            }
        }
        else {
            //let's assume the url can return the jar as a zip stream
            return new JarInputStreamBasedArchiveDescriptor( this, url, entry );
        }
    }
</code></pre>

user1578872
<blockquote>
  <p>loggerName="org.hibernate.orm.url" threadName="main" txnId="" HHH10000002: File or directory named by URL [file:/opt/test/app/app.war!/WEB-INF/classes] could not be found.  URL will be ignored</p>
</blockquote>

<p>No, it's not a permission denied, it's using an incorrect URL scheme. <code>file://thing</code> is fine, but using the "bang" syntax requires prefixing the URL with <code>jar:</code>, like so:</p>

<pre><code>jar:file:///opt/test/app/app.war!/WEB-INF/classes
</code></pre>

<p>Without more context I can't say whether that's a hibernate bug or a your-configuration bug, but I can say with high confidence that the error message is exactly correct: there is no such directory as <code>app.war!</code></p>
