0

I'm using Wildfly 10 and try to deploy my web app on it. The problem is that servlet isn't deployed if it is annotated with @WebServlet(name = "/testServlet") annotation. Still it is deployed when I make servlet mapping in web.xml (I use JavaEE 7, so I want to map servlets with annotation). My web.xml looks like

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

</web-app>

, so I mentioned 3.1 webapp. I checked classes in my .war archieve and there exists servlet class.

Can you help me with the problem?

Sergei Podlipaev
  • 1,331
  • 1
  • 14
  • 34

2 Answers2

2

Annotate your servlet with name and urlpatterns . Please provide more details on the issue. @WebServlet(name = "testing", urlPatterns = {"/testing"})

johnsi george
  • 208
  • 3
  • 12
0

I have found error declaring the servlet. It seems like I didnt defined its url-pattern. The way to do this is to annotate it like @WebServlet(name = "TestServlet", urlPatterns = "/testServlet")

Sergei Podlipaev
  • 1,331
  • 1
  • 14
  • 34