【问题标题】:[HTTP:101380]There is more than one Web fragment with the same name: "spring_web"[HTTP:101380]有多个同名Web片段:“spring_web”
【发布时间】:2019-02-18 18:55:19
【问题描述】:

我试图将 Spring MVC 项目部署到 WebLogic 12c,但遇到了这个错误。

[HTTP:101380]有多个同名Web片段: “spring_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" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

<display-name>spring-mvc-demo</display-name>

<!-- Spring MVC Configs -->

<!-- Step 1: Configure Spring MVC Dispatcher Servlet -->
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring-mvc-demo-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<!-- Step 2: Set up URL mapping for Spring MVC Dispatcher Servlet -->
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

这是我的 weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
    <wls:weblogic-version>12.1.3</wls:weblogic-version>
    <wls:context-root>spring-mvc-demo</wls:context-root>
</wls:weblogic-web-app>

任何帮助将不胜感激。

【问题讨论】:

    标签: eclipse spring-mvc weblogic12c


    【解决方案1】:

    解压 maven 生成的 .war 文件,并将其与 Eclipse 生成的文件进行比较。通常你必须告诉 maven 从某些工件中排除包,否则这些包将被打包两次(这几乎就是错误所说的 - 部署者已经遇到了一个具有特定名称的组件,并且这样做两次没有意义)

    注意:如果您使用 maven 构建项目,上述给出的解决方案是一个可能的解决方案。

    【讨论】:

    • 谢谢这是正确的答案。这是由于重复的弹簧库。已将其包含在项目的 lib 文件夹以及项目属性中引用的共享库中。
    【解决方案2】:

    我遇到了这个问题,发现它是由重复的 JAR 文件引起的。我在 WAR 文件中有相同 JAR 的不同版本。

    运行 mvn clean 修复了这个问题。

    【讨论】:

      【解决方案3】:

      当我将版本从 2.1.6 更改为 2.0.6 时,我遇到了与 spring-boot 相同的问题。 运行 mvn clean 并再次构建应用程序解决了我的问题。

      【讨论】:

        【解决方案4】:

        More than one fragment with the name [spring_web] was found / Cannot find the declaration of element 'beans' / server without internet access 上查看我们的解决方案,其中包括删除上下文文件中 xsd 标记中的不良 spring 版本以及向 web.xml 添加绝对排序。事实证明,重复的 spring 依赖项实际上并不需要存在,它们可以在上下文中被引用来导致问题。

        【讨论】:

          猜你喜欢
          • 2019-12-28
          • 2019-08-06
          • 2019-06-14
          • 1970-01-01
          • 2019-08-17
          • 2019-10-09
          • 1970-01-01
          • 2015-10-05
          相关资源
          最近更新 更多