• Post Reply Bookmark Topic Watch Topic
  • New Topic

@WebServlet and web.xml  RSS feed

 
Markus Schmider
Ranch Hand
Posts: 147
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,



I am playing with a jboss-javaee6-webapp project. Server: JBoss EAP 6.0

It is deployed as auth.war

When I annotate a servlet with




I can see the contents under http://localhost:8080/auth/Hello



Then I have tried to add Authentication with this web.xml:


The login works, but then I get
HTTP Status 404 - /auth/Hello


What is going on?
 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem seems to be like that of another post.

Please declare the servlet mapping in the web.xml and retry and see if it works.
 
Markus Schmider
Ranch Hand
Posts: 147
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

But is not the annotation supposed to work even in the presence of a web.xml?
 
Ishan Pandya
Ranch Hand
Posts: 228
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What basically are you trying to do??
and what do you mean by <role-name>*</role-name> ???

Do you have a role name called "*" in you user.xml file(If you are using tomcat then tomcat-user.xml)??
 
Ron McLeod
Saloon Keeper
Posts: 1432
207
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By having metadata-complete="true" in web.xml, you are telling the container not to scan for annotations (@WebServlet("/Hello") will be ignored). Either add the servlet mapping into the web.xml file, or remove metadata-complete="true" attribute.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!