views:

237

answers:

1

I am trying to migrate my existing servlets and filters defined in web.xml file to @WebServlet and @WebFilter annotations on Glassfish V3 server.

Currently web.xml defined 12 servlets and 6 filters . Tried removing one servlet from web.xml file and added @WebServlet annotation to Java servlet file .

But having difficulty in accessing the servlet when ever my JSP trying to access Servlet Glassfish complains "Service Not Available".

basically Servlet and filter defined using annotations never identified by Glassfish Server 3.

Is this existing bug that annotations can not be used along with web.xml file ? Do we have any workaround.

I referred following Sun documentation to migrate web.xml to servlet 3 annotations

A: 

You've got to get your web.xml correct, below is the beginning of the web.xml you should use:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    metadata-complete="false" 
    version="3.0" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
ftravers