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 not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Servlet not working" Watch "Servlet not working" New topic
Author

Servlet not working

Arun Shanmugham
Greenhorn

Joined: Oct 06, 2003
Posts: 15
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


Technical Architect (SCJP)
Ming Hu
Greenhorn

Joined: Mar 01, 2004
Posts: 25
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

Joined: Oct 06, 2003
Posts: 15
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

Joined: Oct 06, 2003
Posts: 15
Sorry the class name was give as
<servlet-class>
com.servlet.TestServlet
</servlet-class>
Ming Hu
Greenhorn

Joined: Mar 01, 2004
Posts: 25
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

Joined: Oct 06, 2003
Posts: 15
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet not working