5 Replies Latest reply on May 24, 2005 8:59 AM by beyarecords

    HAR deployement problem

    alban_coul

      hello!
      jboss 4.0.2
      hibernate 3.0
      MySQL 4.0.15

      I have got a strange problem:
      When I deploy my ear without har inside of it : no problem
      When I add the har, it deletes my table or the fields in my table without any actions on database via hibernate.

      hibernate-service.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
       <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
       <attribute name="DatasourceName">java:/MySqlDS</attribute>
       <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
       <attribute name="SessionFactoryName">java:/hibernate/CaveatEmptorSessionFactory</attribute>
       <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
       <attribute name="Hbm2ddlAuto">create-drop</attribute>
       <attribute name="ShowSqlEnabled">true</attribute>
       </mbean>
      </server>


      mysql-ds.xml
      <datasources>
       <local-tx-datasource>
       <jndi-name>MySqlDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/first</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>test</user-name>
       <password>test</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
       <!-- sql to call on an existing pooled connection when it is obtained from pool
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>



      employe.hbm.xml
      <?xml version="1.0"?>
      <!DOCTYPE hibernate-mapping PUBLIC
       "-//Hibernate/Hibernate Mapping DTD//EN"
       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
      
      <hibernate-mapping package="struts.hibernate">
       <class
       name="Employe"
       table="employe"
       >
       <id
       name="Id"
       type="integer"
       column="id"
       >
       <generator class="increment"/>
       </id>
      
       <property
       name="Nom"
       column="nom"
       type="string"
       not-null="true"
       length="15"
       />
       <property
       name="Prenom"
       column="prenom"
       type="string"
       not-null="true"
       length="15"
       />
      
      
       </class>
      </hibernate-mapping>


      jboss-app.xml
      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
      <jboss-app>
      <module>
      <har>struts.har</har>
      </module>
      </jboss-app>


      I am using JBossIDE with "Xdoclet Configurations" and "Packaging Configurations"

      This happens at deployement time.
      Before deployement : table is here with the fields.
      After deployement : table not here anymore.

      NO ERROR message from the output of JBoss.
      Thanks.
      Alban.

        • 1. Re: HAR deployement problem
          alban_coul

          Here is the output of JBoss.

          ===============================================================================
          .
           JBoss Bootstrap Environment
          .
           JBOSS_HOME: C:\jboss-4.0.2\bin\\..
          .
           JAVA: C:\j2sdk1.4.2_05\bin\java
          .
           JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m
          .
           CLASSPATH: C:\j2sdk1.4.2_05\lib\tools.jar;C:\jboss-4.0.2\bin\\run.jar
          .
          ===============================================================================
          .
          12:04:21,906 INFO [Server] Starting JBoss (MX MicroKernel)...
          12:04:21,906 INFO [Server] Release ID: JBoss [Zion] 4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)
          12:04:21,906 INFO [Server] Home Dir: C:\jboss-4.0.2
          12:04:21,906 INFO [Server] Home URL: file:/C:/jboss-4.0.2/
          12:04:21,906 INFO [Server] Library URL: file:/C:/jboss-4.0.2/lib/
          12:04:21,906 INFO [Server] Patch URL: null
          12:04:21,906 INFO [Server] Server Name: default
          12:04:21,906 INFO [Server] Server Home Dir: C:\jboss-4.0.2\server\default
          12:04:21,906 INFO [Server] Server Home URL: file:/C:/jboss-4.0.2/server/default/
          12:04:21,906 INFO [Server] Server Data Dir: C:\jboss-4.0.2\server\default\data
          12:04:21,906 INFO [Server] Server Temp Dir: C:\jboss-4.0.2\server\default\tmp
          12:04:21,921 INFO [Server] Server Config URL: file:/C:/jboss-4.0.2/server/default/conf/
          12:04:21,921 INFO [Server] Server Library URL: file:/C:/jboss-4.0.2/server/default/lib/
          12:04:21,921 INFO [Server] Root Deployment Filename: jboss-service.xml
          12:04:21,921 INFO [Server] Starting General Purpose Architecture (GPA)...
          12:04:22,250 INFO [ServerInfo] Java version: 1.4.2_05,Sun Microsystems Inc.
          12:04:22,250 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.4.2_05-b04,Sun Microsystems Inc.
          12:04:22,250 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
          12:04:23,078 INFO [Server] Core system initialized
          12:04:24,546 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
          12:04:24,640 INFO [WebService] Using RMI server codebase: http://XP-ALTECA2:8083/
          12:04:24,750 INFO [NamingService] Started jndi bootstrap jnpPort=1099, rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server S
          ocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
          12:04:28,343 INFO [Embedded] Catalina naming disabled
          12:04:28,703 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
          12:04:28,703 INFO [Catalina] Initialization processed in 297 ms
          12:04:28,703 INFO [StandardService] Starting service jboss.web
          12:04:28,703 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.5.9
          12:04:28,750 INFO [StandardHost] XML validation disabled
          12:04:28,781 INFO [Catalina] Server startup in 78 ms
          12:04:28,906 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=file:/C:/jboss-4.0.2/server/default/deploy/http-invoker.sar/invoker.war/
          12:04:29,171 INFO [WebappLoader] Dual registration of jndi stream handler: factory already defined
          12:04:29,765 INFO [TomcatDeployer] deploy, ctxPath=/ws4ee, warUrl=file:/C:/jboss-4.0.2/server/default/tmp/deploy/tmp15521jboss-ws4ee-exp.war/
          12:04:29,875 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=file:/C:/jboss-4.0.2/server/default/deploy/jbossweb-tomcat55.sar/ROOT.war/
          12:04:30,078 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=file:/C:/jboss-4.0.2/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpi
          l.war/
          12:04:31,656 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/C:/jboss-4.0.2/server/default/deploy/management/console-mgr.sar/web-console.
          war/
          12:04:32,578 INFO [MailService] Mail Service bound to java:/Mail
          12:04:32,984 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.2/server/default/deploy/jboss-ha-local-jdbc.ra
          r
          12:04:33,109 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.2/server/default/deploy/jboss-ha-xa-jdbc.rar
          12:04:33,218 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.2/server/default/deploy/jboss-local-jdbc.rar
          12:04:33,328 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.2/server/default/deploy/jboss-xa-jdbc.rar
          12:04:33,421 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.2/server/default/deploy/jms/jms-ra.rar
          12:04:33,500 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.2/server/default/deploy/mail-ra.rar
          12:04:34,468 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=DefaultDS,service=DataSou
          rceBinding to JNDI name 'java:DefaultDS'
          12:04:34,796 INFO [A] Bound to JNDI name: queue/A
          12:04:34,796 INFO [B] Bound to JNDI name: queue/B
          12:04:34,812 INFO [C] Bound to JNDI name: queue/C
          12:04:34,812 INFO [D] Bound to JNDI name: queue/D
          12:04:34,812 INFO [ex] Bound to JNDI name: queue/ex
          12:04:34,828 INFO [testTopic] Bound to JNDI name: topic/testTopic
          12:04:34,828 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
          12:04:34,843 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
          12:04:34,843 INFO [testQueue] Bound to JNDI name: queue/testQueue
          12:04:34,906 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.0.0:8093
          12:04:34,953 INFO [DLQ] Bound to JNDI name: queue/DLQ
          12:04:35,125 INFO [ConnectionFactoryBindingService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=JmsXA,service=Conn
          ectionFactoryBinding to JNDI name 'java:JmsXA'
          12:04:35,250 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=MySqlDS,service=DataSourc
          eBinding to JNDI name 'java:MySqlDS'
          12:04:35,281 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/C:/jboss-4.0.2/server/default/deploy/jmx-console.war/
          12:04:35,578 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
          12:04:35,703 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
          12:04:35,718 INFO [JkMain] Jk running ID=0 time=0/78 config=null
          12:04:35,734 INFO [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] Started in 13s:813ms
          12:05:00,609 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.2/server/default/deploy/FirstApp.ear
          12:05:01,031 INFO [EjbModule] Deploying FirstRemote
          12:05:01,187 INFO [Environment] Hibernate 3.0.2
          12:05:01,187 INFO [Environment] hibernate.properties not found
          12:05:01,187 INFO [Environment] using CGLIB reflection optimizer
          12:05:01,187 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
          12:05:01,296 INFO [Hibernate] Using JDBC batch size : null
          12:05:01,312 INFO [Configuration] Searching for mapping documents in jar: struts.har
          12:05:01,312 INFO [Configuration] Found mapping documents in jar: struts/hibernate/Employe.hbm.xml
          12:05:01,421 INFO [HbmBinder] Mapping class: struts.hibernate.Employe -> employe
          12:05:01,453 INFO [Configuration] processing extends queue
          12:05:01,453 INFO [Configuration] processing collection mappings
          12:05:01,453 INFO [Configuration] processing association property references
          12:05:01,453 INFO [Configuration] processing foreign key constraints
          12:05:01,546 INFO [NamingHelper] JNDI InitialContext properties:{}
          12:05:01,562 INFO [DatasourceConnectionProvider] Using datasource: java:/MySqlDS
          12:05:02,171 INFO [SettingsFactory] RDBMS: MySQL, version: 4.0.15-max-debug
          12:05:02,171 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.8 ( $Date: 2005/04/14 20:36:13 $, $Revision: 1.27
          .4.64 $ )
          12:05:02,203 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
          12:05:02,218 INFO [SettingsFactory] JDBC batch size: 15
          12:05:02,218 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
          12:05:02,218 INFO [SettingsFactory] Scrollable result sets: enabled
          12:05:02,218 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
          12:05:02,218 INFO [SettingsFactory] Aggressive release : enabled
          12:05:02,218 INFO [SettingsFactory] Maximum outer join fetch depth: 2
          12:05:02,218 INFO [SettingsFactory] Default batch fetch size: 1
          12:05:02,218 INFO [SettingsFactory] Generate SQL with comments: disabled
          12:05:02,218 INFO [SettingsFactory] Order SQL updates by primary key: disabled
          12:05:02,218 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
          12:05:02,218 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
          12:05:02,218 INFO [SettingsFactory] Query language substitutions: {}
          12:05:02,218 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JTATransactionFactory
          12:05:02,218 INFO [NamingHelper] JNDI InitialContext properties:{}
          12:05:02,218 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
          12:05:02,218 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
          12:05:02,218 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
          12:05:02,218 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
          12:05:02,218 INFO [SettingsFactory] Automatic flush during beforeCompletion(): enabled
          12:05:02,218 INFO [SettingsFactory] Automatic session close at end of transaction: enabled
          12:05:02,234 INFO [SettingsFactory] Second-level cache: enabled
          12:05:02,234 INFO [SettingsFactory] Query cache: disabled
          12:05:02,234 INFO [SettingsFactory] Cache provider: org.hibernate.cache.HashtableCacheProvider
          12:05:02,234 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
          12:05:02,234 INFO [SettingsFactory] Structured second-level cache entries: enabled
          12:05:02,234 INFO [SettingsFactory] Echoing all SQL to stdout
          12:05:02,234 INFO [SettingsFactory] Statistics: disabled
          12:05:02,234 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
          12:05:02,250 INFO [SettingsFactory] Default entity-mode: pojo
          12:05:02,390 INFO [SessionFactoryImpl] building session factory
          12:05:02,828 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
          12:05:02,843 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
          12:05:02,843 INFO [Configuration] processing extends queue
          12:05:02,843 INFO [Configuration] processing collection mappings
          12:05:02,843 INFO [Configuration] processing association property references
          12:05:02,859 INFO [Configuration] processing foreign key constraints
          12:05:02,859 INFO [Configuration] processing extends queue
          12:05:02,859 INFO [Configuration] processing collection mappings
          12:05:02,875 INFO [Configuration] processing association property references
          12:05:02,875 INFO [Configuration] processing foreign key constraints
          12:05:02,875 INFO [SchemaExport] Running hbm2ddl schema export
          12:05:02,890 INFO [SchemaExport] exporting generated schema to database
          12:05:02,890 INFO [NamingHelper] JNDI InitialContext properties:{}
          12:05:02,890 INFO [DatasourceConnectionProvider] Using datasource: java:/MySqlDS
          12:05:02,921 INFO [SchemaExport] schema export complete
          12:05:02,921 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
          12:05:02,937 INFO [Configuration] processing extends queue
          12:05:02,937 INFO [Configuration] processing collection mappings
          12:05:02,937 INFO [Configuration] processing association property references
          12:05:02,937 INFO [Configuration] processing foreign key constraints
          12:05:02,953 INFO [Configuration] processing extends queue
          12:05:02,953 INFO [Configuration] processing collection mappings
          12:05:02,953 INFO [Configuration] processing association property references
          12:05:02,953 INFO [Configuration] processing foreign key constraints
          12:05:02,968 INFO [NamingHelper] JNDI InitialContext properties:{}
          12:05:02,968 INFO [SessionFactoryImpl] Checking 0 named queries
          12:05:02,968 INFO [Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/CaveatEmptorSessionFactory]
          12:05:03,000 INFO [EJBDeployer] Deployed: file:/C:/jboss-4.0.2/server/default/tmp/deploy/tmp15568FirstApp.ear-contents/FirstEJB.jar
          12:05:03,046 INFO [TomcatDeployer] deploy, ctxPath=/first, warUrl=file:/C:/jboss-4.0.2/server/default/tmp/deploy/tmp15568FirstApp.ear-contents/FirstWeb-ex
          p.war/
          12:05:03,171 INFO [JBossCacheManager] init(): replicationGranularity_ is 0 and invaldateSessionPolicy is 2
          12:05:03,187 ERROR [JBossCacheManager] JBossCacheService to Tomcat clustering not found
          12:05:03,187 ERROR [TomcatDeployer] Failed to setup clustering, clustering disabled
          12:05:03,234 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.2/server/default/deploy/FirstApp.ear
          


          • 2. Re: HAR deployement problem
            beyarecords

            alban_coul,
            the problem lays in your hibernate-service.xml:

            create-drop

            create-drop, on JBoss startup, is creating all the tables defined in your *.hbm.xml files and then droping them. To prevent this from happening, once you have created all the tables, specify no value in your Hbm2ddlAuto attribute:



            regards

            • 3. Re: HAR deployement problem
              beyarecords

              alban_coul,
              the problem lays in your hibernate-service.xml:

              <attribute name="Hbm2ddlAuto">create-drop</attribute>
              

              create-drop, on JBoss startup, is creating all the tables defined in your *.hbm.xml files and then droping them. To prevent this from happening, once you have created all the tables, specify no value in your Hbm2ddlAuto attribute:
              <attribute name="Hbm2ddlAuto"></attribute>
              

              regards

              • 4. Re: HAR deployement problem
                alban_coul

                Thanks!!
                It works now!
                Sorry for that stupid mistake.
                Alban.

                • 5. Re: HAR deployement problem
                  beyarecords

                  Alban,
                  no need to appologise. It's a mistake I couldn't figure out myself for a long while when I first started ;-)