Tomcat can't find my servlets
Whenever i try to access one of my servlets via http://localhost:8080/photodb/servlet/dtic.photodb.webapp.PhotoList, I get a 404 error. I am using Tomcat 4.1.12, but i had no troubles in 4.1.10. Does Tomcat 4.1.12 require special configuration, or could something else be the cause of this problem?
Thanks in advance
Ryan
Hi,
Tomcat 4.1.12 has a bug fix done on the InvokerServlet. The InvokerServlet is responsible for serving the servlet requests. In all the previous versions the InvokerServlet will be enabled by default. In the latest version, it is commented out. You will have to uncomment this for your servlets to be serverd. The changes needs to be done in the <tomcat_home>/conf/web.xml file.
Uncomment the following lines
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
More details regarding the bug and the fix can be found at the following url
http://online.securityfocus.com/archive/1/292936/2002-09-21/2002-09-27/0
Thanks
Shanmugam.PL
Whenever i try to access one of my servlets via
http://localhost:8080/photodb/servlet/dtic.photodb.weba
p.PhotoList, I get a 404 error. I am using Tomcat
4.1.12, but i had no troubles in 4.1.10. Does Tomcat
4.1.12 require special configuration, or could
something else be the cause of this problem?
Thanks in advance
Ryan
Similar Messages
-
Tomcat can't find the servlets!
Hi!
I've just installed tomcat tomcat-5.5.16 with apache. Tomcat runs ok. It shows some samples (delivered with tomcat) under www.mywebsite.com/servlets-example and also www.mywebsite.com/jsp-examples. JSP files work perfectly, but when I try the servlets it can't find them:
www.mywebsite.com/servlets-examples/servlet/RequestHeaderExample Object not found!my classpath lokks like this:
/opt/SUNWappserver/jdk/lib:/opt/apache-tomcat/common/lib/servlet-api.jar:/opt/apache-tomcat/bin:/opt/apache-tomcat/webapps/servlets-examples/WEB-INF/classes:/opt/apache-tomcat/webapps/ROOT/WEB-INF/classesand web.xml looks like this:
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>and
<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The mapping for the invoker servlet -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>I changed the web.xml und conf and under WEB-INF.
I also changed server.xml to make tomcat work with apache on port 80.
What did I do wrong? What did I forget?
What is the difference between web.xml under conf and the ones under WEB-INF?
Thanks for any help.opt/SUNWappserver/jdk/lib:/opt/apache-tomcat/common/lib/servlet-api.jar:/opt/apache-tomcat/bin:/opt/apache-tomcat/webapps/servlets-examples/WEB-INF/classes:/opt/apache-tomcat/webapps/ROOT/WEB-INF/classes
May be ur classpath will be wrong try the classpath like this
;C:\Tomcat5\common\lib\servlet-api.jar;C:\Tomcat5\common\lib\jsp-api.jar;C:\Tomcat5\common\lib\log4j-1.2.9.jar;C:\Tomcat5\common\lib\mysql-connector-java-3.1.8-bin.jar;hello
Check out all the enteries in the web-xml file and the path in the environment variable i your system. -
Hello, i am from Argentina. i need URGENT help with tomcat, because i am developing my final thesis.
I have all my sources in
C:\jakarta-tomcat-5.0.16\webapps\tesis
C:\jakarta-tomcat-5.0.16\webapps\tesis\ (archivos jsp)
C:\jakarta-tomcat-5.0.16\webapps\tesis\lib
C:\jakarta-tomcat-5.0.16\webapps\tesis\web-inf\classes\edu\tesis\beans
C:\jakarta-tomcat-5.0.16\webapps\tesis\web-inf\classes\edu\tesis\queries
C:\jakarta-tomcat-5.0.16\webapps\tesis\web-inf\classes\fede\servlets
my problem is that when i execute the login.jsp through the browser in this way
http://localhost:8080/tesis/login.jsp
tomcat can�t find the edu.tesis.beans package
In compiled jsp class i can see this
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import edu.tesis.beans.*;
so, the problem is that tomcat set package org.apache.jsp; to my jsp, so it can�t find edu.tesis.beans package.
This is my context path that is in $CATALINA_HOME/conf/server.xml file
<Context path="/tesis" docBase="C:\tomcat\webapps\tesis"
debug="9"
reloadable="true"
crossContext="true"/>
This is an extraction of my jsp file
<html>
<head>
<%@page import="edu.tesis.beans.*"%>
</head>
<body>
<jsp:useBean id="universidad" class="edu.tesis.beans.Universidad" scope="request" />
<form action="servlets/fede.servlets.ServletMaxwell" method="post"><BR><BR><BR><BR>
PLEASE, I NEED AN URGENT HELP!!!!
THANKS,
FEDERICOTampoco te preocupes porque Tomcat cambie el paquete de las p�ginas jsp. Eso es un comportamiento normal. Adem�s nota que el paquete de tu tesis es importado en la clase generada a partir del jsp, o sea que deberia encontrarla si est� en el lugar correcto.
Otra cosa que veo extra�a en tu estructura de directorios es que existe un directorio "lib" por fuera de WEB-INF. Si este contiene beans en forma de paquetes jar, deberia estar dentro de WEB-INF -
Hello-
I am trying to use JSP to call a bean and it keeps telling me that it could not compile because...
"Class org.apache.jsp.DataBaseSelect not found."
All my files are located in the webapps/ROOT under my own directory called "project".
DataBaseSelect is the name of my class file. This class file is located in the following directory...
jakarta-tomcat-4.0.1/webapps/ROOT/project/WEB-INF/classes/DataBaseSelect.class
My JSP page is located here...
jakarta-tomcat-4.0.1/webapps/ROOT/project/test.jsp and it calls the bean by using this statement...
<jsp:useBean id="select" class="DataBaseSelect" scope="request">
</jsp:useBean>
Do I need to do something to the WEB-INF/web.xml file to tell it about my bean? Do I need to make my bean part of a package somehow? Why does the compiler think my bean is part of "org.apache.jsp"?
Note: I have gotten a straight JSP (no bean) page to work in this same directory.
Please help and thanks for the effort...
ZacI took the advice of both posts above and have made some progress... Now it seems Tomcat can find my bean but I am getting this error...
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot create bean of class DataBaseSelect
at org.apache.jsp.test$jsp._jspService(test$jsp.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)
root cause
java.lang.ClassCastException: DataBaseSelect
at org.apache.jsp.test$jsp._jspService(test$jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484) -
Tomcat can't find existing file
Hello,
unfortunately i keep getting the following error:
Servlet /tomcat-docs threw load() exception
javax.servlet.ServletException: Service not available (propertyFile not loadable:Can't find properties file /usr/share/tomcat4/webapps/tomcat-docs/../webapps/ROOT/conex/WEB-INF/properties/cp.xmlWhat annoys me about it is that the file cp.xml exists in the very directory. Any ideas how something like this can happen?The best way to do it is to use the methods of ServletContext.
ServletContext.getRealPath("WEB-INF/properties/cp.xml")
This method turns a website relative url into a real file location on the disk. It makes your web app independant of where it is deployed.
The other useful method is ServletContext.getResourceAsStream("/pathtoresource") which returns an input stream to the resource. This call will succeed even if the application is in a WAR file, where the path returned by getRealPath() may not be as easily accessible.
ServletContext application = getServletConfig().getServletContext();
String filename = application.getRealPath("WEB-INF/properties/cp.xml")
File inFile = new File (filename);Cheers,
evnafets -
Where can i find javax.servlet.http.httpServletRequest in weblogic jars
Hi,
i'm migrating from weblogic 8 to weblogic 10.3.
in my java codes, i use import javax.servlet.http.httpServletRequest. Previously this package can in found in weblogic.jar in weblogic 8.
However weblogic.jar for 10.3 does not have this package. Where can i find this package?
Thanksoh i see. the api.jar has the indicate the path to the servlet package.
/modules/javax.servlet_1.0.0.0-2-5.jar.
Thanks for the guidance.:) -
Tomcat 5 can�t find javax.servlet.http.HttpServlet
Hi.
I don�t know if this is a simple question or not, but i didn�t find anything solving this problem and
i�m new to tomcat......
I�m trying to deploy my web application in my system. (Windows XP , j2sdk1.4.2_02, jakarta Tomcat 5, jakarta struts 1.1 and jakarta taglibs 1.1).No problems while compiling the .java classes and checked all the .jar files that my application needs to work (or that is what I think). I expand my .war file at /webapps on tomcat directory and startup Tomcat. Tomcat starts up but while starting I get the following errors...
17-feb-2004 17:58:50 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
17-feb-2004 17:58:51 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 4948 ms
17-feb-2004 17:58:51 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
17-feb-2004 17:58:51 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.18
17-feb-2004 17:58:51 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
17-feb-2004 17:58:51 org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
17-feb-2004 17:58:51 org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:C:\softProyecto\Tomcat5\conf\Catalina\localhost\admin.xml
17-feb-2004 17:58:55 org.apache.commons.digester.Digester endElement
GRAVE: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:123)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:520)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:906)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:527)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1008)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:394)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
it seems like C:\softProyecto\Tomcat5\conf\Catalina\localhost\admin.xml (C:\softproyecto\tomcat5 = tomcat�s home directory) needs javax.servlet.http.HttpServlet. And that comes from a Tomcat .jar file, i think.
After more and more messages..... here it comes my application (MapasRuido)...which needs javax.servlet.http.HttpServlet and compiled ok at compiling time!
INFO: Installing web application at context path /MapasRuido from URL file:C:\softProyecto\Tomcat5\webapps\MapasRuido
17-feb-2004 18:02:48 org.apache.catalina.startup.HostConfig deployDirectories
GRAVE: Error durante el despliegue del directorio MapasRuido de la aplicaci�n web
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1296)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1230)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1677)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:900)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1350)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1230)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1677)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:900)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1350)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1230)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:979)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3960)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4283)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:638)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:320)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:875)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:727)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:477)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1008)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:394)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
17-feb-2004 18:02:48 org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path from URL file:C:\softProyecto\Tomcat5\webapps\ROOT
17-feb-2004 18:02:48 org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /servlets-examples from URL file:C:\softProyecto\Tomcat5\webapps\servlets-examples
17-feb-2004 18:02:48 org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /tomcat-docs from URL file:C:\softProyecto\Tomcat5\webapps\tomcat-docs
17-feb-2004 18:02:49 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
tomcat�s web applications servlets-examples and tomcat-docs work fine, but my application doesn�t. Is there any relation between those errors? any idea about what happens?
Thank you in advance."...The CLASSPATH is ignored by Tomcat, of course. AND javac. AND java. AND Eclipse. AND NetBeans. AND JBuilder. And just about everything else in the Java universe..."
What I mean by this, of course, is that each of these requires you to set the CLASSPATH in the way they expect. None of them even looks for a system environment variable named CLASSPATH. You can waste a lot of time thinking that your CLASSPATH is "all set", but it's not.
Tomcat assumes the following for your Web app's CLASSPATH:
(0) The JDK rt.jar, of course,
(1) All the JARs in TOMCAT_HOME/common/lib,
(2) All the JARs in your WEB-INF/lib,
(3) All the .class files in your WEB-INF/classes
That's it. (Maybe one or two others, but those are the important ones.)
Eclipse and NetBeans have their own way to set CLASSPATH for each project. You'll have to learn how for those IDEs.
The CLASSPATH is still vitally important. The system environment variable just isn't part of it. - MOD -
In Tomcat's example, how can it find HelloWorldExample servlet?
I looked up the examples/web-inf/web.xml, but I cann't find the mapping info for HelloWorldExample servlet. When I browse the servlets/index.html and click Execute HelloWorld, how can Tomcat find it?
I use Tomcat 3.3.2
The file is in:
tomcat_dir/webapps/examples/WEB-INF/classes
See the file server.xml in:
tomcat_dir/conf -
Tomcat can't find servlet class
Hello,
I am trying to forward information from a jsp page to a servlet (the example in JSPIntro.pdf). I keep getting the error that the servlet class can't be found. I have put it in webapps/examples/web-inf/classes. I also added the servlet name in several web.xml files in different directories to no avail. Can anyone give me a hint on setup.
Thanksto setup correctly the servlet you need something like this int the web.xml
<servlet>
<servlet-name>yourservlet</servlet-name>
<servlet-class>xx.yyy.zzz.yourservlet</servlet-class>
<init-param>
</servlet>
and you must put the class under
WEB_INF/lib/xx/yyyy/zzz directory of your context.
the servlet must be called as
http://yourhost/yourcontext/servlet/yourservlet
hope it helps,
Giovanni -
Can't find the servlets package when compiling
Hi,
My problem is that when I compiling my servlets so can't the compiler find the two packages javax.servlet and javax.servlet.http.
Why?
Please can someone help me with this problem!
HelloServlet.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
HelloServlet.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;OK,
It seems like it will work with your proposal to. But now I have a new problem that you maybe can solve for me. That is when I try to test the following (from the book More Servlets and JavaServer Pages):
Test 3: A Servlet That Uses Packages and Utilities
The final servlet you should test to verify the configuration of your server and development environment is one that uses both packages and utility classes. HelloServlet3.java is a servlet in the moreservlets package that uses the ServletUtilities class to simplify the generation of the DOCTYPE (specifies the HTML version--useful when using HTML validators) and HEAD (specifies the title) portions of the HTML page. Those two parts of the page are useful (technically required, in fact), but are tedious to generate with servlet println statements.
Since both the servlet and the utility class are in the moreservlets package, they should go in the moreservlets directory. If you get compilation errors, go back and check your CLASSPATH settings--you most likely forgot to include the top-level development directory. I've said it before, but I'll say it again: your CLASSPATH must include the top-level directory of your package hierarchy before you can compile a packaged class that makes use of another class from the same package. This requirement is not particular to servlets; it is the way packages work on the Java platform in general. Nevertheless, many servlet developers are unaware of this fact, and it is one of the (perhaps the) most common errors beginning developers encounter.
Once you compile HelloServlet3.java (which will automatically cause ServletUtilities.java to be compiled), put HelloServlet3.class and ServletUtilities.class in install_dir/webapps/ROOT/WEB-INF/classes/moreservlets. Then, access the servlet with the URL http://localhost/servlet/moreservlets.HelloServlet3. You should get a simple HTML page that says "Hello (3)".
This works not for me! I will get this message when I try to compile HelloServlet3.java:
C:\Apache-Tomcat-4.1.27\ServletsDevel>javac HelloServlet3.java
HelloServlet3.java:23: cannot resolve symbol
symbol : variable ServletUtilities
location: class moreservlets.HelloServlet3
out.println(ServletUtilities.headWithTitle(title) +
^
1 error
Do you know what the problem is? -
Tomcat won't "find" my servlet
After an afternoon of studying various documentation and downloading stuff, I managed to get the Java SDK and Tomcat running. I've hit a problem though (aside from Tomcat not starting up as described in the documentation - I could not find startup.sh at all, but I found an executable in /usr/bin that seemed to do the job quite nicely). I put a compiled servlet (a hello world thing copied from an O'Reilly book) in the right place, started Tomcat and accessed http://localhost:8080/servlet/HelloWorld . I got this error:
HTTP Status 404 - /servlet/HelloWorld
type Status report
message /servlet/HelloWorld
description The requested resource (/servlet/HelloWorld) is not available.
Apache Tomcat/4.1
I would be grateful if anyone would tell me what I am doing wrong.
Thanks :)I have had similar problems and what I found was pretty annoying feature of Tomcat, that is I was using log4j in my servlet but I didn�t put log4j.jat in {context}\WEB-INF\lib folder. Tomcat didn�t indicate anything related to the missing 3-third party library, instead it was complaining about some EOFException.
Another thing to look for is making sure that the URL specified in browser matches your web.xml mapping that is:
http::/localhost/servlet/blah should have corresponding item in web.xml file like this:
<servlet>
<servlet-name>Servlet_Blah</servlet-name>
<display-name>Servlet Blah</display-name>
<description>Default configuration created for servlet.</description>
<servlet-class>BlahServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet_Blah</servlet-name>
<url-pattern>/servlet/blah</url-pattern>
</servlet-mapping>
Janusz -
How can I find the servlet class name from inside a ServletFilter?
Ive implemented a servlet filter, but need to discover the class name of any servlet class that gets executed.
Ive dug through the spec and cant seem to find any path to do this.
Seems the methods needed to do this have been deprecated. (for security reasons?)
Is there any way to write a ServletFilter to grab this info?
If not, is there any other way to capture every servlet execution in the container, time its execution, and log the class name along with the execution time?
(***WITHOUT*** requiring a classpath over ride of any container provider classes)
Any help is much appreciated. Been banging my head against this for some time now :(request.getServletPath() returns the part of the URL which refers to the servlet. It isn't the classname of the servlet but it should be a reasonable surrogate. If you log that, then you could write some code which reads your web.xml and uses the servlet-mapping elements to convert it to servlet class names later.
-
Tomcat can't find oracle classes12.jar what to do?
hi,
i have managed to come this far with my "simple" webapplication under tomcat that i can see the application startpage but when i click browse the following
exception is thrown:
java.lang.NoClassDefFoundError: oracle/sql/NUMBER
since i have tried to put the classes12.jar in every reasonable directory without effect, i have to bother this forum. does anyone know "where the dog is burried"(german saying)?
greetz
Selim KeserI'm sorry I wasn't clear.
I have a feeling you might not have to do this because you wouldn't have gotten so far without knowing how.
"chown" is a command in UNIX like systems to change the owner of a file or directory.
When I was having problems similar to yours, I noticed that all of the files that I copied onto my server listed the owner as root and the group as root.
The version of Tomcat I am running on Linux requires that the files be owned by "apache". So by changing to the directory where the files in question are located, you can run the UNIX command "chown apache:apache *" and it will change the owner/group to apache.
If you're running in some other OS (Windows) I can't really help since I've never successfully installed and invoked Tomcat on Windows.
HTH.
Thanks, George -
Hi
I have my JAVA_HOME set to C:\j2sdk1.4.1_01
I have just upgraded my jdk. Tomcat now won't load anymore since I upgraded. It says that it can't load the JVM. Any suggestions?
ThanksYou need to Upgrade u r Tomcat!!
-
I'm using mysql as my db in a web app. I've put the mysql jar file in WEB-INF/lib of my app and I'm using org.gjt.mm.mysql.Driver in my call to Class.forName() but when I try to access the db I get a no driver available message. Can anyone offer an idea of what I'm missing?
Is the driver class being loaded correctly? People often have something like this:try {
Class.forName("org.gjt.mm.mysql.Driver");
} catch(ClassNotFoundException e) {
}and then they have no idea whether the class was loaded or not.
Maybe you are looking for
-
I can import my HD Videocamera movie into my MACBookpro and edit it with imovie 6 and then "burn" the HD movie back to my video camera. I then use the camera to play beautiful HD on my HDTV using an HDMI cable. However this is a real pain. Is there a
-
Positioning of spry sub menu in IE8
Hi - can anyone help with an IE8 issue concerning Spry? I have created a menu here: http://www.clinicafiore.co.uk/jan2012/indexJan2012_1.html In all the browsers I have tested (Chrome,FF,Safari,Opera) on Mac and PC platforms it works fine. In IE8 it
-
DBMS_SQL array processing - ORACLE 8.0.6
It's been a while since I've used this. DEFINE_ARRAY - the last parameter is "lower bound", which is the starting point. If it's set to 1, rows will be placed in the array starting with 1 and ending with the last row fetched. The entire result set fr
-
"Open With Explorer" of Document LIbrary not working
HI All, My doucment library "open with explorer" is not working.Can any one help mw how can I solve the issue Samar
-
I am unable to restart my computer and install updates because it asks me to quit safari. When I try to "quit safari" it won't let me click on it. It's not highlighted in black....just stays gray. What can I do to remedy this?