Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet not working

 
Arun Shanmugham
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I wanted to port an application from Tomcat to JBoss. I was getting error in executing the servlet. Then i just created a simple application with 1 servlet in new.war which has the following structure
/Test.html
/WEB-INF/classes/com/servlet/TestServlet
/web.xml (this maps com.servlet.TestServlet to Test)
When i tried http://localhost/new/Test.html it works.
When i tried http://localhost/new/servlet/Test it does'nt work and
the error from
 
Ming Hu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like a mapping error. Can you show us the content of your <servlet-mapping> tags? What happens if you try http://localhost/new/Test ?
 
Arun Shanmugham
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is my servlet mapping part in jboss-service.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>
Test
</servlet-name>
<servlet-class>
com.see.rep.servlet.TestServlet
</servlet-class>
</servlet>
</web-app>
Thanks for your reply.
Arun
 
Arun Shanmugham
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry the class name was give as
<servlet-class>
com.servlet.TestServlet
</servlet-class>
 
Ming Hu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any mapping. Can you add following to your xml file:
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/newtest/*</url-pattern>
</servlet-mapping>
and, try http://localhost/new/newtest ?
 
Arun Shanmugham
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem was solved ... Servlet Invoker was commented by default in JBoss web.xml file. I have uncommented it and it works now.

Cheers
Arun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic