wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes multiple datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "multiple datasource" Watch "multiple datasource" New topic
Author

multiple datasource

Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
Hi there,
I'm new with Jboss and I'm trying to understand how to configure multiple datasource based on different databases. I've already gone trough the jboss.com docs, but onestly it didn't help me much.
I'm now working with JBoss 4.0.5 and MySQL 5 (but I'd like implement Oracle too).

Following this tutorial this tutorial I've been able to run my entity bean, however I had to replace the DefaultDS hsqldb with MySQL and this is not exactly what I wanted to achieve.
So, I'm probably missing something. Would you have a look on what I did and tell me if I need further configurations?

  • add the mysql driver
  • replaced the hsqldb-ds.xml with the new edited mysql-ds.xml

  • replaced the ../jms/hsqldb-jdbc2-service.xml with ../jms/mysql-jdbc2-service.xml

  • modified the ejb-jar.xml in my module

  • edit the entity bean method



  • So, as I sayd the entity bean correctly works, but on JBoss startup I now get an error

    19:12:20,488 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

    --- MBeans waiting for other MBeans ---
    ObjectName: jboss.mq:service=InvocationLayer,type=HTTP
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=Invoker
    jboss.web:service=WebServer

    ObjectName: jboss.mq.destination:service=Topic,name=testTopic
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager

    ObjectName: jboss.mq.destination:service=Topic,name=securedTopic
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager

    ObjectName: jboss.mq.destination:service=Topic,name=testDurableTopic
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager

    ObjectName: jboss.mq.destination:service=Queue,name=testQueue
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager

    ObjectName: jboss.mq.destination:service=Queue,name=A
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager

    ObjectName: jboss.mq.destination:service=Queue,name=B
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager

    ObjectName: jboss.mq.destination:service=Queue,name=C
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager

    ObjectName: jboss.mq.destination:service=Queue,name=D
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager

    ObjectName: jboss.mq.destination:service=Queue,name=ex
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager

    ObjectName: jboss.mq:service=Invoker
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=TracingInterceptor
    jboss:service=Naming
    Depends On Me:
    jboss.mq:service=InvocationLayer,type=HTTP
    jboss.mq:service=InvocationLayer,type=JVM
    jboss.mq:service=InvocationLayer,type=UIL2

    ObjectName: jboss.mq:service=TracingInterceptor
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=SecurityManager
    Depends On Me:
    jboss.mq:service=Invoker

    ObjectName: jboss.mq:service=SecurityManager
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager
    Depends On Me:
    jboss.mq.destination:service=Topic,name=testTopic
    jboss.mq.destination:service=Topic,name=securedTopic
    jboss.mq.destination:service=Topic,name=testDurableTopic
    jboss.mq.destination:service=Queue,name=testQueue
    jboss.mq:service=TracingInterceptor
    jboss.mq.destination:service=Queue,name=DLQ

    ObjectName: jboss.mq.destination:service=Queue,name=DLQ
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager

    ObjectName: jboss.mq:service=InvocationLayer,type=JVM
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=Invoker

    ObjectName: jboss.mq:service=InvocationLayer,type=UIL2
    State: CONFIGURED
    I Depend On:
    jboss.mq:service=Invoker

    --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
    ObjectName: jboss.mq:service=DestinationManager
    State: NOTYETINSTALLED
    Depends On Me:
    jboss.mq.destination:service=Topic,name=testTopic
    jboss.mq.destination:service=Topic,name=securedTopic
    jboss.mq.destination:service=Topic,name=testDurableTopic
    jboss.mq.destination:service=Queue,name=testQueue
    jboss.mq.destination:service=Queue,name=A
    jboss.mq.destination:service=Queue,name=B
    jboss.mq.destination:service=Queue,name=C
    jboss.mq.destination:service=Queue,name=D
    jboss.mq.destination:service=Queue,name=ex
    jboss.mq:service=SecurityManager
    jboss.mq.destination:service=Queue,name=DLQ


    I was not able to find the reason, but it started after I replaced the DefaultDS with MySQL.

    Back to my configuration, how can I set up multiple datasource?

    Thank you in advance.


    trying to decode a woman mind....
    Kaustabh Singha Roy
    Ranch Hand

    Joined: Oct 04, 2005
    Posts: 43
    I am not sure I am understanding the problem properly. If you want to create a new xml file with the name XYZ-ds.xml and give it contents similar to those in the default ds file. Just make sure that the JNDI name is unique. There is no limit of how many data sources you can create like this.

    Hope this is helpful for you.
    Mark Spritzler
    ranger
    Sheriff

    Joined: Feb 05, 2001
    Posts: 17259
        
        6

    You issue is around the Destination Manager.

    Here is what I noticed that is different between the jms' jdbc2-service.xml files. In the Hypersonic HSQLDB file it had two more "dependencies" than the MySQL version. But, since Hypersonic is an in memory database, I can see why they need a ThreadPool and lookup stuff in the JNDI tree, whereas in theory the MySQL database shouldn't need. Try adding them, just to see what happens.




    What did you change in your mysql-jdbc2-service.xml besides the DataSource Name to be DefaultDS?


    Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
    How to Ask Questions the Smart Way FAQ
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
     
    subject: multiple datasource