File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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.

web.xml:



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

Anyone encountered this issue?

Grtz,
Jim
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10242
    
168

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">


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!
 
 
subject: Servlet in JBoss 7