Hi Please help me on this. This is urgent. I am using jboss-3.2.1_tomcat-4.1.24 version and I made a simple web application and put the war file in JBOSS\server\default\deploy directory. WEB-INF\web.xml WEB-INF\classes\TestServlet is my directory structure of my war and my web.xml is <?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>TestServlet</servlet-name> <servlet-class>TestServlet</servlet-class> </servlet> </web-app> If i start the jBoss, I see my test.war being deployed fine. But, if Iaccess it as http://localhost:8080/test/servlet/TestServlet froma browser, I get a 404 error and jBoss console says "mapping error for URI /test/servlet/TestServlet" I then tried adding a servlet-mapping to my web.xml by adding <servlet-mapping> <servlet-name>TestServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> Now, if I access using the URL http://localhost:8080/test/, it goes to the testServlet page. I need to add more serlvlets now. This mapping is not right. Books i read say that without mapping itself, we should be able to access the servlet, but I always get 404 and mapping error of URI. What do i do. Please help me soon.
Have you tried http://localhost:8080/test/TestServlet? You can then add more servlets like this: <servlet> <servlet-name>TestServlet</servlet-name> <servlet-class>TestServlet</servlet-class> </servlet> <servlet> <servlet-name>TestServlet2</servlet-name> <servlet-class>TestServlet2</servlet-class> </servlet> <servlet-mapping> <servlet-name>TestServlet</servlet-name> <url-pattern>/TestServlet</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>TestServlet2</servlet-name> <url-pattern>/TestServlet2</url-pattern> </servlet-mapping> Hope it helps.
Hi I did try http://localhost:8080/test/TestServlet. It also said the same mapping URI error. Now I fixed by doing what you said, having a <url-mapping> for all of them. I consider this to be a hack. It works, but this not the way we usually do when we use tomcat seperately right. With just <servlet></servlet> mapping it would work, if the class is in application/classes dir. Why does it not work so with JBoss implementation now? Thanks
I do not have any package where classes are. I just have 2 servlet's .class file in WEB-INF/classes directory. No packages. So my web.xml just lists them both and I am not able to access as I could do in tomcat by http://localhost:8080/<app>/servlet/servletname I had to put explicit url-mapping to eac of them now. Why?
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, that will fit in a stocking