Search code examples
servletsjakarta-eeejbwebclientmanaged-bean

Java EE servlet error - duplicate URL pattern


I'm in the process of making a prototype banking application for one of my assignments. I've successfully created the persistence API, EJBs, and all required tables. However, when I create the WebClient for my application and integrate that with the Enterprise application and try to run it, I get the following error:

java.lang.IllegalArgumentException: Servlet [RegistrationPortImpl] and Servlet [RegistrationRequesterPortImpl] have the same url pattern

The WebClient only has the default index.xhtml file on it and I have not yet integrated to managed beans with it.

I just wanted to check if my application would run after the integration with enterprise application before I make any advances.


Solution

  • You can add the entry metadata-complete=true in the web-app tag like this:

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      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"
      version="3.0"
      metadata-complete="true">
    

    This post suggests something similar. This entry disabled the scan for Servlet 3.0 specific annotations and web-fragments in /WEB-INF/lib. See here, here and here.

    Maybe you could check the URL patterns in your web.xml and what libraries your app use.