Reputation: 6842
I'm trying to assign a controller to a URL and my descriptor is:
<?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">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<servlet-mapping>
<servlet-name>application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
It throws the following error:
java.lang.RuntimeException: There is no web component by the name of application here.
Upvotes: 2
Views: 5322
Reputation: 4078
As the error message is telling you, there's no such component found. You should add a servlet description with the class of your controller, like:
<servlet>
<servlet-name>application</servlet-name>
<servlet-class>my.package.MyController</servlet-class>
</servlet>
Upvotes: 3