-
1. Re: [jbdevstudio-users] Setting up datasource in JBoss
burrsutter Apr 22, 2014 11:15 AM (in response to sjparikh)Can you try our datasource wizard?
http://screencast.com/t/LneBx3ZA
It should generate a valid -ds.xml for you, if not, we really do want to know
On Apr 22, 2014, at 11:07 AM, Swetal Parikh <jbdevstudio-users@lists.jboss.org> wrote:
Hello,
I am new to JBoss. I downloaded JBoss Developer Studio
JBoss Enterprise Application Platform - Version 6.2.0.GA
I am trying to setup MySQL as datasource and it is not able to recognize my XML.
I copied mysql-connector-java-5.1.30-bin.jar in jboss-eap\standalone\lib directory. Then I placed mysql-ds.xml in jboss-eap\standalone\deployments directory. Following is the content of mysql-ds.xml:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<datasource>
<jndi-name>java:/DefaultDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>test1102</password>
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</datasource>
</datasources>
When I restart JBoss server from my JBDevStudio. I see following message in the console:
09:44:25,580 INFO (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."mysql-ds.xml".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."mysql-ds.xml".PARSE: JBAS018733: Failed to process phase PARSE of deployment "mysql-ds.xml"
I will appreciate if someone can shed some light on what am I doing wrong here.
Thanks,
Swetal
Posted by forums
Original post: https://community.jboss.org/message/869775#869775
_______________________________________________
jbdevstudio-users mailing list
-
att1.html.zip 1.4 KB
-
-
2. Re: Setting up datasource in JBoss
wdfink Apr 22, 2014 11:21 AM (in response to sjparikh)Datasources are handled different in EAP6.
The recommended way is to use a module for the driver and use the subsystem datasources to install the DS as managed, see Data Source Configuration in AS 7
You might use *-ds.xml files for development, a description how to do it is here
-
3. Re: Setting up datasource in JBoss
maxandersen Apr 22, 2014 11:41 AM (in response to wdfink)where do you see recommended way is to use modules ? if your driver is jdbc 4 compliant no need for added complexity of modules.
-
4. Re: Setting up datasource in JBoss
maxandersen Apr 22, 2014 11:44 AM (in response to burrsutter)Try what Burr suggest - what the wizard does differently is it will put the mysql. jar in the deployments directory where it should be picked up.
-
5. Re: Setting up datasource in JBoss
wdfink Apr 22, 2014 11:50 AM (in response to maxandersen)Sorry, you're right - the recommended way is to use a managed datasource (*-ds.xml files for development)
for simple DS the driver can be deployed or installed as a module but sometimes you need to use it as module if the scenario is more complex.
-
6. Re: Setting up datasource in JBoss
sjparikh Apr 22, 2014 2:12 PM (in response to burrsutter)Hi Burr,
Thanks for the reply. I tried to create data source using the tool you mentioned. It created following XML (New_MySQL-ds.xml) :
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="java:jboss/datasources/New_MySQL" enabled="true"
use-java-context="true" pool-name="New_MySQL">
<connection-url>jdbc:mysql://localhost:3306/addressbook</connection-url>
<driver>mysql-connector-java-5.1.30-bin.jar</driver>
<pool></pool>
<security>
<user-name>root</user-name>
<password>test1102</password>
</security>
</datasource>
</datasources>
But I am still getting following error when I bring up the application server:
13:06:01,920 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."TestFrontEnd.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."TestFrontEnd.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "TestFrontEnd.war"
service jboss.deployment.unit."mysql-ds.xml".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."mysql-ds.xml".PARSE: JBAS018733: Failed to process phase PARSE of deployment "mysql-ds.xml"
-
7. Re: Setting up datasource in JBoss
sjparikh Apr 22, 2014 3:38 PM (in response to burrsutter)I found following article on how to set it up:
http://bnlconsulting.com/index.php/blog/item/88-jboss-71-adding-mysql-datasource
After I followed the document, I do see Datasource being added on management console. But when I try to test the connection, I get following error:
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "EmployeeServiceDS")
],
"operation" => "flush-all-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010442: failed to match pool. Check JndiName: java:jboss/datasources/EmplouyeeServiceDS",
"rolled-back" => true
}
-
8. Re: Setting up datasource in JBoss
maxandersen Apr 23, 2014 5:09 AM (in response to sjparikh)The datasource you show has this name: java:jboss/datasources/New_MySQL
your error indicates you used: java:jboss/datasources/EmplouyeeServiceDS when trying to refer to it.
Those names should match for it to be found.