File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes Servlet in JBoss 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Servlet in JBoss 7" Watch "Servlet in JBoss 7" New topic

Servlet in JBoss 7

Jim Pouwels
Ranch Hand

Joined: Feb 22, 2012
Posts: 61
Hi Guys,

I'm trying to get a simple servlet working in JBoss 7.

First, i got my servlet:

The CDI bean is just a simple POJO with one method (getGreeting()).

The problem is the web.xml in my war file. When I include one, the servlet is not available.


When I remove the web.xml from the WAR file, then the servlet becomes available.

Anyone encountered this issue?

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "">

The presence of that dtd version for your web application indicates that you will be using 2.3 version of web-app which doesn't support annotation based servlets (or other web components). So you'll have to change that web.xml to instead use the latest version:

[My Blog] [JavaRanch Journal]
Jim Pouwels
Ranch Hand

Joined: Feb 22, 2012
Posts: 61
That fixed the problem. Tnx!
I agree. Here's the link:
subject: Servlet in JBoss 7
It's not a secret anymore!