4 Replies Latest reply on Apr 12, 2010 6:09 AM by Flemming Harms

    hbm file is not picked up by the scanner

    Flemming Harms Novice

      I'm having a bit of a puzzle with JBoss AS 5.1.0.GA and Hibernate. I have 3 jar files with contains persistence.xml file and hbm files located in META-INF\hibernatemapping and all packed in the root of the ear file, but there is one jar file where the hbm file is not scanned and I can't figure out what is wrong or how to investigate this.

       

      I have two other jar files which is working fine and the hbm files is detected and loaded.

       

      Any idea?

       

      myjarfile.jar:
           com\
                apc\
                     config\
                          settings\
                               server\
                                    persistence\Setting.class
           META-INF\
                MANIFEST.MF
                     hibernatemapping\settings.hbm.xml
      

       

      <?xml version="1.0"?>
      
      <!DOCTYPE hibernate-mapping PUBLIC
      
              "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      
              "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
      
      <hibernate-mapping>
      
          <class name="com.apc.config.settings.server.persistence.Setting"
      
              table="settings" lazy="false" >
      
                  <id name="key" column="key" access="field" type="string"/>
      
                <property  name="value" column="value" type="text" />
      
          </class>
      
      </hibernate-mapping>
      
      

       

       

      Persistence.xml:


       <?xml version="1.0" encoding="UTF-8"?>
      
       <persistence xmlns="http://java.sun.com/xml/ns/persistence"
      
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
                    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
      
                    version="1.0">
      
           <persistence-unit name="settingDataSource-server" transaction-type="JTA">
      
               <provider>org.hibernate.ejb.HibernatePersistence</provider>
      
               <jta-data-source>java:/jdbc/PostgresDS</jta-data-source>   
      
               <properties>
      
                   <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
      
                   <property name="hibernate.connection.release_mode" value="auto" />
      
                   <property name="hibernate.max_fetch_depth" value="2" />
      
                   <property name="hibernate.hbm2ddl.auto" value="update" />
      
                   <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
      
                   <property name="org.hibernate.dialect.PostgreSQLDialect" value="update"/>
      
                   <property name="hibernate.transaction.manager_lookup_class" value ="org.hibernate.transaction.JBossTransactionManagerLookup" />
      
                   <property name="hibernate.show_sql" value="false" /> 
      
               </properties>
      
           </persistence-unit>
      
       </persistence>
      
      
      

       


       Here is the log result :
      
      
      13:19:49,636 INFO  [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
       13:19:49,637 DEBUG [Ejb3Configuration] Processing PersistenceUnitInfo [
      
      
           name: settingDataSource-server
      
      
           persistence provider classname: org.hibernate.ejb.HibernatePersistence
      
      
           classloader: BaseClassLoader@50725fe7{vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/ISXO_Core.ear/}
      
      
           Temporary classloader: null
      
      
           excludeUnlistedClasses: false
      
      
           JTA datasource: org.jboss.resource.adapter.jdbc.WrapperDataSource@31960793
      
      
           Non JTA datasource: null
      
      
           Transaction type: JTA
      
      
           PU root URL: vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar/
      
      
           Jar files URLs []
      
      
           Managed classes names []
      
      
           Mapping files names []
      
      
           Properties [
      
      
               hibernate.connection.driver_class: org.postgresql.Driver
      
      
               hibernate.jndi.java.naming.factory.url.pkgs: org.jboss.naming:org.jnp.interfaces
      
      
               hibernate.cache.provider_class: org.hibernate.cache.HashtableCacheProvider
      
      
               hibernate.transaction.manager_lookup_class: org.hibernate.transaction.JBossTransactionManagerLookup
      
      
               hibernate.jndi.java.naming.factory.initial: org.jnp.interfaces.NamingContextFactory
      
      
               hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
      
      
               hibernate.max_fetch_depth: 2
      
      
               hibernate.jacc.ctx.id: com.apc.config.settings.server-0.0.1-SNAPSHOT.jar
      
      
               org.hibernate.dialect.PostgreSQLDialect: update
      
      
               hibernate.session_factory_name: persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
               hibernate.cache.region_prefix: persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
               hibernate.hbm2ddl.auto: update
      
      
               hibernate.bytecode.use_reflection_optimizer: false
      
      
               hibernate.show_sql: false
      
      
               hibernate.bytecode.provider: javassist
      
      
               hibernate.connection.release_mode: auto]
      
      
       13:19:49,637 DEBUG [Ejb3Configuration] Detect class: true; detect hbm: true
      
      
       13:19:49,637 DEBUG [Ejb3Configuration] Detect class: true; detect hbm: true
      
      
       13:19:49,637 DEBUG [AbstractJarVisitor] Searching mapped entities in jar/par: vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar/
      
      
       13:19:49,637 WARN  [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
      
      
       13:19:49,638 DEBUG [AnnotationConfiguration] Execute first pass mapping processing
      
      
       13:19:49,638 DEBUG [AnnotationConfiguration] Process hbm files
      
      
       13:19:49,638 DEBUG [AnnotationConfiguration] Process annotated classes
      
      
       13:19:49,638 DEBUG [AnnotationConfiguration] processing fk mappings (*ToOne and JoinedSubclass)
      
      
       13:19:49,638 DEBUG [Configuration] processing extends queue
      
      
       13:19:49,638 DEBUG [Configuration] processing collection mappings
      
      
       13:19:49,638 DEBUG [Configuration] processing native query and ResultSetMapping mappings
      
      
       13:19:49,638 DEBUG [Configuration] processing association property references
      
      
       13:19:49,638 DEBUG [Configuration] processing foreign key constraints
      
      
       13:19:49,642 DEBUG [NamingHelper] No JNDI name configured for binding Ejb3Configuration
      
      
       13:19:49,643 DEBUG [HibernateSearchEventListenerRegister] Search not present in classpath, ignoring event listener registration.
      
      
       13:19:49,643 INFO  [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
      
      
       13:19:49,644 DEBUG [Configuration] Preparing to build session factory with filters : {}
      
      
       13:19:49,644 DEBUG [AnnotationConfiguration] Execute first pass mapping processing
      
      
       13:19:49,644 DEBUG [AnnotationConfiguration] Process hbm files
      
      
       13:19:49,644 DEBUG [AnnotationConfiguration] Process annotated classes
      
      
       13:19:49,644 DEBUG [AnnotationConfiguration] processing fk mappings (*ToOne and JoinedSubclass)
      
      
       13:19:49,644 DEBUG [Configuration] processing extends queue
      
      
       13:19:49,644 DEBUG [Configuration] processing collection mappings
      
      
       13:19:49,644 DEBUG [Configuration] processing native query and ResultSetMapping mappings
      
      
       13:19:49,644 DEBUG [Configuration] processing association property references
      
      
       13:19:49,644 DEBUG [Configuration] processing foreign key constraints
      
      
       13:19:49,644 INFO  [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      
      
       13:19:49,645 INFO  [InjectedDataSourceConnectionProvider] Using provided datasource
      
      
       13:19:49,645 INFO  [SettingsFactory] RDBMS: PostgreSQL, version: 8.4.2
      
      
       13:19:49,645 INFO  [SettingsFactory] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL (build 407)
      
      
       13:19:49,645 INFO  [Dialect] Using dialect: org.hibernate.dialect.PostgreSQLDialect
      
      
       13:19:49,645 INFO  [SettingsFactory] Automatic flush during beforeCompletion(): disabled
      
      
       13:19:49,645 INFO  [SettingsFactory] Automatic session close at end of transaction: disabled
      
      
       13:19:49,645 INFO  [SettingsFactory] JDBC batch size: 15
      
      
       13:19:49,645 INFO  [SettingsFactory] JDBC batch updates for versioned data: disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Scrollable result sets: enabled
      
      
       13:19:49,646 DEBUG [SettingsFactory] Wrap result sets: disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Connection release mode: auto
      
      
       13:19:49,646 INFO  [SettingsFactory] Maximum outer join fetch depth: 2
      
      
       13:19:49,646 INFO  [SettingsFactory] Default batch fetch size: 1
      
      
       13:19:49,646 INFO  [SettingsFactory] Generate SQL with comments: disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Order SQL updates by primary key: disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Order SQL inserts for batching: disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
      
      
       13:19:49,646 INFO  [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
      
      
       13:19:49,646 INFO  [SettingsFactory] Query language substitutions: {}
      
      
       13:19:49,646 INFO  [SettingsFactory] JPA-QL strict compliance: enabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Second-level cache: enabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Query cache: disabled
      
      
       13:19:49,646 INFO  [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
      
      
       13:19:49,646 INFO  [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider
      
      
       13:19:49,647 INFO  [SettingsFactory] Optimize cache for minimal puts: disabled
      
      
       13:19:49,647 INFO  [SettingsFactory] Cache region prefix: persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
       13:19:49,647 INFO  [SettingsFactory] Structured second-level cache entries: disabled
      
      
       13:19:49,647 INFO  [SettingsFactory] Statistics: disabled
      
      
       13:19:49,647 INFO  [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
      
      
       13:19:49,647 INFO  [SettingsFactory] Default entity-mode: pojo
      
      
       13:19:49,647 INFO  [SettingsFactory] Named query checking : enabled
      
      
       13:19:49,651 INFO  [SessionFactoryImpl] building session factory
      
      
       13:19:49,651 DEBUG [SessionFactoryImpl] Session factory constructed with filter configurations : {}
      
      
       13:19:49,651 DEBUG [SessionFactoryImpl] instantiating session factory with properties: {}
      
      
       13:19:49,651 DEBUG [SessionFactoryObjectFactory] registered: ff80808127aec5680127aecc7e93000b (persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server)
      
      
       13:19:49,651 INFO  [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
       13:19:49,651 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      
      
       13:19:49,652 DEBUG [SessionFactoryImpl] Returning a Reference to the SessionFactory
      
      
       13:19:49,652 DEBUG [NamingHelper] Bound name: persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
       13:19:49,652 INFO  [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=ISXO_Core.ear/com.apc.config.settings.server-0.0.1-SNAPSHOT.jar#settingDataSource-server
      
      
       13:19:49,652 WARN  [SessionFactoryObjectFactory] InitialContext did not implement EventContext
      
      
       13:19:49,652 DEBUG [SessionFactoryImpl] instantiated session factory
      
      
       13:19:49,652 INFO  [SchemaUpdate] Running hbm2ddl schema update
      
      
       13:19:49,652 INFO  [SchemaUpdate] fetching database metadata
      
      
       13:19:49,655 INFO  [SchemaUpdate] updating schema
      
      
       13:19:49,655 DEBUG [AnnotationConfiguration] Execute first pass mapping processing
      
      
       13:19:49,655 DEBUG [AnnotationConfiguration] Process hbm files
      
      
       13:19:49,655 DEBUG [AnnotationConfiguration] Process annotated classes
      
      
       13:19:49,655 DEBUG [AnnotationConfiguration] processing fk mappings (*ToOne and JoinedSubclass)
      
      
       13:19:49,655 DEBUG [Configuration] processing extends queue
      
      
       13:19:49,655 DEBUG [Configuration] processing collection mappings
      
      
       13:19:49,655 DEBUG [Configuration] processing native query and ResultSetMapping mappings
      
      
       13:19:49,655 DEBUG [Configuration] processing association property references
      
      
       13:19:49,656 DEBUG [Configuration] processing foreign key constraints
      
      
       13:19:49,656 INFO  [SchemaUpdate] schema update complete
      

       

      Thanks

      /Flemming