0 Replies Latest reply on Mar 12, 2014 11:46 AM by Alex Rankin

    Jboss 5.1.2 EAP warning with vfszip and war inside ear

    Alex Rankin Newbie

      Hi all,

       

      I'm having an issue with running an ear on Jboss 5.1.2 EAP. I'm deploying an ear file, and within that ear is a war. I'm using spring-data (1.4.3.RELEASE), along with Hibernate (4.2.1.Final) as the JPA provider. This means that I don't have a persistence.xml, since I'm using the packagesToScan property on my entity manager factory (I'll show this below).

       

      Upon starting the server, I receive the following warning:

       

      15:06:21,817 INFO  [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [
              name: default
              ...]
      15:06:21,830 WARN  [FileZippedJarVisitor] HHH015010: Unable to find file (ignored): vfszip:/C:/JBoss51/jboss-eap-5.1/jboss-as/server/standard/deploy/my-ear.ear/my-api.war/WEB-INF/classes/
      java.io.FileNotFoundException: C:\JBoss51\jboss-eap-5.1\jboss-as\server\standard\deploy\my-ear.ear\my-api.war\WEB-INF\classes (The system cannot find the path specified)
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java:127)
              at java.util.jar.JarFile.<init>(JarFile.java:135)
              at java.util.jar.JarFile.<init>(JarFile.java:72)
              at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:70)
              at org.hibernate.ejb.packaging.AbstractJarVisitor.getMatchingEntries(AbstractJarVisitor.java:149)
              at org.hibernate.ejb.packaging.NativeScanner.getFilesInJar(NativeScanner.java:192)
              at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:505)
              at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:860)
              at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:605)
              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:75)
              at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:287)
      

       

      If we expand the PersistenceUnitInfo, we can see the following:

       

      12:09:00,340 INFO  [STDOUT] 12:09:00,340 DEBUG LogHelper:117 - PersistenceUnitInfo [
              name: default
              persistence provider classname: null
              classloader: org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@1286e6b
              excludeUnlistedClasses: true
              JTA datasource: null
              Non JTA datasource: org.jboss.resource.adapter.jdbc.WrapperDataSource@17e9678
              Transaction type: RESOURCE_LOCAL
              PU root URL: vfszip:/C:/JBoss51/jboss-eap-5.1/jboss-as/server/standard/deploy/my-ear.ear/my-api.war/WEB-INF/classes/
              Shared Cache Mode: UNSPECIFIED
              Validation Mode: AUTO
              Jar files URLs []
              Managed classes names [
                      com.example.domain.Class1
                      com.example.domain.Class2
                      com.example.domain.Class3
                      ...]
              Mapping files names []
              Properties []
      

       

      So the root URL of the persistence unit is correct, but cannot be accessed while starting the server. I'm using maven to build everything, and the resulting application.xml is as follows:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE application PUBLIC
              "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
              "http://java.sun.com/dtd/application_1_3.dtd">
      <application>
        <display-name>MY EAR</display-name>
        <description>Description.</description>
        <module>
          <web>
            <web-uri>my-api.war</web-uri>
            <context-root>/my-api</context-root>
          </web>
        </module>
      </application>
      

       

      Below is a snippet from my spring config:

       

              <!-- Entity Manager Factory for JPA -->
              <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                      <property name="dataSource" ref="datasource"/>
                      <property name="packagesToScan" value="com.example.domain"/>
                      <property name="jpaVendorAdapter">
                              <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
                      </property>
                      <property name="jpaPropertyMap">
                              <props>
                                      <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                                      <prop key="hibernate.jdbc.fetch_size">200</prop>
                                      <prop key="hibernate.show_sql">true</prop>
                              </props>
                      </property>
              </bean>
      
      
              <!-- Create a transaction manager, linking it to Hibernate session factory -->
              <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                      <property name="entityManagerFactory" ref="entityManagerFactory"/>
              </bean>
      

       

      The application deploys perfectly as just a war, or as an exploded ear containing an exploded war. I believe that these use the vfsmemory protocol though. The key problem just seems to be seeing inside the war from the ear.

       

      I've tried various solutions, but haven't had any joy yet - things like different jboss-classloading.xml configurations (and jboss-web.xml class-loading configurations), defining persistence unit managers, etc. I've found two workarounds to the issue, which are:

       

      1) Define a custom implementation of the org.hibernate.ejb.packaging.Scanner interface. This overrides the getFilesInJar() method and returns an empty set.

      2) Define a persistence unit manager, and override the persistence unit root URL to a blank folder.

       

      Obviously neither is an ideal solution, and while this is just a warning (the application still works), I'd like to find out what exactly I'm missing. Any suggestions are more than welcome, and I can provide additional information if required.

       

      Thanks.