Bonjour,
J'essaie de découvrir Tomcat et les servlets et j'ai un pb de config :
Mon serveur Tomcat semble pourtant bien démarrer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Etat HTTP 404 - /ServletTomcat/tata type Rapport d'état message /ServletTomcat/tata description La ressource demandée (/ServletTomcat/tata) n'est pas disponible. Apache Tomcat/5.5.17
Dans le manager mon chemin /ServletTomcat est à "true"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 2 mai 2006 16:06:57 org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home/admindg/Applis/Java/jre/lib/i386/client:/home/admindg/Applis/Java/jre/lib/i386:/home/admindg/Applis/Java/jre/../lib/i386:/home/admindg/workspace/NetJukeBox/JMF-2.1.1e/lib/: 2 mai 2006 16:06:57 org.apache.coyote.http11.Http11BaseProtocol init INFO: Initialisation de Coyote HTTP/1.1 sur http-8080 2 mai 2006 16:06:57 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1437 ms 2 mai 2006 16:06:57 org.apache.catalina.core.StandardService start INFO: Démarrage du service Catalina 2 mai 2006 16:06:58 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.17 2 mai 2006 16:06:58 org.apache.catalina.core.StandardHost start INFO: XML validation disabled 2 mai 2006 16:07:00 org.apache.catalina.core.ApplicationContext log INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]] 2 mai 2006 16:07:00 org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() 2 mai 2006 16:07:00 org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() 2 mai 2006 16:07:00 org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() 2 mai 2006 16:07:00 org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() 2 mai 2006 16:07:01 org.apache.coyote.http11.Http11BaseProtocol start INFO: Démarrage de Coyote HTTP/1.1 sur http-8080 2 mai 2006 16:07:01 org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 2 mai 2006 16:07:01 org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/47 config=null 2 mai 2006 16:07:01 org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource 2 mai 2006 16:07:01 org.apache.catalina.startup.Catalina start INFO: Server startup in 4181 ms
et j'utilise ce web.xml dans eclipse projet ServletTomcat/WEB-INF
Le code de la servlet est un banal helloworld pour le moment ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <servlet> <servlet-name>Servlet</servlet-name> <servlet-class>Servlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Servlet</servlet-name> <url-pattern>/titi</url-pattern> </servlet-mapping> <servlet> <servlet-name>tata</servlet-name> <servlet-class>Test</servlet-class> </servlet> <servlet-mapping> <servlet-name>tata</servlet-name> <url-pattern>/tata/*</url-pattern> </servlet-mapping> </web-app>
Et pour le moment mes recherche google ne m'aide pas ... Si qqu'un a une idée, elle est bienvenue
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") public class Test extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter writer = res.getWriter(); writer.println("Hello World !!!"); } }
Merci d'avance
Dom.
Partager