RE: Loggin out using JDBC realms
On Fri, 31 Aug 2001, PHAM,TAM (HP-Vancouver,ex1) wrote: Regarding logging out of JDBC realms. This does not seem ideal if I have to explicitly call session.invalidate() when the user logs out. Tam, You can use javascript to fire session.invalidate() in case the user closes browser window (ie. does not use you log-out link). And regarding automatic expiration after given period of time you should be able to put following in your web.xml: session-config session-timeout30/session-timeout !-- timeout in minutes -- /session-config If you want to run your own code in case of automatic session expiration then I hope this article helps: http://w6.metronet.com/~wjm/tomcat/2001/Jan/msg00703.html with best wishes, Taavi
How to access X509 Certificate?
Hey all, I'm trying to access the certificate that the user has sent to authenticate himself. I'm using the Tomcat/Apache combo. Apache correctly exports the Certificate to the SSL_CLIENT_CERT environment variable, but when I try to read javax.servlet.request.X509Certificate, Tomcat always returns null. The list of attributes is always empty. I've uncommented JkHTTPSIndicator HTTPS, JkSESSIONIndicator SSL_SESSION_ID, JkCIPHERIndicator SSL_CIPHER, JkCERTSIndicator SSL_CLIENT_CERT and set JkExtractSSL to On. I'm sure the Ajp13 protocol is used since I've disabled everything else. What am I missing here? Any help greatly appreciated! Thanks in advance, Christoph.
Tomcat can't open my bd.properties file
Hi: I have Tomcat 3.2.2 running over Debian Potato and I'm trying to install a simple JSP application with database access. I've got a connection pool that works fine when I run it directly with java. In the root of my classes directory I have a couple of files, a log file called ServidorConexiones.log and the properties file bd.properties. classes/ServidorConexiones.log classes/bd.properties.log classes/com/ishop/sql/ServidorConexiones.class classes/com/ishop/sql/PoolConexiones.class The source file for the Connection manager is sources/com/ishop/sql/ServidorConexiones.java And reads the bd.properties with these sentences... public class ServidorConexiones { /** * pNombre del fichero de propiedades empleado para la definición de los * pools. */ static private String properties = bd.properties; ...MORE CODE HERE... /** * pConstructor privado que inicializa el servidor y todos sus pools * asociados. Definiendo el constructor como privado se garantiza el * comportamiento Singleton de la clase. Las demás clases deberán * acceder a la instacia del servidor a través del método * codegetInstance/code. */ private ServidorConexiones() { Properties prop = new Properties(); try { prop.load(new FileInputStream(properties)); } catch (Exception e) { System.err.println(Error opening + properties + file: + e); return; } ...CONTINUES... As I said before, when I run my test applications from de classes directory directly with java it works fine. Then, for testing with JSP, I copy the classes directory to: jakarta-home/webbapps/isHOP/WEB-INF After restarting Tomcat, my JSP test application fail opening the bd.properties file: Error opening bd.properties file: java.io.FileNotFoundException: bd.properties (No such file or directory) What should I do to make this file available for Tomcat? Any help will be greatly appreciated. Thanks, Quique
WEB-INF and META-INF
Hi, I have installed tomcat last week on our solaris server. I included a new context called trialserv in server.xml file. Context path=/trialserv docBase=/usr/local/etc/httpd/trialserv crossContext=false debug=0 reloadable=true /Context Afetr restarting the server I found the below given entries for the above context in the mod_jk.config-auot file # The following line makes apache aware of the location of the /trialserv context # Alias /trialserv /usr/local/etc/httpd/trialserv Directory /usr/local/etc/httpd/trialserv Options Indexes FollowSymLinks /Directory # # The following line mounts all JSP files and the /servlet/ uri to tomcat # JkMount /trialserv/servlet/* ajp12 JkMount /trialserv/*.jsp ajp12 # # The following line prohibits users from directly accessing WEB-INF # Location /trialserv/WEB-INF/ AllowOverride None deny from all /Location # # The following line prohibits users from directly accessing META-INF # Location /trialserv/META-INF/ AllowOverride None deny from all /Location # but when actually checked the usr/local/etc/httpd/trialserv directory, I could find neither WEB-INF nor META-INF under it. Then I stored a Hello.class under trialserv just for the checking purpose. When I tried to browse at http://myservername/trialserv/Hello;, got the below mentioned error, Not Found (404) Original request: /trialserv/servlet/Hello Not found request: /trialserv/servlet/Hello Could any one help me in telling what for this META-INF AND WEB-INF are, and how to get them created under the context. For the default context like admin and example they are available. Thanks in anticipation Jayesh. Do You Yahoo!? Send a newsletter, share photos files, conduct polls, organize chat events. Visit http://in/ groups.yahoo.com
NullPointerException running JSP samples in Cobalt RaQ4 tomcat installation
Hi, I'm pulling my hair out over this... Set up is Cobalt RaQ4 Sun Cobalt Developer Kit for Java (jdk 1.3.1 tomcat 3.2.1) I have two tests that fail: All samples in webapps/examples An html file call test.jsp in webapps/examples/jsp/ (file contains just html) The jsp seems to compile find, but fails like this: java.lang.NullPointerException at jsp._0002fjsp_0002ftest_0002ejsptest_jsp_1._jspService(_0002fjsp_0002ftest_0 002ejsptest_jsp_1.java:66) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection (Ajp12ConnectionHandler.java:166) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) The only config mods we have made following standard installation of the package is in workers.properties - set java_home tomcat_home and ps Turning on full debug info, the test.jsp gets compiled like this: 2001-09-01 09:03:56 - Compiling with: -encoding UTF8 -classpath /usr/java/jakarta-tomcat/lib/ant.jar: /usr/java/jakarta-tomcat/lib/jasper.jar: /usr/java/jakarta-tomcat/lib/jaxp.jar: /usr/java/jakarta-tomcat/lib/parser.jar: /usr/java/jakarta-tomcat/lib/servlet.jar: /usr/java/jakarta-tomcat/lib/test: /usr/java/jakarta-tomcat/lib/webserver.jar: /usr/java/jdk/lib/tools.jar: : .: /usr/java/jakarta-tomcat/lib/servlet.jar: /usr/interclient/interclient.jar: /usr/java/jakarta-tomcat-3.2.1/webapps/examples/WEB-INF/classes: null: /usr/java/jakarta-tomcat-3.2.1/work/localhost_8080%2Fexamples Any help much appreciated Thanks Martin Imerge Limited Tel :- +44 (0)1954 783600 Unit 6 Bar Hill Business Park Fax :- +44 (0)1954 783601 Saxon Way Web :- http://www.imerge.co.uk Bar Hill Cambridge CB3 8SL United Kingdom
Re: [TC3.3b1] use of taglib causes org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not found error
Take the XML related jars in TOMCAT_HOME/lib and rename them to x[whatever].jar (for example, xjaxp.jar). Then put Velocity's XML parsers in TOMCAT_HOME/lib. I know it's a kludge, but AFAICT, these sorts of classloader issues have been corrected in 4.0. (Which is all the Struts people can't understand why their stuff suddenly DOESN'T work - all the Struts WAR's come without any parser libraries.) w Paul Spencer wrote: I am getting the following error while using Jetspeed with Tomcat 3.3-b1. This error does NOT occur in Tomcat 3.3-m4! [Fri Aug 31 22:19:33 EDT 2001] -- ERROR -- Error rendering Velocity template: /controllers/html/multicolumn.vm: Invocation of method 'getContent' in class org.apache.jetspeed.portal.controls.VelocityPortletControl threw exception class javax.xml.parsers.FactoryConfigurationError : Provider org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not found In addition the .java file created in the work directory is has a size of 0 bytes. I copied crimson.jar and jaxp.jar to the lib/apps directory, as suggested in http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg13224.html , but that did not work. My jsp file is below (Note this file work in Tomcat v3.3-m3 and -m4): %@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' % p bJSP/b Hello World! bServer date:/b jetspeed:info requestedInfo=ServerDate / /p Ideas? Thank you Paul Spencer
4.0 b7 how to do JDBC
OS ver Solaris 8 In BUILDING.txt it says the Servlet 2.3/JSP 1.2 API classes FIXME: Properties for mail.jar, activation.jar, jdbc2_0-stdext.jar, jta-spec1_0_1.jar, tyrex-0.9.7.0.jar In the build.properties and build.xml it never referances the JDBC driver. My question are: * Because 4.0 is not including the jars will I be able to connect to a Oracle db? * How can I include the jars in the build? * If not what are the work-a-arounds? Thanks Pete __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
Re: 4.0 b7 how to do JDBC
Peter Shankey [EMAIL PROTECTED] wrote: OS ver Solaris 8 In BUILDING.txt it says the Servlet 2.3/JSP 1.2 API classes FIXME: Properties for mail.jar, activation.jar, jdbc2_0-stdext.jar, jta-spec1_0_1.jar, tyrex-0.9.7.0.jar In the build.properties and build.xml it never referances the JDBC driver. My question are: * Because 4.0 is not including the jars will I be able to connect to a Oracle db? * How can I include the jars in the build? * If not what are the work-a-arounds? Include the DB driver of your choice in WEB-INF/lib into your web application, or in CATALINA_HOME/lib, in the binary tree, and you're set... Those JARs are required at compile time... Pier
RE: howto mirror a jsp site.. convert ?/= to .do/param1/param2?
Hi Pier -- Sorry I guess I wasn't clear... getting the file with wget works fine.. all I do is: wget -m fullscreen.com But, what I get is a bunch of myfile.jsp?param=value files. moving this directory into apache doesn't work, b/c when the user requests the file /myfile.jsp?param=value apache looks for myfile.jsp, doesn't find it returns a 404. So, I'm wondering, is there some way to rewrite the param / values so that JSP understands them so that apache doesn't attempt to strip them away as parameters? I've seen struts apps other pages use this format: myfile.jsp;param=value I know that I can use servlet mapping to do something like myfile.do;/pathto/myfile.jsp;param=val;param2=value have the servlet servicing myfile.do rewrite the URLs into standard format. Perhaps thats what I'll do. I was just wondering if there is some way to get tomcat to do this automatically for a webapp. Thanks again- Matt FullScreen Delicious downloadable desktop delights WGET works for me... Just be sure to escape that ? character in the query string... Do something like (quoted) # wget http://mysite.com/myfile.jsp?param=value; Or escaped: wget http://mysite.com/myfile.jsp\?param=value
Segmentation Fault when modifying classpath?!
Ok... All this surrounds modifying tomcat.sh per install instructions found in apache-soap. Per Apache-Soap's Getting Tomcat Ready, I have changed my classpath to put xerces.jar at the beginning of my classpath as follows: unset CLASSPATH CLASSPATH=/usr/local/java/lib/xerces.jar for i in ${TOMCAT_HOME}/lib/* ; do if [ $CLASSPATH != ]; then CLASSPATH=${CLASSPATH}:$i else CLASSPATH=$i fi done ... When starting tomcat I get the following: Using classpath: /usr/local/java/lib/xerces.jar: /opt/jakarta-tomcat-3.2.3/lib/activation.jar: /opt/jakarta-tomcat-3.2.3/lib/ant.jar: /opt/jakarta-tomcat-3.2.3/lib/jasper.jar: /opt/jakarta-tomcat-3.2.3/lib/LICENSE: /opt/jakarta-tomcat-3.2.3/lib/mail.jar: /opt/jakarta-tomcat-3.2.3/lib/servlet.jar: /opt/jakarta-tomcat-3.2.3/lib/soap.jar: /opt/jakarta-tomcat-3.2.3/lib/test: /opt/jakarta-tomcat-3.2.3/lib/webserver.jar: /opt/jakarta-tomcat-3.2.3/lib/xerces.jar: /usr/local/java/jdk1.3.1/lib/tools.jar /opt/jakarta-tomcat-3.2.3/bin/tomcat.sh: line 181: 12681 Segmentation fault $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat $@ I can not figure out for the life of me why this is happening. I've also tried setting the classpath from the shell with the exact same results. Any hints appreciated. Thanks, Al Calbazana
Unable to start tomcat 3.2.3 (Security related problem)
Hello, I have downloaded tomcat version 3.2.3 source code and compiled it on my windows 95 machine with Sun JDk 1.3.1. I also had to download JSSE because there was no option to compile without ssl support. If these classes are not in classpath then source doesn't compile. My problem is when after compiling distribution when I try to start tomcat following errors is produced: /// FATAL Configuration error: java.lang.SecurityException: sealing violation .. .. I have followed that steps provided in SSL howto about making entry in java security file and using keytool. For password it is written that password can be changeit but when keytool asks about alias tomcat password what should be entered. (i.e. what is the tomcat admin password). Please help me in solving above problem because I am unable to start tomcat. Is there any option to compile tomcat without ssl support? Sukhwinder Singh ___ Send a cool gift with your E-Card http://www.bluemountain.com/giftcenter/
finding sun.tools.javac.main?
PLEASE can someone help. I'm running the JDK1.3 and Tomcat 3.2.3. All the examples compile but, when I try to call up a simple JSP page, I get an error that it can't find sun.tools.javac.Main. I have C:\JDK1.3\LIB\TOOLS.JAR in BOTH the classpath and in the path (for Win 98) set in the autoexec.bat. I hunted down the 'offending' call and found this in SunJavaCompiler.java: import sun.tools.javac.Main; /** * The default compiler. This is the javac present in JDK 1.1.x and * JDK 1.2. * * At some point we need to make sure there is a class like this for * JDK 1.3, and other javac-like animals that people want to use. * * @author Anil K. Vijendran Is this the problem? Surely it's in tools.jar? So why can't Tomcat find it? I'm STUCK!! Someone out there help, please. Madeleine Wright
Re: [TC3.3b1] use of taglib causes org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not found error
I have made the changes suggested. I still get the same errors. The jsp file will work when referenced directly, http://localhost/jetspeed/hello.jsp, but fails when it is executed by Jetspeed. This problem is does not occur in Tomcat 3.3-m4 or Tomcat 4.0-b7. I suspect something that was changed between 3.3-m4 and 3.3-b1 is causing the problem, but I do not know what it is :-(. I do not believe the problem is with Jetspeed because I used the same WAR file when testing all 3 versions of Tomcat. The error message may not be related to the actual error. The empty .java file in the work directory may be the closer to the problem. Maybe somewhere in the process of converting from .jsp to .java when a taglib is defined. I enabled debug logging. No entries on the servlet logfile The jasper log contained: 2001-09-01 17:29:25 - Package name is: WEB_0002dINF.templates.jsp.portlets.html 2001-09-01 17:29:25 - Class file name is: E:\apache\jakarta-tomcat-3.3-b1\work\DEFAULT\jetspeed\WEB_0002dINF\templates\jsp\portlets\html\Example_1.class 2001-09-01 17:29:25 - Java file name is: E:\apache\jakarta-tomcat-3.3-b1\work\DEFAULT\jetspeed\WEB_0002dINF\templates\jsp\portlets\html\Example_1.java 2001-09-01 17:29:25 - Class name is: Example_1 2001-09-01 17:29:25 - Handling Directive: taglib {uri=/WEB-INF/templates/jsp/tld/template.tld, prefix=jetspeed} Ideas? Paul Spencer Will Stranathan wrote: Take the XML related jars in TOMCAT_HOME/lib and rename them to x[whatever].jar (for example, xjaxp.jar). Then put Velocity's XML parsers in TOMCAT_HOME/lib. I know it's a kludge, but AFAICT, these sorts of classloader issues have been corrected in 4.0. (Which is all the Struts people can't understand why their stuff suddenly DOESN'T work - all the Struts WAR's come without any parser libraries.) w Paul Spencer wrote: I am getting the following error while using Jetspeed with Tomcat 3.3-b1. This error does NOT occur in Tomcat 3.3-m4! [Fri Aug 31 22:19:33 EDT 2001] -- ERROR -- Error rendering Velocity template: /controllers/html/multicolumn.vm: Invocation of method 'getContent' in class org.apache.jetspeed.portal.controls.VelocityPortletControl threw exception class javax.xml.parsers.FactoryConfigurationError : Provider org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not found In addition the .java file created in the work directory is has a size of 0 bytes. I copied crimson.jar and jaxp.jar to the lib/apps directory, as suggested in http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg13224.html , but that did not work. My jsp file is below (Note this file work in Tomcat v3.3-m3 and -m4): %@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' % p bJSP/b Hello World! bServer date:/b jetspeed:info requestedInfo=ServerDate / /p Ideas? Thank you Paul Spencer
Tomcat and Input-Output streams
Hello again: Searching a little bit more I've founded the solution to my problem. Relying reading of the properties file to a PropertiesManager class with a method like: static { try { Class propertiesManagerClass = PropertiesManager.class; ClassLoader classLoader = propertiesManagerClass.getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream(PROPERTIES_FILE); properties = new Properties(); properties.load(inputStream); inputStream.close(); } catch (Exception e) { System.err.println(Error loading properties from file + PROPERTIES_FILE + : + e); e.printStackTrace(); } } everything works fine. My question now is, why? and, where can I get some information about Tomcat and the IO files? I realized that Tomcat writes my database log file to /etc/init.d/ (where the tomcat startup script is) I guess that with my previos implementation Tomcat searched for the bd.properties file in that same directory. Why Tomcat behaves like this? How can I control the exact location of my IO files? Thanks a lot, Quique Enrique Marcote Peña wrote: Hi: I have Tomcat 3.2.2 running over Debian Potato and I'm trying to install a simple JSP application with database access. I've got a connection pool that works fine when I run it directly with java. In the root of my classes directory I have a couple of files, a log file called ServidorConexiones.log and the properties file bd.properties. classes/ServidorConexiones.log classes/bd.properties.log classes/com/ishop/sql/ServidorConexiones.class classes/com/ishop/sql/PoolConexiones.class The source file for the Connection manager is sources/com/ishop/sql/ServidorConexiones.java And reads the bd.properties with these sentences... public class ServidorConexiones { /** * pNombre del fichero de propiedades empleado para la definición de los * pools. */ static private String properties = bd.properties; ...MORE CODE HERE... /** * pConstructor privado que inicializa el servidor y todos sus pools * asociados. Definiendo el constructor como privado se garantiza el * comportamiento Singleton de la clase. Las demás clases deberán * acceder a la instacia del servidor a través del método * codegetInstance/code. */ private ServidorConexiones() { Properties prop = new Properties(); try { prop.load(new FileInputStream(properties)); } catch (Exception e) { System.err.println(Error opening + properties + file: + e); return; } ...CONTINUES... As I said before, when I run my test applications from de classes directory directly with java it works fine. Then, for testing with JSP, I copy the classes directory to: jakarta-home/webbapps/isHOP/WEB-INF After restarting Tomcat, my JSP test application fail opening the bd.properties file: Error opening bd.properties file: java.io.FileNotFoundException: bd.properties (No such file or directory) What should I do to make this file available for Tomcat? Any help will be greatly appreciated. Thanks, Quique
Tomcat 4 and JNDI Question
How can I set java.naming.factory.initial java.naming.provider.url java.naming.factory.url.pkgs I have tried putting a jndi.properties file in common/classes, common/lib, WEB-INF/classes, and WEB-INF/lib - didn't work. I have also tried modifing catalina.sh as below else $JAVA_HOME/bin/java $CATALINA_OPTS -classpath $CP \ -Dcatalina.home=$CATALINA_HOME \ -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory \ -Djava.naming.provider.url=jnp://localhost:1099 \ -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces \ org.apache.catalina.startup.Bootstrap $@ start \ $CATALINA_HOME/logs/catalina.out 21 fi Still didn't work. Any Ideas? THanks, G.C. Miller
Re: Is there a way to get the docBase property from within aservlet?
On Mon, 27 Aug 2001, Rick Mann wrote: Date: Mon, 27 Aug 2001 20:28:17 -0700 From: Rick Mann [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Is there a way to get the docBase property from within a servlet? Is there a Servlet spec-compliant way to get the webapp's directory's path programmatically, from within a servlet? No. Something like calling ServletConfig.getInitParameter(docBase), but something that's standard, and that does not require me to specify the path explicitly in a configuration file? You are starting from an incorect assumption, that there *is* such a thing as a portable directory path to a web application. It is entirely legal for a servlet container to run a web application directly from a WAR file (in which case there is no expanded directory), or by storing its static resources in some other sort of structure (such as being BLOB objects in a database). TIA, Rick Craig McClanahan
Re: Possible problem with HttpServletResponse.encodeURL behavior inCatalina
The only way to debug such a problem is to see the *actual* stack trace you are encountering. Can you post it? Craig McClanahan On Tue, 28 Aug 2001 [EMAIL PROTECTED] wrote: Date: Tue, 28 Aug 2001 14:15:13 +0200 From: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Possible problem with HttpServletResponse.encodeURL behavior in Catalina Hello, We have been experiencing a strange behavior of Catalina's implementation of HttpServletResponse.encodeURL() Application calls to this method (from a servlet running in Catalina) sometimes cause a NullPointerException. This occurred apparently at random, especially in situations where multiple calls to this methods were made in a short timespan. Tracing the exception showed that the reference to the the exception was caused by the implementing class in Catalina loosing the reference to the HttpServletResponse object. We experienced this problem with tomcat 4.0-b1, 4.0-b5 and 4.0-b7 (which are all versions we worked with). We would appreciate any help on this issue. Many thanks Mikhael Janson MyComponents.com
Re: internal server error
On Tue, 28 Aug 2001, Scott Knight wrote: Date: Tue, 28 Aug 2001 08:23:05 -0400 From: Scott Knight [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: internal server error I have a question that hopefully someone on this list can help with. I use the startup.sh and shutdown.sh scripts to start and stop tomcat. If i stop tomcat and then bring it back up and go and try to view a servlet I get an internal server error from apache, like tomcat really isnt up yet or something. But if i then hit refresh on my brower like 7 or 8 times tomcat will start responding like normal. I saw a message on the same topic of this in the mail archives but I didnt see a definite answer. Anyone know why this is? And is there any way to stop this? Without details of the server components you are running (Apache version? Tomcat version?) and the actual servlet being tested, and the *actual* error messages and/or stack traces you are receiving, it is impossible for *anyone* to give you any substantive help on this. Second question is about auto reloading. I use ant to create my war files so they are of the standard directory layout. After tomcat starts and unpacks the war I should be able to copy recompiled classes into the MyProject/WEB-INF/classes directory and have tomcat auto reload (server.xml says that auto reload is default to true ) This works most of the time. But sometimes i swear it wont reload my servlet until i stop tomcat, remove the unpacked war directory and restart tomcat. This doesn't make any sense to me? What Tomcat are you running? Tomcat 3.2.x has lots of problems recognizing updated classes that are not themselves servlets -- Tomcat 4.0 fixes this particular issue. Also one last semi related question. Can someone tell me how tomcat decides what servlets to cache in memory? *All* Java classes that are your servlets (or are referenced by your servlets) are loaded once by the appropriate class loader. This is a Java thing, not a Tomcat thing. If it is really auto reloaded servlets, if i delete all my class files i shouldnt be able to get to any servlets correct? No. If you have referenced a particular class *once*, it will have already been loaded into the JVM. The existence or non-existence of the .class file where this class was loaded from is not relevant. But i have deleted all my class files and still can get to certain servlets in my web app. So how does tomcat choose what servlets to cache or not? Any and all information that can help with these three questions would be greatly apprecaited. Thanks in advance. Scott Knight Craig
Re: context-param
On Tue, 28 Aug 2001, Mills, Theo wrote: Date: Tue, 28 Aug 2001 13:41:07 -0500 From: Mills, Theo [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: context-param Anyone know how to access an application-wide context-param from a servlet? The simplest way is to use a context parameter in your web.xml file: context-param param-nameglobal-name/param-name param-valueThis is the parameter value/param-value /context-param which you can retrieve from a servlet by calling: getServletContext().getInitParameter(global-name); NOTE: There are rules you *must* follow about the order of elements in your web.xml file -- see the Servlet Specification, which you can download from: http://java.sun.com/products/servlet/download.html Craig McClanahan
Re: Logging
Tomcat 3.2 does not create access log files in the format required for tools like WebTrands. You will need to do one of the following things: * Run Tomcat 3.2 behind a web server like Apache (which will create such log files for you). * Run Tomcat 4.0 in stand-alone mode (which will create such log files for you). Craig On Tue, 28 Aug 2001, Amit Anand wrote: Date: Tue, 28 Aug 2001 15:59:52 -0400 From: Amit Anand [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Logging Hello all, I am a new user to Tomcat and I needed help with probably a very small thing for you all. I would like a to keep a track of all IP's coming into my machine, all pages visited, etc. I am going to use WebTrends to analyze the logging information and put into report form. The question I have is, how would I go about doing this. The two logs I have seen, jasper.log and servlet.log do not give me any real good statistics. Remember I am not a developer so I have no clue how to do this. I am running Tomcat 3.2.3 on Solaris 8. Thank you very much for your help!! Amit Anand [EMAIL PROTECTED]
Re: Security question
On Wed, 29 Aug 2001, Achim Baier wrote: Now my question: Am I wrong-minded, is it bug or is it a jsp/servlet/j2ee-feature? Any comments? Security constraints that you mention in your web.xml deployment descriptor are *only* applied to the original request URI, *not* to any request URI that is included by your servlet or JSP page. That is by design. If the content from a particular include should not be displayed to a particular user (because they don't have a required role), you should not be doing the include in the first place. Thanks in advance, Achim Craig McClanahan
Re: urgent : using Mail Resource in web.xml
Can you try putting mail.jar into common/lib? That way, it is available to both the Catalina internal classes (including the resource factory) and your web app? Craig McClanahan On Thu, 30 Aug 2001, Christoph Rooms wrote: Date: Thu, 30 Aug 2001 20:00:53 +0200 From: Christoph Rooms [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: urgent : using Mail Resource in web.xml hi, I'm trying to get a mail session I define in the web.xml resource-ref descriptionDefault Mail/description res-ref-nameTheMailSession/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref And I call it in my java code like : Context initial = new InitialContext(); Session session = (Session) initial.lookup(java:comp/env/TheMailSession); This is the exception I get : A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Servlet execution threw an exception at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) 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.ja va:219) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:472) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) 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:2251) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) 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:5 66) 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: 984) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1074 ) at java.lang.Thread.run(Thread.java:484) Root Cause: java.lang.NoClassDefFoundError: javax/mail/Session at org.apache.naming.factory.MailSessionFactory$1.run(MailSessionFactory.java:1 63) at java.security.AccessController.doPrivileged(Native Method) at org.apache.naming.factory.MailSessionFactory.getObjectInstance(MailSessionFa ctory.java:147) at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory. java:165) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:307) at org.apache.naming.NamingContext.lookup(NamingContext.java:835) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:350) at rnb.SendMail.doGet(SendMail.java:21) at rnb.SendMail.doPost(SendMail.java:78) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at
Re: Is there a way to get the docBase property from within a servlet?
On Sat, Sep 01, 2001 at 09:48:10PM -0700, Craig R. McClanahan wrote: On Mon, 27 Aug 2001, Rick Mann wrote: Date: Mon, 27 Aug 2001 20:28:17 -0700 From: Rick Mann [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Is there a way to get the docBase property from within a servlet? Is there a Servlet spec-compliant way to get the webapp's directory's path programmatically, from within a servlet? No. getServletConfig().getServletContext().getRealPath(/); Of course it won't work within a .war file.. Something like calling ServletConfig.getInitParameter(docBase), but something that's standard, and that does not require me to specify the path explicitly in a configuration file? You are starting from an incorect assumption, that there *is* such a thing as a portable directory path to a web application. It is entirely legal for a servlet container to run a web application directly from a WAR file (in which case there is no expanded directory), or by storing its static resources in some other sort of structure (such as being BLOB objects in a database). Most websites are not static. Users publish content, for example, and the logical place for that content to be stored is on the filesystem inside the webapp, not in a database. So for many, or not most, websites, the notion that a website can be kept in a .war is not practical. I'd be interested to know if there is a solution to this. Perhaps the filesystem could be mapped to a JNDI context, which could be made into a virtual filesystem inside the webapp? --Jeff TIA, Rick Craig McClanahan