2 Replies Latest reply on Feb 2, 2009 7:26 AM by agusmag

    EAR Deployment failed with JBoss 4.2.3 and Mysql

    agusmag

      Hi there!

      We are running a JBoss 4.2.3.GA, MySQL version 5.0.67-0ubuntu6, Ubuntu server 8 and Java 1.6.0.

      We have developed a Seam 2.1.1 project on Windows by using Eclipse Europa and the JBossTools and everything works fine, since we are able to use Eclipse to publish to JBoss 4.2.3 and to run the app.

      Now we are trying to publish the web application on Linux by copying the deployed ear directory and the datasouce from the Jboss running on Windows (this approach works fine on Windows).
      Unfortunately the deployment fails as you can see below.

      The same deployment works in Windows XP with the same configuration.

      I've tested the MySQL datasource by using a jsp which looks up at the datasource on Linux and I'am able to read the database
      metadata. So I' don't know why the deployment fails.


      On startup the server says that:


      15:12:58,220 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      15:12:58,285 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=soccorsoDatasource' to JNDI name 'java:soccorsoDatasource'
      
      ...
      
      15:12:59,749 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.entity.PersistenceUnitDeployment
      15:12:59,752 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso with dependencies:
      15:12:59,752 INFO [JmxKernelAbstraction] jboss.jca:name=soccorsoDatasource,service=DataSourceBinding
      15:12:59,753 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
      
      ...
      
      15:13:00,164 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Contact
      15:13:00,165 INFO [Ejb3Configuration] found EJB3 @Embeddable: org.hcilab.soccorso.entity.RelativeId
      15:13:00,171 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Mentalfunction
      15:13:00,178 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Pain
      15:13:00,179 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Systemuser
      15:13:00,180 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Relative
      15:13:00,181 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Diagnosis
      15:13:00,184 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.User
      15:13:00,186 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Bodyfunction
      15:13:00,188 INFO [Ejb3Configuration] found EJB3 @Embeddable: org.hcilab.soccorso.entity.DiagnosisId
      15:13:00,190 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Joint
      15:13:00,193 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Involuntary
      15:13:00,200 INFO [Ejb3Configuration] found EJB3 Entity bean: org.hcilab.soccorso.entity.Motor
      15:13:00,262 INFO [Configuration] Reading mappings from resource : META-INF/orm.xml
      15:13:00,264 INFO [Ejb3Configuration] [PersistenceUnit: soccorso] no META-INF/orm.xml found
      15:13:00,313 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Contact
      15:13:00,347 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Contact on table contact
      15:13:00,415 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Mentalfunction
      15:13:00,415 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Mentalfunction on table mentalfunction
      15:13:00,432 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Pain
      15:13:00,433 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Pain on table pain
      15:13:00,463 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Systemuser
      15:13:00,463 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Systemuser on table systemuser
      15:13:00,470 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Relative
      15:13:00,470 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Relative on table relative
      15:13:00,479 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Diagnosis
      15:13:00,479 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Diagnosis on table diagnosis
      15:13:00,483 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.User
      15:13:00,483 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.User on table user
      15:13:00,517 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Bodyfunction
      15:13:00,517 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Bodyfunction on table bodyfunction
      15:13:00,526 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Joint
      15:13:00,526 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Joint on table joint
      15:13:00,536 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Involuntary
      15:13:00,536 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Involuntary on table involuntary
      15:13:00,550 INFO [AnnotationBinder] Binding entity from annotated class: org.hcilab.soccorso.entity.Motor
      15:13:00,550 INFO [EntityBinder] Bind entity org.hcilab.soccorso.entity.Motor on table motor
      15:13:00,625 INFO [CollectionBinder] Mapping collection: org.hcilab.soccorso.entity.User.contactsForSsn -> contact
      15:13:00,626 INFO [CollectionBinder] Mapping collection: org.hcilab.soccorso.entity.User.diagnoses -> diagnosis
      15:13:00,628 WARN [ServiceController] Problem starting service persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
      java.lang.NullPointerException
       at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)
       at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
       at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
       at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
      
      .....
      
      --- MBeans waiting for other MBeans ---
      ObjectName: persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
       State: FAILED
       Reason: java.lang.NullPointerException
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=soccorsoDatasource
       Depends On Me:
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=GenerateDataAction,service=EJB3
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=MedicalFieldsAction,service=EJB3
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=UserListAction,service=EJB3
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=AuthenticatorAction,service=EJB3
      
      ObjectName: jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=GenerateDataAction,service=EJB3
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
      
      ObjectName: jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=MedicalFieldsAction,service=EJB3
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
      
      ObjectName: jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=UserListAction,service=EJB3
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
      
      ObjectName: jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=AuthenticatorAction,service=EJB3
       State: NOTYETINSTALLED
       I Depend On:
       persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
      
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: persistence.units:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,unitName=soccorso
       State: FAILED
       Reason: java.lang.NullPointerException
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=soccorsoDatasource
       Depends On Me:
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=GenerateDataAction,service=EJB3
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=MedicalFieldsAction,service=EJB3
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=UserListAction,service=EJB3
       jboss.j2ee:ear=soccorso-ear.ear,jar=soccorso-ejb.jar,name=AuthenticatorAction,service=EJB3
      







      this is the soccorso-ds.xml datasource
      <?xml version="1.0" encoding="UTF-8"?>
      
      <!DOCTYPE datasources
       PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
      
      <datasources>
      
       <local-tx-datasource>
       <jndi-name>soccorsoDatasource</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/soccorso</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>root</user-name>
       <password>di*****e</password>
      <!--
       <exception-sorter-class-name>
       org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
       </exception-sorter-class-name>
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
      -->
       </local-tx-datasource>
      
      </datasources>
      



      persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- Persistence deployment descriptor for dev profile -->
      <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="soccorso">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/soccorsoDatasource</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
       <property name="hibernate.hbm2ddl.auto" value="update"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="hibernate.format_sql" value="true"/>
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/soccorsoEntityManagerFactory"/>
       </properties>
       </persistence-unit>
      
      </persistence>
      





      application.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
       version="5">
      
       <display-name>soccorso-ear</display-name>
      
      
      <!-- <module><java>soccorso-ds.xml</java></module>
      -->
      
       <module>
       <web>
       <web-uri>soccorso.war</web-uri>
       <context-root>/soccorso</context-root>
       </web>
       </module>
      
       <module>
       <ejb>soccorso-ejb.jar</ejb>
       </module>
      
      </application>
      
      




      ejb-jar.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
       version="3.0">
      
       <interceptors>
       <interceptor>
       <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
       </interceptor>
       </interceptors>
      
       <assembly-descriptor>
       <interceptor-binding>
       <ejb-name>*</ejb-name>
       <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
       </interceptor-binding>
       </assembly-descriptor>
      
      </ejb-jar>
      




      the Ear is an exploded directory with the following organization.
      
       |-
       |-META-INF (application.xml jboss-app.xml)
       |-soccorso-ejb.jar
       |---META-INF (ejb-jar.xml persistence.xml ...)
       |---org
       |-----hcilab
       |-------soccorso
       |---------action
       |---------entity
       |---------session
       |---------util
       |---------webservice
       |-soccorso.war
       |---img
       |---js
       |---layout
       |---META-INF
       |---stylesheet
       |---WEB-INF
       |-----classes
       |-------META-INF
       |-----lib
      
      







      Do you have any ideas why the deployment fails? I've also tried to hot deploy the datasource or the ear with no luck: the errior is always the same...NullPointer






        • 1. Re: EAR Deployment failed with JBoss 4.2.3 and Mysql
          jaikiran

           

          java.lang.NullPointerException
          at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)


          Looks like a bug in Hibernate which was fixed http://forum.hibernate.org/viewtopic.php?t=970823

          But that doesn't explain why your application works on Windows and not on Linux. Are you sure there are no other server configuration changes between these two setups. Like jar files, classpath etc...

          • 2. Re: EAR Deployment failed with JBoss 4.2.3 and Mysql
            agusmag

             

            "jaikiran" wrote:
            java.lang.NullPointerException
            at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)


            Looks like a bug in Hibernate which was fixed http://forum.hibernate.org/viewtopic.php?t=970823

            But that doesn't explain why your application works on Windows and not on Linux. Are you sure there are no other server configuration changes between these two setups. Like jar files, classpath etc...



            Yes the two configurations are the same (zipped and unzipped the whole jboss directory including the deploy directory with the web application).

            With your suggestion and the information I've found in your blog the bug seems to be resolved now. For anyone facing the same problem, I've done the following:

            1) I' have created a "lib" directory in the web application ear directory
            2) I put in the lib directory the following jar files (according to the hibernate compatibility matrix):

            hibernate (3.2.6 GA)
            hibernate-annotations (3.3.0 GA)
            hibernate-commons-annotations (3.3.0 GA) (contained in the lib directory of hibernate-annotations)
            hibernate-entitymanager (3.3.0 GA)
            hibernate-search (3.0.0 GA)
            hibernate-validator (3.0.0 GA)
            lucene-core-2.4.0 (2.4.0)


            Thanks for your help.

            A.


            P.S.: it's incredible that the bug affects only the Linux system....