1 Reply Latest reply on Apr 4, 2011 3:29 AM by wdfink Branched from an earlier discussion.

    Changing DefaultDS in JBoss AS6

    sanfran0201

      Hi Ales,

       

      I am new to hibernate and mysql.

       

      I am having the same problem. My setup is:

      JBoss AS6.0.0.Final

      MySQL 5.5.9

      mysql Java connector 5.1.15

       

      To answer your earlier questions,

      1. Yes, JBoss server complains about the same error even if my ear is not there. The only way to remove the error is if I delete the mysql-ds.xml file.

      2. The only change I did to the JBoss folder is (a) added the connector; (b) deleted the hypersonic ds file, and (c) added mysql-ds.xml

       

      Below is the persistence.xml. It is the only configuration file I have (other than web.xml and application.xml) since orm.xml and hibernate.cfg.xml are both optional if I place all the hibernated related properties inside persistence.xml. This is how I understood it from the configuration guide.

       

      <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_2_0.xsd"

                   version="2.0">

          <persistence-unit name="ejb3-persistence-unit" transaction-type="JTA">

              <jta-data-source>java:/MySQLDB</jta-data-source>

              <class>com.hibernateexamples.bean.UserBean</class>

              <properties>

                  <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>

                  <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/HRIS"/>

                  <property name="hibernate.connection.username" value="root"/>

                  <property name="hibernate.connection.password" value="root"/>

                  <!-- JDBC connection pool (use the built-in) -->

                  <property name="hibernate.connection.pool_size" value="1"/>

                  <!-- SQL dialect -->

                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

                  <!-- Enable Hibernate's automatic session context management -->

                  <property name="hibernate.current_session_context_class" value="thread"/>

                  <!-- Disable the second-level cache -->

                  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>

                  <!-- Echo all executed SQL to stdout -->

                  <property name="hibernate.use_sql_comments" value="true"/>

                  <property name="hibernate.show_sql" value="true"/>

                  <!-- validate the database schema on startup -->

                  <property name="hibernate.transaction.auto_close_session" value="true"/>

                  <property name="hibernate.hbm2ddl.auto" value="validate"/>

              </properties>

          </persistence-unit>

      </persistence>

       

      and mysql-ds.xml:

      $ cat mysql-ds.xml

      <datasources>

          <local-tx-datasource>

              <!-- This connection pool will be bound into JNDI with the name

                   "java:/MySQLDB" -->

              <jndi-name>MySQLDB</jndi-name>

              <connection-url>jdbc:mysql://localhost:3306/HRIS</connection-url>

              <driver-class>com.mysql.jdbc.Driver</driver-class>

              <user-name>root</user-name>

              <password>root</password>

              <min-pool-size>5</min-pool-size>

              <!-- Don't set this any higher than max_connections on your

               MySQL server, usually this should be a 10 or a few 10's

               of connections, not hundreds or thousands -->

              <max-pool-size>20</max-pool-size>

              <!-- Don't allow connections to hang out idle too long,

               never longer than what wait_timeout is set to on the

               server...A few minutes is usually okay here,

               it depends on your application

               and how much spikey load it will see -->

              <idle-timeout-minutes>5</idle-timeout-minutes>

              <!-- If you're using Connector/J 3.1.8 or newer, you can use

                   our implementation of these to increase the robustness

                   of the connection pool. -->

              <exception-sorter-class-name>

                  com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter

              </exception-sorter-class-name>

              <valid-connection-checker-class-name>

                  com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker

              </valid-connection-checker-class-name>

          </local-tx-datasource>

      </datasources>

       

       

      And the log:

       

      16:32:53,642 INFO  [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver

      16:32:53,681 INFO  [TableMetadata] table found: HRIS.users

      16:32:53,682 INFO  [TableMetadata] columns: [username, birthdate, userid, lastname, firstname]

      16:32:53,692 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}

      16:32:53,871 INFO  [service] Removing bootstrap log handlers

      16:32:53,969 ERROR [ProfileServiceBootstrap] Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

       

      DEPLOYMENTS MISSING DEPENDENCIES:

        Deployment "MK2TimerServiceFactory" is missing the following dependencies:

          Dependency "persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb" (should be in state "Installed", but is actually in state "Configured")

        Deployment "jboss-switchboard:appName=Simple,module=Simple-web" is missing the following dependencies:

          Dependency "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")

        Deployment "jboss.ejb:persistencePolicy=database,service=EJBTimerService" is missing the following dependencies:

          Dependency "jboss.jdbc:datasource=DefaultDS,service=metadata" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jdbc:datasource=DefaultDS,service=metadata' **")

          Dependency "jboss.jca:name=DefaultDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=DefaultDS,service=DataSourceBinding' **")

        Deployment "jboss.ejb:service=EJBTimerService" is missing the following dependencies:

          Dependency "jboss.ejb:persistencePolicy=database,service=EJBTimerService" (should be in state "Create", but is actually in state "Configured")

        Deployment "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" is missing the following dependencies:

          Dependency "<UNKNOWN jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **")

        Deployment "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3_endpoint" is missing the following dependencies:

          Dependency "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")

        Deployment "jboss.web.deployment:war=/ejb3" is missing the following dependencies:

          Dependency "jboss-switchboard:appName=Simple,module=Simple-web" (should be in state "Installed", but is actually in state "Deploy")

        Deployment "jboss:service=KeyGeneratorFactory,type=HiLo" is missing the following dependencies:

          Dependency "jboss.jca:name=DefaultDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=DefaultDS,service=DataSourceBinding' **")

        Deployment "persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb" is missing the following dependencies:

          Dependency "jboss.jca:name=DefaultDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=DefaultDS,service=DataSourceBinding' **")

       

      DEPLOYMENTS IN ERROR:

        Deployment "jboss.jca:name=DefaultDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=DefaultDS,service=DataSourceBinding' **

        Deployment "jboss.jdbc:datasource=DefaultDS,service=metadata" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jdbc:datasource=DefaultDS,service=metadata' **

        Deployment "<UNKNOWN jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **

       

          at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]

          at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]

          at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]

          at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]

          at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]

          at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]

          at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

          at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

          at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]

       

      16:32:53,988 INFO  [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080

      16:32:53,991 INFO  [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009

      16:32:53,991 INFO  [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.Final "Neo"] Started in 27s:301ms

       

       

      I did try the last reply, commenting out elements in jpa-deployers-jboss-beans.xml. However, the problem still remained. Interesting though, the difference before and after is that after I removed the elements, these logs didn't appear:

       

      16:32:53,681 INFO  [TableMetadata] table found: HRIS.users

      16:32:53,682 INFO  [TableMetadata] columns: [username, birthdate, userid, lastname, firstname]

       

      Which lead me to believe that something worse happened w/o those lines since validation didn't take place.

       

      Also, I didn't see any errors preceding this error contrary to what the error is saying "SEE PREVIOUS ERRORS FOR DETAILS".

       

      This is what I suspect and please correct me if I'm wrong. Hibernate is expecting certain tables to have been already created in the schema, tables have something to do with MK2Timer (no idea what this is) and other sorts. However, I've searched multiple guides for such setup instructions to no avail.

       

      Any help is greatly appreciated. Thank you

      - Mike

        • 1. Changing DefaultDS in JBoss AS6
          wdfink

          The DefaultDS is used by other components, if you delete it you have to change (or remove) e.g. the ejb-timer service.

           

          To get your app running you should stay for the moment with the HS and add your mysql-ds.xml

          Your persistence.xml should not include any connection informations, see excerpt of p-unit element:

           

              <persistence-unit name="ejb3-persistence-unit" transaction-type="JTA">

                  <jta-data-source>java:/MySQLDB</jta-data-source>

                  <class>com.hibernateexamples.bean.UserBean</class>

                  <properties>

                      <!-- SQL dialect -->

                      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

                      <!-- Echo all executed SQL to stdout -->

                      <property name="hibernate.use_sql_comments" value="true"/>

                      <property name="hibernate.show_sql" value="true"/>

                      <!-- validate the database schema on startup -->

                      <property name="hibernate.hbm2ddl.auto" value="validate"/>

                  </properties>

              </persistence-unit>