Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying datasource.xml on Jboss 7.1

I am trying to add a datasource xml file, named oracle-ds.xml, to my JBoss 7.1 folder so projects that I deploy on that server could use that data source.

As it is explained on jboss.org, I need to put that file in the deployments folder.

Which is what I did. But unlike what they said in the link above, I have my Orcale driver jar in my local maven repository. Anyway, maven is able to build the project.

Now when I restart Jboss, it seems like it regards oracle-ds.xml as a project (jar) that needs to be deployed, not as an xml setting file...

Here is some of the console output during Jboss' restart:

15:58:16,666 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "oracle-ds.xml"
15:58:16,728 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."oracle-ds.xml".PARSE: org.jboss.msc.se
rvice.StartException in service jboss.deployment.unit."oracle-ds.xml".PARSE: Failed to process phase PARSE of deployment "oracle-ds.xml"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_29]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_29]
        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: IJ010061: Unexpected element: local-tx-datasource
        at org.jboss.as.connector.deployers.processors.DsXmlDeploymentParsingProcessor.deploy(DsXmlDeploymentParsingProcessor.java:85)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
        ... 5 more
Caused by: org.jboss.jca.common.metadata.ParserException: IJ010061: Unexpected element: local-tx-datasource
        at org.jboss.jca.common.metadata.ds.DsParser.parseDataSources(DsParser.java:183)
        at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:119)
        at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:82)
        at org.jboss.as.connector.deployers.processors.DsXmlDeploymentParsingProcessor.deploy(DsXmlDeploymentParsingProcessor.java:80)
        ... 6 more

Why does it happen and what should I do to correct this behavior?

like image 545
rapt Avatar asked Jan 15 '13 21:01

rapt


People also ask

Are You missing the resurrection of -DS XML datasources in JBoss?

JBoss AS 7.1.1 has been released and one of its appealing news is the “resurrection” of the earlier -ds.xml datasources which can now be deployed as a standalone resource or even as part of an application. We have to admit, we were missing it.

Why are password vaults and security domains not included in DataSource deployment?

Also, password vaults and security domains are not deployable, so these can not be bundled with a datasource deployment. The datasource subsystem is provided by the IronJacamar project.

How do I add a Java driver to JBoss?

The simplest way to provide a driver is copying it into the deployments folder of your application server. Supposing we are going to install a MySQL Driver: cp mysql-connector-java-5.1.18-bin.jar /usr/jboss-as-7.1.1.Final/standalone/deployments

How do I make a JDBC driver jar deployable?

Such JARs will contain a text a file named META-INF/services/java.sql.Driver, which contains the name of the class (es) of the Drivers which exist in that JAR. If your JDBC driver JAR is not JDBC 4-compliant, it can be made deployable in one of a few ways. The most straightforward solution is to simply modify the JAR and add the missing file.


1 Answers

Copying the oracle-ds.xml to standalone\deployments folder is the correct way to deploy it. Although I would recommend defining the data source in the standalone.xml or in the management console or in CLI instead of a separate xml file.

The issue here is that oracle-ds.xml is failing the XSD validation. If you look at the XSD for the data source xml you will find that there is no local-tx-datasource element in the XSD.

To resolve this you will need to make sure your XML file passes the XSD validation. Alternatively you can define the data source in the management console or via CLI to avoid creating it manually and running into these types of issues.

like image 199
CoolBeans Avatar answered Sep 20 '22 10:09

CoolBeans