Problem calling servlet.

I have a servlet called TestServlet. I don't have it in a package at the moment.

When I try and call it with this URL - http://localhost:8080/test/servlet/TestServlet

It comes back not found - HTTP Status 404 - /test/servlet/TestServlet

My web.xml looks like this -

<?xml version="1.0" encoding="UTF-8"?>

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

<web-app>

<servlet>

<servlet-name>TestServlet</servlet-name>

<display-name>Simple Session Servlet</display-name>

<servlet-class>TestServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>TestServlet</servlet-name>

<url-pattern>/servlet/TestServlet</url-pattern>

</servlet-mapping>

<session-config>

<session-timeout>0</session-timeout>

</session-config>

</web-app>

I am deploying to JBoss, I have verified that my war file (test.war) has been deployed and my servlet is in the web-inf\classes directory.

[1260 byte] By [psurossa] at [2007-10-3 9:21:57]
# 1
I would put it into a package. I've seen other folks on here not getting the servlets to execute and when they put them into a package all was well.-S
slenzia at 2007-7-15 4:35:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I already tried it in a package with same results.
psurossa at 2007-7-15 4:35:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
so keep it in a package it will avoid future issues.How is Jboss startup log about your app?
alban.maillerea at 2007-7-15 4:35:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I put the servlet in a package and modified the web.xml to reflect that change.

<web-app>

<servlet>

<servlet-name>TestServlet</servlet-name>

<display-name>Simple Session Servlet</display-name>

<servlet-class>test.TestServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>TestServlet</servlet-name>

<url-pattern>/TestServlet</url-pattern>

</servlet-mapping>

</web-app>

The war file deploys without issue. When I look in the tmp/deploy directory, the war file is expanded as anticipated. The servlet class is in \jboss\server\default\tmp\deploy

The URL http://localhost:8080/test/TestServlet returns - HTTP Status 404 - /test/TestServlet

2006-11-09 11:05:58,343 DEBUG [org.jboss.deployment.MainDeployer] Begin deployment start file:/C:/jboss/server/default/deploy/test.war

2006-11-09 11:05:58,343 DEBUG [org.jboss.system.ServiceController] starting service jboss.web.deployment:war=test.war,id=1926876278

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.WebModule] Starting jboss.web.deployment:war=test.war,id=1926876278

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] webContext: null

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] warURL: file:/C:/jboss/server/default/tmp/deploy/tmp40761test-exp.war/

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] webAppParser: org.jboss.web.AbstractWebDeployer$DescriptorParser@1b9bbf6

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.WebPermissionMapping] Qualified url patterns: {/=PatternInfo[pattern=/,type=3,isOverriden=false,qualifiers=[]]}

2006-11-09 11:05:58,343 INFO [org.jboss.web.tomcat.tc5.TomcatDeployer] deploy, ctxPath=/test, warUrl=.../tmp/deploy/tmp40761test-exp.war/

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] AbstractWebContainer.parseWebAppDescriptors, Begin

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Creating ENC using ClassLoader: java.net.FactoryURLClassLoader@e33b57

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] ..org.jboss.mx.loading.UnifiedClassLoader3@1dd63a8{ url=file:/C:/jboss/server/default/tmp/deploy/tmp40761test-exp.war/ ,addedOrder=73}

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] ..org.jboss.system.server.NoAnnotationURLClassLoader@1cb25f1

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] ..sun.misc.Launcher$AppClassLoader@a39137

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] ..sun.misc.Launcher$ExtClassLoader@92e78c

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Unable to retrieve orbjavax.management.InstanceNotFoundException: jboss:service=CorbaORB is not registered.

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Linked java:comp/UserTransaction to JNDI name: UserTransaction

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] addEnvEntries

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkResourceEnvRefs

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkResourceRefs

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkMessageDestinationRefs

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkEjbRefs

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkEjbLocalRefs

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkServiceRefs

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] linkSecurityDomain

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] No security-domain given, using default: java:/jaas/other

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Linking security/securityMgr to JNDI name: java:/jaas/other

2006-11-09 11:05:58,343 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] AbstractWebContainer.parseWebAppDescriptors, End

2006-11-09 11:05:58,375 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Using session cookies default setting

2006-11-09 11:05:58,390 INFO [org.apache.catalina.startup.ContextConfig] Missing application web.xml, using defaults only StandardEngine[jboss.web].StandardHost[localhost].StandardContext[/test]

2006-11-09 11:05:58,390 DEBUG [org.jboss.web.tomcat.filters.ReplyHeaderFilter] Adding header name: X-Powered-By='Servlet 2.4; JBoss-4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231751)/Tomcat-5.5'

2006-11-09 11:05:58,406 DEBUG [org.jboss.web.tomcat.tc5.TomcatDeployer] Initialized: {WebApplication: /C:/jboss/server/default/tmp/deploy/tmp40761test-exp.war/, URL: file:/C:/jboss/server/default/tmp/deploy/tmp40761test-exp.war/, classLoader: java.net.FactoryURLClassLoader@e33b57:14891863} jboss.web:j2eeType=WebModule,name=//localhost/test,J2EEApplication=none,J2EEServer=none

2006-11-09 11:05:58,406 DEBUG [org.jboss.web.WebModule] Started jboss.web.deployment:war=test.war,id=1926876278

2006-11-09 11:05:58,406 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.web.deployment:war=test.war,id=1926876278 dependent components: []

2006-11-09 11:05:58,421 DEBUG [org.jboss.webservice.ServiceDeployer] handleNotification: org.jboss.deployment.SubDeployer.start,test.war

2006-11-09 11:05:58,421 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: test.war

2006-11-09 11:05:58,421 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/jboss/server/default/deploy/test.war

2006-11-09 11:06:17,734 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000

psurossa at 2007-7-15 4:35:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Just to be clear, the servlet deploys to \jboss\server\default\tmp\deploy\tmp40761test-exp.war\Web-inf\classes\test
psurossa at 2007-7-15 4:35:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
PROBLEM SOLVEDWeb-inf is supposed to be WEB-INF
psurossa at 2007-7-15 4:35:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...