Spring部署设置openshift

Spring deployment settings openshift

我有一个问题让我抓狂了三天。

我根据 OpenShift 帐户上的教程部署了 spring-eap6-quickstart 代码。我已配置调试选项,并且已将 Eclipse 工作区与 OpehShift 服务器同步 - 服务器上的一切工作正常,但在 Eclipse 中出现无法消除的错误。

我有这个错误:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'deployment'. One of '{ear-subdeployments-isolated, deployment, sub-deployment, module}' is expected.  jboss-deployment-structure.xml /spring-eap6-quickstart/src/main/webapp/WEB-INF line 2

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

 <deployment>

   <dependencies>

      <module name="com.h2database.h2"/>

      <module name="org.codehaus.jackson.jackson-core-asl"/>

      <module name="org.codehaus.jackson.jackson-mapper-asl"/>

      <module name="org.slf4j"/>

   </dependencies>

 </deployment>

</jboss-deployment-structure>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:2.0">

<?xml version="1.0" encoding="UTF-8"?>

<jds:jboss-deployment-structure xmlns:jds="urn:jboss:deployment-structure:1.0">

 <deployment>

  <dependencies>

   <module name="org.dom4j" />

  </dependencies>

 </deployment>

</jds:jboss-deployment-structure>

这表示部署标签上的错误。

我的 jboss 部署结构 xml 是:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'deployment'. One of '{ear-subdeployments-isolated, deployment, sub-deployment, module}' is expected.  jboss-deployment-structure.xml /spring-eap6-quickstart/src/main/webapp/WEB-INF line 2

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

 <deployment>

   <dependencies>

      <module name="com.h2database.h2"/>

      <module name="org.codehaus.jackson.jackson-core-asl"/>

      <module name="org.codehaus.jackson.jackson-mapper-asl"/>

      <module name="org.slf4j"/>

   </dependencies>

 </deployment>

</jboss-deployment-structure>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:2.0">

<?xml version="1.0" encoding="UTF-8"?>

<jds:jboss-deployment-structure xmlns:jds="urn:jboss:deployment-structure:1.0">

 <deployment>

  <dependencies>

   <module name="org.dom4j" />

  </dependencies>

 </deployment>

</jds:jboss-deployment-structure>

当我将部署结构更改为:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'deployment'. One of '{ear-subdeployments-isolated, deployment, sub-deployment, module}' is expected.  jboss-deployment-structure.xml /spring-eap6-quickstart/src/main/webapp/WEB-INF line 2

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

 <deployment>

   <dependencies>

      <module name="com.h2database.h2"/>

      <module name="org.codehaus.jackson.jackson-core-asl"/>

      <module name="org.codehaus.jackson.jackson-mapper-asl"/>

      <module name="org.slf4j"/>

   </dependencies>

 </deployment>

</jboss-deployment-structure>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:2.0">

<?xml version="1.0" encoding="UTF-8"?>

<jds:jboss-deployment-structure xmlns:jds="urn:jboss:deployment-structure:1.0">

 <deployment>

  <dependencies>

   <module name="org.dom4j" />

  </dependencies>

 </deployment>

</jds:jboss-deployment-structure>

eclipse 中的这个更改纠正了错误,但随后应用程序无法在 OpenShift 服务器上运行。

我意识到问题出在设置中,但我不知道如何解决问题。有谁知道我必须做什么?请帮忙。谢谢。


使用 urn:jboss:deployment-structure:1.0 时,您的 xml 绝对有效。不幸的是,jbossas 部署结构方案中存在错误,因此 Eclipse 会抱怨:

https://issues.jboss.org/browse/JBIDE-15311

将引用方案的版本升级到 2.0 通过引用一个不存在的方案在 Eclipse 中修复它,2.0 尚不存在。因此 OpenShift 将失败。目前有 1.0、1.1 和 1.2。即将到来的 2.0 应该修复该方案,从而使 Eclipse 正确验证。但不幸的是,我们还没有到达那里。我建议您只需关闭验证,全部或仅方案验证:Window->Preferences->Validation:

关于java:Spring部署设置openshift


更新您的 xml 以定义命名空间,即:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'deployment'. One of '{ear-subdeployments-isolated, deployment, sub-deployment, module}' is expected.  jboss-deployment-structure.xml /spring-eap6-quickstart/src/main/webapp/WEB-INF line 2

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

 <deployment>

   <dependencies>

      <module name="com.h2database.h2"/>

      <module name="org.codehaus.jackson.jackson-core-asl"/>

      <module name="org.codehaus.jackson.jackson-mapper-asl"/>

      <module name="org.slf4j"/>

   </dependencies>

 </deployment>

</jboss-deployment-structure>

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:2.0">

<?xml version="1.0" encoding="UTF-8"?>

<jds:jboss-deployment-structure xmlns:jds="urn:jboss:deployment-structure:1.0">

 <deployment>

  <dependencies>

   <module name="org.dom4j" />

  </dependencies>

 </deployment>

</jds:jboss-deployment-structure>

相关推荐

  • 检查Java中正则表达式中模式的第n次出现

    CheckfornthoccurrenceofpatterninregularexpressioninJava本问题已经有最佳答案,请猛点这里访问。我想使用Java正则表达式检查输入字符串中特定模式的第n次出现。你能建议怎么做吗?这应该可以工作:MatchResultfindNthOccurance(intn,Patternp,CharSequencesrc){Matcherm=p.matcher…
    2024-05-271
0.032806s