在 JBoss AS 7.1.1.Final 上开发 J2EE 应用程序时,我一直在定义一些配置文件,如下所示:
xa-orchestrator-ds.xml
(请注意,我的数据源是 MySQL 实例):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<datasources>
...
</datasources>
jboss-web.xml
:
<!DOCTYPE jboss-web PUBLIC "http://www.jboss.org/j2ee/dtd" "http://www.jboss.org/j2ee/dtd/jboss-service_5_0.dtd">
<jboss-web>
...
</jboss-web>
web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
...
</web-app>
此配置导致与XML验证相关的运行时异常:
12:28:50,676 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."MIUR_PRISMA-2.1-BusinessLayer.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MIUR_PRISMA-2.1-BusinessLayer.war".PARSE: Failed to process phase PARSE of deployment "MIUR_PRISMA-2.1-BusinessLayer.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.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.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Connection reset
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.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: com.ctc.wstx.exc.WstxIOException: Connection reset
at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:699)
at com.ctc.wstx.sr.ValidatingStreamReader.findDtdExtSubset(ValidatingStreamReader.java:480)
at com.ctc.wstx.sr.ValidatingStreamReader.finishDTD(ValidatingStreamReader.java:341)
at com.ctc.wstx.sr.BasicStreamReader.skipToken(BasicStreamReader.java:3341)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1958)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1102)
at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1125)
at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:106)
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
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196) [rt.jar:1.7.0_51]
at java.net.SocketInputStream.read(SocketInputStream.java:122) [rt.jar:1.7.0_51]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) [rt.jar:1.7.0_51]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) [rt.jar:1.7.0_51]
at java.io.BufferedInputStream.read(BufferedInputStream.java:334) [rt.jar:1.7.0_51]
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687) [rt.jar:1.7.0_51]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633) [rt.jar:1.7.0_51]
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:658) [rt.jar:1.7.0_51]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323) [rt.jar:1.7.0_51]
at java.net.URL.openStream(URL.java:1037) [rt.jar:1.7.0_51]
at com.ctc.wstx.util.URLUtil.inputStreamFromURL(URLUtil.java:146)
at com.ctc.wstx.io.DefaultInputResolver.sourceFromURL(DefaultInputResolver.java:254)
at com.ctc.wstx.io.DefaultInputResolver.resolveEntity(DefaultInputResolver.java:92)
at com.ctc.wstx.sr.ValidatingStreamReader.findDtdExtSubset(ValidatingStreamReader.java:471)
... 14 more
实际上,通过从xa-orchestrator-ds.xml
中删除doctype定义,它可以正常工作。
通过包含正确的doctypes,这是正确的配置?
答案 0 :(得分:0)
从J Boss Application Server 7.1.0.Final 开始,您可以按照架构部署-ds.xml
文件:
http://docs.jboss.org/ironjacamar/schema/datasources_1_1.xsd
<强>例如强>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="java:jboss/datasources/MySqlDB" pool-name="MySQLPool">
<connection-url>jdbc:mysql://localhost:3306/as7db</connection-url>
<driver>mysql-connector-java-5.1.18-bin.jar</driver>
<pool>
<max-pool-size>30</max-pool-size>
</pool>
<security>
<user-name>user</user-name>
<password>...</password>
</security>
</datasource>
</datasources>
修改强>
另一种方法是添加schemaLocation
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_1.xsd">
</datasources>