0

Im trying to deploy an application to Openshift server, but I get a strange error there, and it does not want to deploy my war file. the error states:

Caused by: java.lang.IllegalArgumentException: The servlets named [AdminUIServlet] and [GalleryUIServlet] are both mapped to the url-pattern [/admin/*] which is not permitted

The thing is my mappings are different and when I run the project localy this works. Here are mymappings in the code:

@WebServlet(urlPatterns = "/*", name = "GalleryUIServlet", asyncSupported = true)

@WebServlet(urlPatterns = "/admin/*", name = "AdminUIServlet", asyncSupported = true)

How is this error possible? How can I fix this?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Marko
  • 151
  • 1
  • 13

1 Answers1

0

One of the reasons this happens is because you have duplicate entries for your web.xml and your annotations.

Try removing the <servlet-mapping> section from your web.xml and see if that clears up your problem.

ref:

  1. http://examples.javacodegeeks.com/enterprise-java/tomcat/tomcat-web-xml-configuration-example/

  2. The servlets named [create_subscription] and [servlet.create] are both mapped to the url-pattern [/create] which is not permitted

Community
  • 1
  • 1
  • This is a no. My web xml contains only this: productionMode true – Marko Feb 22 '16 at 07:01
  • Did you check for web.xml in the both the webserver and in the war file? You can have the servlet-mapping in the deployment(war file) as well as specified in the Webserver itself. If you still can't find the duplicate, remove your annotations, redeploy and look to see if you have servlets deployed at those locations. – Jay howell Feb 22 '16 at 20:36
  • Can you post your console or log file with the entire exception. The log will tell you where the parse error is. It will look something like "Parse error in application web.xml file at " – Jay howell Feb 22 '16 at 20:45