File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes  java.lang.IllegalStateException: jboss.jca:name=MySQLDS,service=ManagedConnectionFactory is already Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark " java.lang.IllegalStateException: jboss.jca:name=MySQLDS,service=ManagedConnectionFactory is already" Watch " java.lang.IllegalStateException: jboss.jca:name=MySQLDS,service=ManagedConnectionFactory is already" New topic

java.lang.IllegalStateException: jboss.jca:name=MySQLDS,service=ManagedConnectionFactory is already

abir jelassi

Joined: Apr 30, 2012
Posts: 4
Hi everyone,
I have a big big problem. When i deploy my ear project composed by a dynamin web project and an ejb project in jboss i have this error:
i'm sure that i have only one mysql-ds.xml under meta inf and i deleted the mysql-ds.xml of jboss_home/server/default/deploy:
i need your help, pleaaaaaaaase

abir jelassi

Joined: Apr 30, 2012
Posts: 4
Voilà mon mysql-ds.xml

Does anyone have a solution??
abir jelassi

Joined: Apr 30, 2012
Posts: 4
I don't have errors anymore following this forum
but, can't see the execution of my application
Thanks anyway
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Where is that -ds.xml located? And do you have more than one such file somewhere within your application?

[My Blog] [JavaRanch Journal]
abir jelassi

Joined: Apr 30, 2012
Posts: 4
mysql-ds.xml is under meta inf of the ejb project with persistence.xml,orm.xml, ejb-jar.xml and beans.xml
thanks for your reply
Raghav Viswanathan

Joined: Apr 26, 2012
Posts: 26

Hello Abir,

The issue is due to a conflict with already existing JNDI MySQLDS. You can try one of the following

1. Remove your application .ear file and start JBOSS as such. Now check in the admin console under datasources link if you already have one with the given JNDI name.
Two things could be possible
a. If you have a datasource with the JNDI name as MySQLDS, then there is a -ds.xml in your deploy folder with the same JNDI name. All you could do is a search for the word "MySQLDS" in your folder search/file search of the folder.
b. If there are no data sources listed then it must be inside of your .ear file.

2. Change the JNDI name ( Probably not the right way to do but would work).

Please note that there are few other ds.xml files even inside the folders of the deploy folder. For instance there is a folder called jbossesb.esb under the deploy folder which has a message-store-ds.xml which also creates a JNDI binding of the data source.

Just a word of advice, do not manually edit the ds.xml file for your server configuration even while changing the DB from HSQLDB. Run the ant script available in /jboss-as/tools/schema. Its is scripted beautifully and is very user-friendly.

Thanks and regards

Better late than never.
I agree. Here's the link:
subject: java.lang.IllegalStateException: jboss.jca:name=MySQLDS,service=ManagedConnectionFactory is already
jQuery in Action, 3rd edition