java 在 Jboss 7.1 上部署 datasource.xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14347625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Deploying datasource.xml on Jboss 7.1
提问by rapt
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.
我正在尝试将一个名为 的数据源 xml 文件添加oracle-ds.xml
到我的 JBoss 7.1 文件夹,以便我部署在该服务器上的项目可以使用该数据源。
As it is explained on jboss.org, I need to put that file in the deployments folder.
正如jboss.org上所解释的,我需要将该文件放在部署文件夹中。
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.
这就是我所做的。但与他们在上面链接中所说的不同,我在本地 Maven 存储库中有我的 Orcale 驱动程序 jar。无论如何,maven 能够构建该项目。
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...
现在当我重启Jboss时,它好像oracle-ds.xml
是一个需要部署的项目(jar),而不是一个xml设置文件...
Here is some of the console output during Jboss' restart:
以下是 Jboss 重启期间的一些控制台输出:
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?
为什么会发生这种情况,我应该怎么做才能纠正这种行为?
回答by CoolBeans
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.
复制oracle-ds.xml
tostandalone\deployments
文件夹是部署它的正确方法。尽管我建议在 standalone.xml 或管理控制台或 CLI 中定义数据源,而不是在单独的 xml 文件中。
The issue here is that oracle-ds.xml
is failing the XSD validation. If you look at the XSDfor the data source xml you will find that there is no local-tx-datasource
element in the XSD.
这里的问题是oracle-ds.xml
XSD 验证失败。如果查看数据源 xml的XSD,您会发现local-tx-datasource
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.
要解决此问题,您需要确保您的 XML 文件通过 XSD 验证。或者,您可以在管理控制台中或通过 CLI 定义数据源,以避免手动创建并遇到这些类型的问题。