I am using Java 1.6 and JBoss EAP 6.1.
My application runs on JBoss 5.1, but when I try to run my application on JBoss 6.1, I get this error:
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[11,3] in jboss-web.xml
JBoss's log:
00:06:52,823 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MyApplication-0.0.1-SNAPSHOT.war" (runtime-name: "MyApplication-0.0.1-SNAPSHOT.war")
00:06:54,743 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."MyApplication-0.0.1-SNAPSHOT.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyApplication-0.0.1-SNAPSHOT.war".PARSE: JBAS018733: Failed to process phase PARSE of deployment "MyApplication-0.0.1-SNAPSHOT.war"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018014: Failed to parse XML descriptor "/content/MyApplication-0.0.1-SNAPSHOT.war/WEB-INF/jboss-web.xml" at [11,3]
at org.jboss.as.web.deployment.JBossWebParsingDeploymentProcessor.deploy(JBossWebParsingDeploymentProcessor.java:79)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
... 5 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[11,3]
Message: Unexpected element 'class-loading' encountered
at org.jboss.metadata.parser.util.MetaDataElementParser.unexpectedElement(MetaDataElementParser.java:109)
at org.jboss.metadata.parser.jbossweb.JBossWebMetaDataParser.parse(JBossWebMetaDataParser.java:206)
at org.jboss.as.web.deployment.JBossWebParsingDeploymentProcessor.deploy(JBossWebParsingDeploymentProcessor.java:71)
... 6 more
00:06:54,748 ERROR [org.jboss.as.server] (HttpManagementService-threads - 8) JBAS015870: Deploy of deployment "MyApplication-0.0.1-SNAPSHOT.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MyApplication-0.0.1-SNAPSHOT.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MyApplication-0.0.1-SNAPSHOT.war\".PARSE: JBAS018733: Failed to process phase PARSE of deployment \"MyApplication-0.0.1-SNAPSHOT.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018014: Failed to parse XML descriptor \"/content/MyApplication-0.0.1-SNAPSHOT.war/WEB-INF/jboss-web.xml\" at [11,3]
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[11,3]
Message: Unexpected element 'class-loading' encountered"}}
00:06:54,867 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment MyApplication-0.0.1-SNAPSHOT.war (runtime-name: MyApplication-0.0.1-SNAPSHOT.war) in 118ms
I'm getting this exception in jboss-web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<!-- <context-root>MyApplication</context-root>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>com.globalss:loader=MyApplication.war
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>-->
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
org.myapp:loader=MyApplication.war
<loader-repository-config>java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
</class-loading>
<resource-ref>
<res-ref-name>database</res-ref-name>
<jndi-name>java:/database</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>dataSource</res-ref-name>
<jndi-name>java:/dataSource</jndi-name>
</resource-ref>
</jboss-web>
Why do we get this error?
What is the root cause of getting this error?
How do we solve this error?
According to this JBoss's community thread, the error is occurring because the tag class-loading
is no longer present on JBoss EAP 6.X (JBoss AS 7.X) jboss-web.xml schema.
The reason that tag is no longer present is because
Class loading has changed from hierarchical to modular in AS7. (...) The behaviour that this provokes in EAP 5 is now the default class-loading behaviour in AS 7.
The solution passes by commenting
the <class-loading> element in jboss-web.xml, since it is no longer necessary.