Reputation: 23
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.
Upvotes: 2
Views: 13226
Reputation: 1
In my case: I had a dependency in pom.xml of one of my jar files with explicit version number. instead of that I used
<version>${project.version}</version>
and problem has gone!
Upvotes: 0
Reputation: 794
Weblogic is reading the next META-INF/web-fragment.xml located inside spring-web jars, and it found it more than one times. This is because spring-web jar exists more than 1 time.
Check whether you have duplicates of spring-web jar, and remove those duplicates.
Upvotes: 0
Reputation: 680
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.
Upvotes: 0
Reputation: 139
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.
Upvotes: 0
Reputation: 197
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.
Upvotes: 3
Reputation: 15898
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.
Upvotes: 3