Page 1 of 1

IllegalStateException:Duplicate fragment name spring_web

Posted: Wed Aug 28, 2013 2:27 am
by simplysurjya
Problem : When the admin jetty-demo is Run as Ant Build , this following exception is thrown :-
java.lang.IllegalStateException: Duplicate fragment name: spring_web for jar:file:/C:/Users/Surjya_N/.m2/repository/org/springframework/spring-web/3.2.2.RELEASE/spring-web-3.2.2.RELEASE.jar!/META-INF/web-fragment.xml and jar:file:/D:/DemoSite-3.0.0-GA-eclipse-workspace/eclipse-workspace/DemoSite/admin/target/admin/WEB-INF/lib/spring-web-3.2.2.RELEASE.jar!/META-INF/web-fragment.xml

Suggested Solution in Web :- Adding of the following in the admin pom.xml
<webAppConfig>
<allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
</webAppConfig>

Inspite of making the above mentioned entry in the pom.xml also , the aforesaid problem still persists.

Please help me start the admin jetty-demo server. The default port mentioned for it to start is 8081, but in my machine that port has already been taken up by McAfee Antivirus, hence i changed the port to a different port and whenever i change it to a different port the above mentioned IllegalStateException happens. Please help.

Re: IllegalStateException:Duplicate fragment name spring_web

Posted: Fri Oct 18, 2013 11:29 pm
by dean123363
if you are using maven2 for building, pls try maven3.

Re: IllegalStateException:Duplicate fragment name spring_web

Posted: Sun Oct 27, 2013 12:35 am
by SanjayB
using Maven 3 would not resolve your issue.. The root cause of the issue is while loading the application context the fragments within dependency jar files are also scanned . You can resolve the issue by following steps :
1]In the web.xml updated the web app tag as below :
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/j2ee"
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_3_0.xsd"
[/b]id="WebApp_ID" metadata-complete="true">

Make this change for both site and admin .....