2

I was trying to deploy a spring MVC project to WebLogic 12c but I was hit by this error.

[HTTP:101380]There is more than one Web fragment with the same name: "spring_web".

This is my 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>

And this is my 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>

Any help will be greatly appreciated.

Alien
  • 15,141
  • 6
  • 37
  • 57
Chi Yung Pang
  • 23
  • 1
  • 1
  • 4

4 Answers4

3

Unzip the .war generated by maven, and compare this to the one Eclipse generates. Usually you have to tell maven to exclude packages from certain artifacts otherwise these will be packaged twice (that is almost what the error is saying - that the deployer already encountered a component with a certain name, and it does not make sense to do that twice)

Note : Above given solution is a possible solution if you are building the project with maven.

Alien
  • 15,141
  • 6
  • 37
  • 57
  • Thanks this is the correct answer. It was due to duplicated spring libraries. Had included it in the lib folder of the project as well as a referenced shared library in the project properties. – Chi Yung Pang Sep 20 '18 at 09:12
3

I had this problem, and discovered it was arising from duplicate JAR files. I had different versions of the same JARs in the WAR file.

Running mvn clean fixed this.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
0

I had the same issue with spring-boot when I changed version from 2.1.6 to 2.0.6. Running a mvn clean and building the application again resolved my issue.

MRTJ
  • 141
  • 7
0

See our solution at More than one fragment with the name [spring_web] was found / Cannot find the declaration of element 'beans' / server without internet access which involved a combination of removing bad spring versions in xsd tags in context files and adding absolute-ordering to the web.xml. Turns out the duplicate spring dependencies don't actually need to exist, they can just be referenced in context to cause problems.

DavesPlanet
  • 576
  • 5
  • 14