11 Replies Latest reply on Sep 3, 2009 11:04 AM by emeuwese

    Multiple data sources when using MySQL

      I got this piece of advice in response to a question I asked in another thread: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154018 It seemed to warrant its own discussion...

      "PeterJ" wrote:
      Well, one best practice is to definitely not use DefaultDS for your apps. Leave the JBoss AS services with DefaultDS (though you should use a database other than Hypersonic for it), and each of your apps should use their own data sources, unless the apps are accessing the same data in which case they would want to use the same datasource. Actually, if the two apps are accessing the same data you probably really want one set of EJBs accessing the database with two web apps using that one set of EJBs.


      I spent the afternoon working on this, and apparently it is not common with MySQL as the database as there is very little information to be found on how to configure JBoss.

      I started by creating a second schema (database) in MySQL to house the JBoss infrastructure tables (both are in the same server instance localhost:3306).

      The newbie approach (which is where I started) was to use the mysql-ds.xml file found in the documents/examples/jca directory and replicate the datasource XML, rename the copy, update the URL, etc. to get my second data source. This approach appeared to work until I loaded my app and tried to register a timer which failed with a very nice stack trace. After some searching, I found out that it failed because there are two local-tx data sources, which doesn't work since JBoss is attempting to use a 2PC. The timer was using one 1PC source, while my beans were using a different 1PC source.

      The next approach was to try to configure both as XA data sources. I couldn't find any examples in the JBoss 5.0.1.GA installation for MySQL, but after some searching on the net I found some XML that seemed passable. I configured both to be XA data sources and deployed my app. When I ran my regression tests, I found that my application was failing because I had a DROP TABLE statement as part of a SQL batch. Apparently DROP (as well as a hand full of other SQL commands) don't play well in MySQL using XA data sources, since they create implied transaction boundaries and that is bad when you are within a XA transaction.

      So, I end the day with a few big questions:
      1) How important is it to have JBoss infrastructure use the DefaultDS while applications use something else? (Stated in another way, what advantage does this configuration provide?)
      2) Is this a supported (as in tried and tested, not as in paid support) configuration using MySQL and JBoss 5.0?
      3) Is there really a need to use XA data sources when one source is for JBoss infrastructure and the other is for my application?
      4) Is there another solution that I have overlooked or may be otherwise unaware of?

      Thanks,

      Josh

        • 1. Re: Multiple data sources when using MySQL
          jaikiran

           

          1) How important is it to have JBoss infrastructure use the DefaultDS while applications use something else? (Stated in another way, what advantage does this configuration provide?)


          As Peter rightly mentioned, using just a single database to host everything (= server's data and your app's data) isn't the right thing since that data is not related to each other.

          2) Is this a supported (as in tried and tested, not as in paid support) configuration using MySQL and JBoss 5.0?


          Yes MySQL datasource works against JBossAS-5.0


          3) Is there really a need to use XA data sources when one source is for JBoss infrastructure and the other is for my application?


          You mentioned that you ran into Multiple 1PC exception. Can you post that entire exception stacktrace? And when do this happen? Does it happen in a transaction where you trying to use your app's datasource (to save something to DB) and in the same transaction, send a message JMS message to queue/topic? In that case you are involving 2 transaction aware resources - one is your app's datasource and one is the datasource of JMS (used for message persistence). If you don't want them to be part of the same transaction, probably you can break them into different transactions.


          • 2. Re: Multiple data sources when using MySQL
            peterj

             

            apparently it is not common with MySQL as the database as there is very little information to be found on how to configure JBoss.


            http://www.jboss.org/community/docs/DOC-12255

            http://www.jboss.org/community/docs/DOC-12244

            I have another resource but it not free (though the code is), I can provide a URL if interested.

            I found out that it failed because there are two local-tx data sources


            That should not matter (I typically have two, occasionally a few more). However, the server will complain if two datasource have the same JNDI name.

            1) The name "DefaultDS" is scattered across several configuration files. There is nothing magic to that name - you could change all occurrences to "FooBar" and it would still work. The whole point, however, of leaving it at DefaultDS is so that you don't have to hunt down all of those references.

            2) See the URLs I gave above (I use both MySQL and PostgreSQL, and in my one production environment we use MySQL)

            3) No.

            4) No, having multiple *-ds.xml files, each using a different jndi-name and each referencing a different database within MySQL is the way to go.

            • 3. Re: Multiple data sources when using MySQL

              I started with a clean copy of the "standard" server and applied the instructions from http://www.jboss.org/community/docs/DOC-12255

              This is JBoss 5.0.1.GA and MySQL 5.1.33

              Here are my notes corresponding to the step in the instructions:
              1) Done
              2) Done
              3) Done
              4) Referenced file (standardjaws.xml) not found, step skipped
              5) datasource - No change needed; datasource-mapping - It was commented out with "optional since 4.0", I uncommented it and put in the suggested value of mySQL; fk-constraint - changed as instructed
              6) Added the specified security realm inserting my databases credentials (leaving the already present HsqlDbRealm)
              7) Referenced file (hsql-jdbc2-service.xml) was not found, substituted hsqldb-persistence-service.xml and mysql-persistence-service.xml in this step instead.
              8) As in (7) the file was not found, using mysql-persistence-service.xml instead, the referenced elements were not present, and the data source seemed to be set to DefaultDS already.
              9) Referenced file (hsqldb-jdbc-state-service.xml) was not found

              I started JBoss without my application deployed and got the following message:

              08:57:58,476 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
              08:57:58,820 WARN [JDBCPersistenceManager] JBoss Messaging Warning: DataSource connection transaction isolation should be READ_COMMITTED, but it is currently REPEATABLE_READ. Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems. Using an isolation level more strict than READ_COMMITTE may lead to deadlock.
              08:57:59,007 INFO [ServerPeer] JBoss Messaging 1.4.1.GA server [0] started
              08:57:59,038 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
              08:57:59,070 INFO [TomcatDeployment] deploy, ctxPath=/
              08:57:59,117 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console
              08:57:59,163 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of
              incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
              
              DEPLOYMENTS MISSING DEPENDENCIES:
               Deployment "jboss.messaging.connectionfactory:service=ClusterPullConnectionFac
              tory" is missing the following dependencies:
               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
              ...
              


              I added the element to deploy/mysql-ds.xml
              <transaction-isolation>TRANSACTION_READ_COMMITED</transaction-isolation>
              


              I restarted JBoss and got the following message:
              09:13:23,431 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
              
              DEPLOYMENTS MISSING DEPENDENCIES:
               Deployment "jboss.messaging.connectionfactory:service=ClusterPullConnectionFac
              tory" is missing the following dependencies:
               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
               Deployment "jboss.messaging.connectionfactory:service=ClusteredConnectionFactory" is missing the following dependencies:
               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
               Deployment "jboss.messaging.connectionfactory:service=ConnectionFactory" is mi
              ssing the following dependencies:
               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
               Deployment "jboss.messaging.destination:name=DLQ,service=Queue" is missing the following dependencies:
               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
               Deployment "jboss.messaging.destination:name=ExpiryQueue,service=Queue" is mis
              sing the following dependencies:
               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
               Deployment "jboss.messaging:service=PostOffice" is missing the following dependencies:
               Dependency "jboss.jgroups:service=ChannelFactory" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jgroups:service=ChannelFactory' **")
              
              DEPLOYMENTS IN ERROR:
               Deployment "jboss.jgroups:service=ChannelFactory" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jgroups:service=ChannelFactory' **
              

              I commented out the element
              <depends options-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends> in the file deploy/messaging/mysql-persistence-service.xml
              


              JBoss now starts with this warning:
              09:18:12,162 WARN [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
              09:18:12,162 WARN [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
              


              I'll work on deploying a second DS, my JMS queues, and app with this configuration and post my results as I go.

              • 4. Re: Multiple data sources when using MySQL

                Progress update:

                1) Copied the deploy/mysql-ds.xml file to deploy/app-mysql-ds.xml
                2) Changed the JNDI name, changed the URL, changed the credentials in app-mysql-ds.xml
                3) Restarted JBoss
                -- No errors and no new warnings --
                4) Deployed my JMS queues
                -- No errors --
                5) Deployed my app and I get a slew of warnings

                09:50:27,318 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
                09:50:27,318 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
                09:50:27,318 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.cancelTimer()
                09:50:27,334 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.initializeTimer(java.util.Date,long)
                09:50:27,349 WARN [InterceptorRegistry] applicable interceptors is non-existent for public long myapp.control.aging.AgingImpl.getTimeRemaining()
                09:50:27,365 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.initializeTimer()
                09:50:27,381 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.ejbTimeout(javax.ejb.Timer)
                09:50:27,381 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.cancelTimer()
                09:50:27,396 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.initializeTimer(java.util.
                Date,long)
                09:50:27,412 WARN [InterceptorRegistry] applicable interceptors is non-existent for public long myapp.control.aging.AgingImpl.getTimeRemaining()
                09:50:27,427 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.initializeTimer()
                09:50:27,443 WARN [InterceptorRegistry] applicable interceptors is non-existent for public void myapp.control.aging.AgingImpl.ejbTimeout(javax.ejb.Timer)
                09:50:27,459 INFO [AgingImpl] Initializing aging timer.
                09:50:27,459 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
                09:50:27,459 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
                09:50:27,459 WARN [InterceptorRegistry] applicable interceptors is non-existent for public java.lang.Object myapp.control.setting.SettingsImpl.get(myapp.client.control.setting.Key)
                09:50:27,474 WARN [InterceptorRegistry] applicable interceptors is non-existent for public java.lang.String myapp.control.setting.SettingsImpl.getRaw(myapp.client.control.setting.Key)
                09:50:27,474 WARN [InterceptorRegistry] applicable interceptors is non-existent for public java.util.EnumMap myapp.control.setting.SettingsImpl.getAll()
                09:50:27,490 WARN [InterceptorRegistry] applicable interceptors is non-existent for public java.lang.Object myapp.control.setting.SettingsImpl.get(myapp.client.control.setting.Key)
                09:50:27,506 WARN [InterceptorRegistry] applicable interceptors is non-existent for public java.lang.String myapp.control.setting.SettingsImpl.getRaw(myapp.client.control.setting.Key)
                09:50:27,506 WARN [InterceptorRegistry] applicable interceptors is non-existent for public java.util.EnumMap myapp.control.setting.SettingsImpl.getAll()
                


                If my internet searching is correct, these can be safely ignored (http://www.jboss.org/file-access/default/members/jbossejb3/freezone/docs/tutorial/1.0.0/html/EJB3_Interceptors.html the very bottom of the page).

                The one that concerns me however is this one.
                09:50:27,631 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource
                @26eac5
                09:50:27,631 ERROR [AgingImpl] EJB Exception during create timer : javax.ejb.EJBException: Failed to create timer
                


                • 5. Re: Multiple data sources when using MySQL

                  I tried setting the DefaultDS as a XA Data Source using a datasource descriptor I found on the net (I can't vouch for it's correctness) and leaving my application's data source as a local-tx (like what is found in docs/examples/jca).

                  <datasources>
                   <xa-datasource>
                   <jndi-name>DefaultDS</jndi-name>
                   <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                   <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/jbossdb</xa-datasource-property>
                   <xa-datasource-property name="User">user</xa-datasource-property>
                   <xa-datasource-property name="Password">pass</xa-datasource-property>
                   <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                  
                   <track-connection-by-tx>true</track-connection-by-tx>
                   <isSameRM-override-value>false</isSameRM-override-value>
                   <no-tx-separate-pools/>
                  
                   <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
                   <metadata>
                   <type-mapping>mySQL</type-mapping>
                   </metadata>
                   </xa-datasource>
                  </datasources>
                  


                  My application deploys with this configuration, and my regression tests all run and pass. I do get an error on start up, however.
                  11:14:51,021 INFO [SessionSpecContainer] Starting jboss.j2ee:ear=myapp.ear,jar=myapp-beans.jar,name=AgingImpl,service=EJB3
                  11:14:51,021 INFO [EJBContainer] STARTED EJB: myapp.control.aging.AgingImpl ejbName: AgingImpl
                  11:14:51,036 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
                  
                   myapp/AgingImpl/remote - EJB3.x Default Remote Business Interface
                   myapp/AgingImpl/remote-myapp.client.control.aging.Aging - EJB3.x Remote Business Interface
                  
                  11:14:51,239 ERROR [TimerImpl] Error invoking ejbTimeout
                  org.jboss.aop.DispatcherConnectException: EJB container is not completely started, or is stopped.
                   at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:62)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                   at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                   at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:304)
                   at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:561)
                   at java.util.TimerThread.mainLoop(Timer.java:512)
                   at java.util.TimerThread.run(Timer.java:462)
                  
                  ...(following INFO [JndiSessionRegistrarBase] Binding messages omitted)...
                  


                  I haven't been able to find any information on this one yet, but I'm guessing that a persisted timer is firing before the container is ready for it.


                  • 6. Re: Multiple data sources when using MySQL

                    I eliminated this last error by shutting down JBoss, truncating the timers table, and then restarting JBoss.

                    Another issue has come up with this configuration. I tried to install a second box (one of our testing serviers) using the final configuration from the above experiments and ran into problems.

                    Apparently, if I use the XA data source specification that I show above (without first using the non-XA source), then the JMS tables will not get created in the database and the Messaging service fails to start. Here are some stacktrace snips:

                    2009-04-16 10:17:34,446 DEBUG [org.jboss.messaging.core.jmx.JDBCPersistenceManagerService] (main) Starting jboss.messaging:service=PersistenceManager
                    
                    2009-04-16 10:17:34,493 DEBUG [org.jboss.messaging.core.impl.JDBCSupport] (main) Failed to execute: CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY)) ENGINE = INNODB
                    
                    java.sql.SQLException: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
                    
                     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
                    
                     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
                    
                     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
                    
                     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
                    
                     at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
                    
                     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
                    
                     at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
                    
                     at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1605)
                    
                     at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1524)
                    
                     at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeUpdate(StatementWrapper.java:839)
                    
                     at org.jboss.resource.adapter.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:249)
                    
                     at org.jboss.messaging.core.impl.JDBCSupport.createSchema(JDBCSupport.java:301)
                    
                     at org.jboss.messaging.core.impl.JDBCSupport.start(JDBCSupport.java:167)
                    
                     at org.jboss.messaging.core.impl.JDBCPersistenceManager.start(JDBCPersistenceManager.java:148)
                    
                     at org.jboss.messaging.core.jmx.JDBCPersistenceManagerService.startService(JDBCPersistenceManagerService.java:100)
                    
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
                    
                     at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:269)
                    
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    
                     at java.lang.reflect.Method.invoke(Method.java:597)
                    
                     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                    
                     at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                    
                     at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
                    
                     at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
                    
                     at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
                    
                     at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
                    
                     at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    
                     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                    
                     at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
                    
                     at $Proxy36.start(Unknown Source)
                    
                     at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
                    
                     at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
                    
                     at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                    
                     at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                    
                     at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                    
                     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                    
                     at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
                    
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                    
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                    
                     at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
                    
                     at org.jboss.system.ServiceController.start(ServiceController.java:460)
                    
                     at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
                    
                     at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
                    
                     at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
                    
                     at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                    
                     at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                    
                     at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                    
                     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                    
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                    
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                    
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
                    
                     at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
                    
                     at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
                    
                     at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
                    
                     at org.jboss.Main.boot(Main.java:209)
                    
                     at org.jboss.Main$1.run(Main.java:547)
                    
                     at java.lang.Thread.run(Thread.java:619)
                    

                    ...(omitted many similar traces for different JBM tables)...
                    2009-04-16 10:17:34,509 DEBUG [org.jboss.messaging.core.impl.JDBCPersistenceManager] (main) Adding record on JBM_DUAL
                    
                    2009-04-16 10:17:34,524 DEBUG [org.jboss.messaging.core.impl.JDBCPersistenceManager] (main) Checking for existance on JBM_DUAL
                    
                    2009-04-16 10:17:34,524 ERROR [org.jboss.messaging.util.ExceptionUtil] (main) org.jboss.messaging.core.jmx.JDBCPersistenceManagerService@112e6ef startService
                    
                    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jbossdfmdb.jbm_dual' doesn't exist
                    
                     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                    
                     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                    
                     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                    
                     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                    
                     at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
                    
                     at com.mysql.jdbc.Util.getInstance(Util.java:381)
                    
                     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
                    
                     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
                    
                     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
                    
                     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
                    
                     at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
                    
                     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
                    
                     at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
                    
                     at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477)
                    
                     at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422)
                    
                     at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:743)
                    
                     at org.jboss.resource.adapter.jdbc.WrappedStatement.executeQuery(WrappedStatement.java:226)
                    
                     at org.jboss.messaging.core.impl.JDBCPersistenceManager.start(JDBCPersistenceManager.java:203)
                    
                     at org.jboss.messaging.core.jmx.JDBCPersistenceManagerService.startService(JDBCPersistenceManagerService.java:100)
                    
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
                    
                     at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:269)
                    
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    
                     at java.lang.reflect.Method.invoke(Method.java:597)
                    
                     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                    
                     at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                    
                     at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
                    
                     at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
                    
                     at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
                    
                     at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
                    
                     at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    
                     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                    
                     at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
                    
                     at $Proxy36.start(Unknown Source)
                    
                     at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
                    
                     at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
                    
                     at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                    
                     at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                    
                     at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                    
                     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                    
                     at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
                    
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                    
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                    
                     at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
                    
                     at org.jboss.system.ServiceController.start(ServiceController.java:460)
                    
                     at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
                    
                     at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
                    
                     at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
                    
                     at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                    
                     at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                    
                     at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                    
                     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                    
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                    
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                    
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                    
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                    
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                    
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
                    
                     at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
                    
                     at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
                    
                     at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
                    
                     at org.jboss.Main.boot(Main.java:209)
                    
                     at org.jboss.Main$1.run(Main.java:547)
                    
                     at java.lang.Thread.run(Thread.java:619)
                    
                    2009-04-16 10:17:34,524 DEBUG [org.jboss.messaging.core.jmx.JDBCPersistenceManagerService] (main) Starting failed jboss.messaging:service=PersistenceManager
                    


                    According to
                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=84442&postdays=0&postorder=asc&start=0 I shouldn't be using XA for my messaging. This sends me back to the beginning in configuring two data sources.

                    Perhaps I should just move the timer to my application's datasource. Is there a problem doing that?

                    • 7. Re: Multiple data sources when using MySQL
                      pualsa

                      Hi,

                      I think the right configuration is to use <local-tx> for JBM and for the application. Also take the latest MySQL driver (5.1.8) - there is a fix for XA. I don't have problems with timers, but there are many transaction problems when MDBs are very loaded. I'll try the workaround posted at JBAS-5801.

                      • 8. Re: Multiple data sources when using MySQL
                        yashendrac

                        Hi,

                        I am also getting same error related to MySQL.

                        Deployment "jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.connectionfactory:service=ClusteredConnectionFactory" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.connectionfactory:service=ConnectionFactory" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.destination:name=DLQ,service=Queue" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.destination:name=ExpiryQueue,service=Queue" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.destination:name=ObjectUpdates,service=Topic" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.destination:name=audit,service=Queue" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging.destination:name=report,service=Topic" is missing the following dependencies:
                         Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                         Deployment "jboss.messaging:service=PostOffice" is missing the following dependencies:
                         Dependency "jboss.jgroups:service=ChannelFactory" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jgroups:service=ChannelFactory' **")
                        


                        Any Idea if commenting out following is safe?

                        <depends options-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends> in the file deploy/messaging/mysql-persistence-service.xml
                        


                        • 9. Re: Multiple data sources when using MySQL

                          I haven't noticed any adverse effects yet. You do get a warning in the log, however.

                          • 10. Re: Multiple data sources when using MySQL
                            emeuwese

                             

                            "yashendrac" wrote:
                            Hi,

                            I am also getting same error related to MySQL.

                            Deployment "jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.connectionfactory:service=ClusteredConnectionFactory" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.connectionfactory:service=ConnectionFactory" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.destination:name=DLQ,service=Queue" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.destination:name=ExpiryQueue,service=Queue" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.destination:name=ObjectUpdates,service=Topic" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.destination:name=audit,service=Queue" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging.destination:name=report,service=Topic" is missing the following dependencies:
                             Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                             Deployment "jboss.messaging:service=PostOffice" is missing the following dependencies:
                             Dependency "jboss.jgroups:service=ChannelFactory" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jgroups:service=ChannelFactory' **")
                            


                            Any Idea if commenting out following is safe?

                            <depends options-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends> in the file deploy/messaging/mysql-persistence-service.xml
                            


                            I am using a Local-tx datasource, mysql driver 5.1.8, JBoss AS 5.1.0GA and to solve the error you have to replace <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory in mysql-persistence-service.xml with jboss.jgroups:service=ChannelFactory

                            see JBAS-6991 and JBAS-6333

                            • 11. Re: Multiple data sources when using MySQL
                              emeuwese

                               

                              "yashendrac" wrote:
                              Hi,

                              I am also getting same error related to MySQL.

                              Deployment "jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.connectionfactory:service=ClusteredConnectionFactory" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.connectionfactory:service=ConnectionFactory" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.destination:name=DLQ,service=Queue" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.destination:name=ExpiryQueue,service=Queue" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.destination:name=ObjectUpdates,service=Topic" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.destination:name=audit,service=Queue" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging.destination:name=report,service=Topic" is missing the following dependencies:
                               Dependency "jboss.messaging:service=PostOffice" (should be in state "Create", but is actually in state "Configured")
                               Deployment "jboss.messaging:service=PostOffice" is missing the following dependencies:
                               Dependency "jboss.jgroups:service=ChannelFactory" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jgroups:service=ChannelFactory' **")
                              


                              Any Idea if commenting out following is safe?

                              <depends options-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends> in the file deploy/messaging/mysql-persistence-service.xml
                              


                              I am using a local-tx datasource, mysql driver 5.1.8, JBoss AS 5.1.0GA and to solve the dependency error you have to replace
                              <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>

                              in mysql-persistence-service.xml with
                              <attribute name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</attribute>


                              see JBAS-6991 and JBAS-6333