RE: ELF data encoding not big-endian
The Apache folks don't seem to distribute Linux/PPC libraries, just Linux/Intel; and SuSE doesn't package Apache/Tomcat on PPC. So, while you can use the Java classes and any other files you've already downloaded, you'll need to build mod_jk.so (and any other libraries you need) yourself. You can get the source at, http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/src/ and compile the right mod_jk.c for your version of Apache. -- Bill K. -Original Message- From: Jonathon Wallen [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 6:57 AM To: [EMAIL PROTECTED] Subject: ELF data encoding not big-endian Hi all, I've got tomcat running fine independent of apache and now I want the two to work together... I've downloaded the binary of mod_jk.so and put it in the libexec directory, edited the server.xml file and got the mod_jk.conf-auto thing happening.. now, after starting tomcat, when I try to start apache it dies with this error - Cannot load /usr/local/apache/libexec/mod_jk.so into server: /usr/local/apache/libexec/mod_jk.so: ELF file data encoding not big-endian I'm using Suse7.0 ppc on a macintosh blue white G3, apache 1.3.20 and tomcat-3.2.3 can anyone help with this? many thanks, -- - - Jonathon Wallen - B,DES College of Fine Arts, UNSW - [EMAIL PROTECTED] -
RE: ELF data encoding not big-endian
Thanks Bill for your prompt reply, At the URL you've given I can see the source for tomcat and the API but not mod_jk.. is the source for mod_jk bundled within the tomcat file? Sorry, it's in jakarta-tomcat-3.2.3-src.*, under src/native/ . Will I need to build tomcat as well or just mod_jk? You should only have to rebuild native executable code--i.e., the *.c files--not Java classes or other files. The Makefile in each directory containing a *.c file should work for you. -- Bill K. -Original Message- From: Jonathon Wallen [mailto:[EMAIL PROTECTED]] Sent: Friday, August 10, 2001 8:17 AM To: [EMAIL PROTECTED] Subject: RE: ELF data encoding not big-endian The Apache folks don't seem to distribute Linux/PPC libraries, just Linux/Intel; and SuSE doesn't package Apache/Tomcat on PPC. So, while you can use the Java classes and any other files you've already downloaded, you'll need to build mod_jk.so (and any other libraries you need) yourself. You can get the source at, http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/src/ and compile the right mod_jk.c for your version of Apache. -- Bill K. Thanks Bill for your prompt reply, At the URL you've given I can see the source for tomcat and the API but not mod_jk.. is the source for mod_jk bundled within the tomcat file? Will I need to build tomcat as well or just mod_jk? again, many thanks. -- - - Jonathon Wallen - B,DES College of Fine Arts, UNSW - [EMAIL PROTECTED] -
RE: Using Tomcat with MSAccess
snip / .equals(passwd) rather than passwd.equals( ) snip / No you shouldn't. That's totally evil. For a start, you're creating another String object by doing snip/ remark As is a constant string, it is created just once. So there is not much overhead. True, other than the overhead of calling String.intern() when the class is loaded (JLS 3.10.5). (.equals might be even faster, because the jit can inline the method call, as the address of the object and the equals method is constant in this case. False. If the compiler can inline equals(), it can inline length(), too. (In fact, it's more likely to inline length(), since it's a far simpler method.) (And take a look at the source for String.equals(): at best, with comparable inlining of the two methods, you've added an instanceof and a downcast, which likely swamps any time taken for the rest of the comparison.) -- Bill K.
RE: Further documentation
- JDBCRealm, how to use in an applet (Did you really mean use JDBCRealm in an applet? Tomcat doesn't run applets, only servlets,...) Did you read the online Tomcat docs? http://jakarta.apache.org/tomcat/ (Pick the version of Tomcat you're using under Documentation on the left side.) Or at the servlet spec? http://java.sun.com/products/servlet/download.html (web.xml is described there, and in web.dtd which is shipped with Tomcat.) -- Bill K. -Original Message- From: Andreas Horchler [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 09, 2001 1:38 AM To: Tomcat-User Subject: Further documentation Hello, As Tomcat is a new topic for me, I am looking for further documentation on it. I am looking for documentation on the following topics. - ContextInterceptor, RequestInterceptor and Connectors as they are configured in server.xml - JDBCRealm, how to use in an applet - user authentication with tomcat (declaration in web.xml and coding in the servlet) Can anyone give me a hint where to find the documents where these topics are handled ? I have already read the Tomcat UsersGuide and Sun's Servlet specification, but these things are not explained in way that I can work with it. Thanks for help Andreas
RE: two tomcats on one pc
Yes, as you say. You'll need a separate server.xml file for each instance, setting the ports uniquely across all instances. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 09, 2001 7:38 AM To: [EMAIL PROTECTED] Subject: two tomcats on one pc hi, is it possible to run two instances of tomcat on one pc. one instance for internals and one for the www. i thought of using two different ports... ist this possible? greets bastian
RE: Using Tomcat with MSAccess
This is pretty far off the topic of servlets--sorry to have added to it. But you can get the source for String.java (and most of the java.* packages) in the JDK, in a file called src.jar. Suffice it to say that, since String.equals() checks for pointer equality and object type, then downcasts, and then compares lengths, String foo; if (.equals(foo)) ... will never be faster than, if (foo != null foo.length() == 0) since equals() does the exact same thing, plus some (possibly ellided) type comparison and downcasting. Plus, it's rarely what you want: most of the time, you want to treat empty string and null the same, and non-empty strings differently. So you actually want, if (foo == null || foo.length() == 0) But, if you were testing for a _specific_ string, if (Test Me.equals(foo)) _is_ a nice short-hand that avoids testing for null first. It's still slower in the case of a null string, than, if (foo != null foo.equals(Test Me)) for the reasons listed above; but it's better for non-null strings, and it's at least as easy to understand. -- Bill K. -Original Message- From: Beth Kelly [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 09, 2001 9:50 AM To: [EMAIL PROTECTED] Subject: Re: Using Tomcat with MSAccess Kyle Wayne Kelly (504)391-3985 http://www.cs.uno.edu/~kkelly - Original Message - From: William Kaufman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 09, 2001 7:14 AM Subject: RE: Using Tomcat with MSAccess snip / .equals(passwd) rather than passwd.equals( ) snip / No you shouldn't. That's totally evil. For a start, you're creating another String object by doing snip/ remark As is a constant string, it is created just once. So there is not much overhead. True, other than the overhead of calling String.intern() when the class is loaded (JLS 3.10.5). (.equals might be even faster, because the jit can inline the method call, as the address of the object and the equals method is constant in this case. False. If the compiler can inline equals(), it can inline length(), too. (In fact, it's more likely to inline length(), since it's a far simpler method.) I wonder if equals() is implemented with a bitwise and. If that were the case, then the first invocation of equals would be simpler than the length method (that is with delayed lazy evaluation). (And take a look at the source for String.equals(): at best, with comparable inlining of the two methods, you've added an instanceof and a downcast, which likely swamps any time taken for the rest of the comparison.) -- Bill K.
RE: JDBC
Tomcat doesn't do JDBC. Tomcat comes with optional classes (like JDBCRealm) which do, but those are extensions. So the answer is, it comes with all the JDBC drivers it needs, which is none. If _your_ code uses JDBC, _you'll_ need to get the driver(s) you want yourself. -- Bill K. -Original Message- From: Michael Johnson [mailto:Michael Johnson] Sent: Thursday, August 09, 2001 1:48 PM To: [EMAIL PROTECTED] Subject: JDBC Does Tomcat have all the necessary JDBC drivers installed to successfully connect to a mysql database? I will be installing Tomcat on Linux Mandrake 8with Apache shortly. And I will be developing JSP programs that use MySql. Thanks, Michael Johnson - This message was sent using Endymion MailMan. http://www.endymion.com/products/mailman/
RE: Using Servlet in different path then /examples/servlets/
Try adding a url-pattern element to your web.xml. The servlet spec details the format of web.xml: http://java.sun.com/products/servlet/download.html -- Bill K. -Original Message- From: Yuval [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 08, 2001 8:24 AM To: Tomcat-User (E-mail) Subject: Using Servlet in different path then /examples/servlets/ Hi, How can I run servlet on my web server on different path than /examples/servlets/ I tried to define: Context path=/ docBase=C:/InetPub/wwwroot crossContext=false debug=0 reloadable=true /Context and its not working. Regards, Yuval Domain The Net Technologies Ltd. 6 Weitzman Blvd. Ramat-Hasharon Israel 47211 Tel: 972-3-5474443 Fax: 972-3-5474446 www.DomainTheNet.com This email message and any attachments hereto are intended only for use by the addressee(s) named above, and may contain legally privileged and/or confidential information. If you are not the intended addressee, you are hereby kindly notified that any dissemination, distribution or copying of this email and any attachments hereto is strictly prohibited. If you have received this email in error, kindly delete it from your computer system, and notify us at the telephone number or email address appearing above. Thank you
RE: Getting the user environment variable::Need help
1) This isn't a Tomcat question: if you'd done the same in a java application, you'd have found the same thing. There are forums, newsgroups, and mailing lists for Java questions. 2) You're confusing environment variables with properties. Properties are defined either by loading them from a properties file, or by specifying them on java's command line (with -D). 3) There is a method, System.getenv(), to get environment variables, but it's deprecated (the whole concept of environment variables is incredibly OS-specific). So you really _should_ be using properties, or context-param elements defined in your application's web.xml. Look at java.util.Properties for the former, and the servlet spec for the latter. -- Bill K. -Original Message- From: Nilanjan Das [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 7:12 AM To: tomcat jakarta Subject: Getting the user environment variable::Need help Hi, I am on HP-UX and trying to access one user environment varaible from the Java code using System.getProperty() method but it is returning NULL. Can anyone point out why? This is what I did: $export TEST=testing $echo $TEST testing But when I execute System.getProperty(TEST) from my code, it returns NULL. Can any of you help? Thanks, Nilanjan
RE: Servlet/ Database Conenction Persists Question
I have developed a servlet web application which connects to a database to retrieve information. I noticed that if within my servlet I destroy the connection to the database there is no way to reconnect to the database . Maybe this is a JSP thing (I'm not too familiar with those), and JSPs have some weird JDBC cover methods. But you _should_ be able to disconnect, by calling Connection.close(); and to reconnect, the same way you connected the first time. Why can't you reconnect? Are you getting an exception from DriverManager.getConnection()? Is keeping the persistent connection to the database a heavy burden on tomcat? Persistent connections aren't a burden on Tomcat, but might be on your database, especially if the modifications aren't committed immediately. You should always try to close connections (and other resources) if you don't think you'll be using it again in a few seconds. I don't believe my question pertains specifically to Tomcat, so I was wondering whether or not any of you knew where there are list servers which deal with servlets in general. This mailing list is fine for general servlet questions. But this seems to be a JDBC question,... -- Bill K. -Original Message- From: A.L. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 9:07 AM To: [EMAIL PROTECTED] Subject: Servlet/ Database Conenction Persists Question I have developed a servlet web application which connects to a database to retrieve information. I noticed that if within my servlet I destroy the connection to the database there is no way to reconnect to the database . In other words I need to keep my connection to the database at all times that tomcat is up. My questions include: Is this correct that there is no way to reconnect to the database? If this is not correct, how does one reconnect, and or reinitialize the servlet? Is keeping the persistent connection to the database a heavy burden on tomcat? In other words, is it o.k. to design an application which never releases its conenction to the database? I don't believe my question pertains specifically to Tomcat, so I was wondering whether or not any of you knew where there are list servers which deal with servlets in general. __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
RE: Servlet/ Database Conenction Persists Question
This is not really a jdbc issue. What is happening is that my code specifies that the conenction to the database is made only during the init of the servlet and the conenction is closed after the servlet is destroyed. Ah, OK. Don't do that. init() is called exactly once, when the servlet gets loaded. If you want to close and re-allocate the connection, do it in your doGet()/doPost()/doWhatever() methods (if you've overridden those) or in your service() method (if you didn't): connect at the beginning, commit/rollback and close at the end (preferrably in a finally block, to make sure it gets done). -- Bill K. -Original Message- From: A.L. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:27 AM To: [EMAIL PROTECTED] Subject: RE: Servlet/ Database Conenction Persists Question This is not really a jdbc issue. What is happening is that my code specifies that the conenction to the database is made only during the init of the servlet and the conenction is closed after the servlet is destroyed. I think that my problem is that once I destroy the servlet, I can't figure a way to re initialize it. Simply refreshing the servlet page doesn;t seem to work. --- William Kaufman [EMAIL PROTECTED] wrote: I have developed a servlet web application which connects to a database to retrieve information. I noticed that if within my servlet I destroy the connection to the database there is no way to reconnect to the database . Maybe this is a JSP thing (I'm not too familiar with those), and JSPs have some weird JDBC cover methods. But you _should_ be able to disconnect, by calling Connection.close(); and to reconnect, the same way you connected the first time. Why can't you reconnect? Are you getting an exception from DriverManager.getConnection()? Is keeping the persistent connection to the database a heavy burden on tomcat? Persistent connections aren't a burden on Tomcat, but might be on your database, especially if the modifications aren't committed immediately. You should always try to close connections (and other resources) if you don't think you'll be using it again in a few seconds. I don't believe my question pertains specifically to Tomcat, so I was wondering whether or not any of you knew where there are list servers which deal with servlets in general. This mailing list is fine for general servlet questions. But this seems to be a JDBC question,... -- Bill K. -Original Message- From: A.L. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 9:07 AM To: [EMAIL PROTECTED] Subject: Servlet/ Database Conenction Persists Question I have developed a servlet web application which connects to a database to retrieve information. I noticed that if within my servlet I destroy the connection to the database there is no way to reconnect to the database . In other words I need to keep my connection to the database at all times that tomcat is up. My questions include: Is this correct that there is no way to reconnect to the database? If this is not correct, how does one reconnect, and or reinitialize the servlet? Is keeping the persistent connection to the database a heavy burden on tomcat? In other words, is it o.k. to design an application which never releases its conenction to the database? I don't believe my question pertains specifically to Tomcat, so I was wondering whether or not any of you knew where there are list servers which deal with servlets in general. __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
RE: Servlet/ Database Conenction Persists Question
If you don't want a database connection to persist, just don't keep it around. Your first option is to create it each time in your service routine, and close it before you return. A second option would be to keep it around (e.g., in a session attribute), and create it in your service routine only if it doesn't already exist. Then, you define a particular URL parameter: when you get that parameter, close the connection and null out the reference. There's no reason to change the definition of init() for this particular case. -- Bill K. -Original Message- From: A.L. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 1:23 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Servlet/ Database Conenction Persists Question Andrew, Thank you for your response. I appreciate you clarifying the topic, nevertheless it seems to me a little troubling to assume that the servlet should only be destroyed by the servlet. (I'm new to servlets, but by servlet engine, I am assuming you mean tomcat). Here is why. Lets say there is an application whose web interface is run by servlets, while the desktop app isn't. If there is a problem with the database which needs to be fixed I would ahave to stop tomcat so that I may gain complete access to the database. In Microsoft Access for example I cannot enter design view if a servlet has an existing connection. Which means I will have to stop the complete web application even though the only part which needs to be destroyed is the servlet with the db connection. i would like to destroy the servlet temporarily, and then reinitialize it via the web. Would this be possible? --- Andrew Robson [EMAIL PROTECTED] wrote: Amos, Forgive if I've misunderstood but I get the impression you are not clear about the servlet lifecycle. The init method will be called once. (when exactly is dependant on your servlet engine but it will be before any client requests) You then have a single servlet instance which handles multiple requests - each of which will be handled by a seperate thread. (I'm simplifying a bit because some servlet engines will create a servlet instance per request in implementing the SingleThreadModel but leave that to one side just now) It is the responsibility of the servlet engine to call destroy() Typically when the servlet engine is shutdown. So basically your servlet is running for the same period of time as the servlet engine. For the lifetime of your servlet engine you would only expect init and destroy to be called once for each servlet. It is not like CGI where each request fires up a process to run a new instance of your program. Hope this helps and apologies if I'm telling you something you already know. andrew On Tue, 07 Aug 2001, you wrote: William, thanks. IOt turns out that after looking at my problem in a little more detail, I figured this must be the issue. I guess this leads to another question. Once you destroy a servlet, can you reinitialize it. If so how? thanks, -Amos --- William Kaufman [EMAIL PROTECTED] wrote: This is not really a jdbc issue. What is happening is that my code specifies that the conenction to the database is made only during the init of the servlet and the conenction is closed after the servlet is destroyed. Ah, OK. Don't do that. init() is called exactly once, when the servlet gets loaded. If you want to close and re-allocate the connection, do it in your doGet()/doPost()/doWhatever() methods (if you've overridden those) or in your service() method (if you didn't): connect at the beginning, commit/rollback and close at the end (preferrably in a finally block, to make sure it gets done). -- Bill K. -Original Message- From: A.L. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 07, 2001 10:27 AM To: [EMAIL PROTECTED] Subject: RE: Servlet/ Database Conenction Persists Question This is not really a jdbc issue. What is happening is that my code specifies that the conenction to the database is made only during the init of the servlet and the conenction is closed after the servlet is destroyed. I think that my problem is that once I destroy the servlet, I can't figure a way to re initialize it. Simply refreshing the servlet page doesn;t seem to work. --- William Kaufman [EMAIL PROTECTED] wrote: I have developed a servlet web application which connects to a database to retrieve information. I noticed that if within my servlet I destroy the connection to the database
RE: How to keep existing info in tomcat logs at restart
Change tomcat.(bat/sh) to move the log file(s) to a new location before starting the java process. Or, change it to invoke your own Java main routine which moves the files before calling org.apache.tomcat.startup.Tomcat.execute(). -- Bill K. -Original Message- From: Amy Sun [mailto:[EMAIL PROTECTED]] Sent: Monday, August 06, 2001 3:06 PM To: [EMAIL PROTECTED] Subject: How to keep existing info in tomcat logs at restart Hi. I'm new to tomcat. After playing with it a bit, I find that the the log files always get refreshed (initalized) when tomcat is restarted. This is not desirable for us, because we roll over all of our logs nightly and would like to keep the existing information in the logs. Is there an easy way to fix this (e.g. by changing some configuration file)? Thanks a lot for your help! -Amy
RE: Application Server
The important bit is: ezmlm-reject: fatal: Sorry, I don't accept messages of MIME Content-Type 'multipart/alternative' (#5.2.3) The lesson here is, use plain text, like it says in the welcome message we're all sent when we sign on to the mailing list. In Outlook, you can set this in the dialog run from the Tools/Options menu--it's on the Mail Format page. You can also set this on each message, by selecting the Format/Plain Text menu. -- Bill K. -Original Message- From: Beth Kelly [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 02, 2001 4:21 PM To: [EMAIL PROTECTED] Subject: Re: Application Server How can I send mail to the server? When I send a message to the newsgroup, I receive the following message: Hi. This is the qmail-send program at apache.org. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. [EMAIL PROTECTED]: ezmlm-reject: fatal: Sorry, I don't accept messages of MIME Content-Type 'multipart/alternative' (#5.2.3) --- Below this line is a copy of the message. Return-Path: [EMAIL PROTECTED] Received: (qmail 93996 invoked from network); 2 Aug 2001 21:03:59 - Received: from mail301.mail.bellsouth.net (HELO imf01bis.bellsouth.net) (205.152.58.161) by h31.sny.collab.net with SMTP; 2 Aug 2001 21:03:59 - Received: from wisdom ([66.20.122.79]) by imf01bis.bellsouth.net (InterMail vM.5.01.01.01 201-252-104) with SMTP id 20010802210431.BNWQ3259.imf01bis.bellsouth.net@wisdom for [EMAIL PROTECTED]; Thu, 2 Aug 2001 17:04:31 -0400 Message-ID: 002a01c11ba8$a883cc30$3f7cfea9@wisdom From: Kyle Wayne Kelly [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Is there a way to get the Referrer information from a request? Date: Thu, 2 Aug 2001 16:12:53 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary==_NextPart_000_0027_01C11B6D.FBDD63E0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N This is a multi-part message in MIME format. --=_NextPart_000_0027_01C11B6D.FBDD63E0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable I printed out the html header, and it did not include the referrer = field. Is there another way to get the referrer field? Kyle Wayne Kelly (504)391-3985 http://www.cs.uno.edu/~kkelly --=_NextPart_000_0027_01C11B6D.FBDD63E0 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTMLHEAD META http-equiv=3DContent-Type content=3Dtext/html; = charset=3Diso-8859-1 META content=3DMSHTML 5.50.4616.200 name=3DGENERATOR STYLE/STYLE /HEAD BODY bgColor=3D#ff DIVFONT face=3DArial size=3D2I printed out the html header, and it = did not=20 include the referrer field.nbsp; Is there another way to get the = referrer=20 field?/FONT/DIV DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV DIVFONT face=3DArial size=3D2Kyle Wayne KellyBR(504)391-3985BRA = href=3Dhttp://www.cs.uno.edu/~kkelly;http://www.cs.uno.edu/~ kkelly/A= /FONT/DIV/BODY/HTML --=_NextPart_000_0027_01C11B6D.FBDD63E0-- Kyle Wayne Kelly (504)391-3985 http://www.cs.uno.edu/~kkelly - Original Message - From: arnox [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 02, 2001 1:33 PM Subject: RE: Application Server Orion is quite excellent :) (no I'm not affiliated in any way). It is fast, free for development (as long as it takes..), and at $1500 it really isn't all that much compared to competition. I tested it on SuSE 7.2 and Windows and haven't found a problem. I would definitely recommend it. -arnox -Original Message- From: Gregor Kovae [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 02, 2001 3:27 AM To: [EMAIL PROTECTED] Subject: Re: Application Server Hi! First of all I cannot find www.orionserver.org Second of all, if you mean www.orionserver.com they have their Pricing page that says - Orion Application Server development version (full version for development and for non-commercial deployment) FREE - Orion Application Server for commercial deployment $1500 per physical server So ? Best regards, Kovi At 16:41 2.8.01 +1000, you wrote: Utech - Han Lim wrote: Hi, About WebLogic I don't think it's free:( Do you know the free one beside JBoss and JRun Developer Edition? orion is free (http://www.orionserver.org), but there are plenty of ppl running JBoss on BSD, did you post on the JBoss list with your problem? cheers dim Thanks. regards, Han Lim
RE: HTTP 404 Error
1) Tomcat, by default, connects on port 8080. If you want to change that, edit your server.xml. 2) It sounds like your HTML is malformed or empty. Use the View source menu in the browser to see what you're spitting out. -- Bill K. -Original Message- From: Jeff Rancier [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:26 AM To: [EMAIL PROTECTED] Subject: HTTP 404 Error Hello, I'm stumped. I have the following directory structure/files: c:/tomcat/webapps/ServletTest/WEB-INF/web.xml c:/tomcat/webapps/ServletTest/WEB-INF/classes/ServletTest.class I added the following to my server.xml file: Context path=/ServletTest docBase=webapps/ServletTest crossContext=false debug=0 reloadable=true /Context And my web.xml contains: web-app servlet servlet-nameServletTest/servlet-name servlet-classServletTest/servlet-class /servlet servlet-mapping servlet-nameServletTest/servlet-name url-pattern/ServletTest/url-pattern /servlet-mapping /web-app If I attempt to open http://localhost/ServletTest, I get HTTP 404, file not found. If I attempt to open http://localhost:8080/ServletTest, I get the page cannot be displayed. Any suggestions would be appreciated. Jeff
RE: image resize
There's also the possibility of letting the browser resize it for you, by setting the width and height attributes of the IMG tag. Browsers don't scale images well, but it's a whole lot easier than doing it yourself. (Also note that AWT can't run on Unix without an X server, nor can it run if the server is locked. Look through the Tomcat archives for more information.) -- Bill K. -Original Message- From: Cory Powers [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 8:21 AM To: '[EMAIL PROTECTED]' Subject: RE: image resize I'm not sure, but there is good info on working with images on the jguru site. Try http://www.jguru.com/faq/home.jsp?topic=Media -Original Message- From: Reynir Hübner [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 11:13 AM To: [EMAIL PROTECTED] Subject: image resize Hi, this is probably a bit of topic... What would be the best way to resize images with servlet ? I have .jpgs and .gifs in files (not kept in database) and I need to create new files in different sizes from those images. Is anyone willing to give me a hint (or more :) on how to do it. thanx -r
RE: How to increase HTTP timeout?
You should be able to set this in your web.xml file, with the session-timeout tag. Take a look at the servlet spec, at http://java.sun.com/products/servlet/download.html . -- Bill K. -Original Message- From: Andrew Jarman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 3:57 PM To: '[EMAIL PROTECTED]' Subject: How to increase HTTP timeout? I'm using Tomcat 3.2.3, and I would like to increase the HTTP timeout from 5 min to something a bit longer. I have an application that sends XML to the server, which generates a report. Sometimes the server takes a long time to generate the file, which results in an aborted report. The XML requester on the client has a 1 hour timeout, so I have no problem there right now. I realize this isn't an ideal setup, but I need to deploy what I have working now, and fix the architecture later. How can I do this without hacking the source code, or is this the only way. BTW, I'm using the HTTP listener, not AJP12 or AJP13. I have a load balancer that will direct servlet requests to my TomCat servers, and static content to Apache servers. Thanks, Andrew Andrew Jarman, P.Eng, Internet Infrastructure Manager Exceedia, Inc. direct tel:780.699.5803 tel:780.413.1521 fax:780.413.0474 Exceedia -- Track labor, equipment and materials more efficiently. http://www.exceedia.com/ www.exceedia.com
RE: Security questions
What is the default password for the admin context? It's in tomcat/conf/tomcat-users.xml . where can I find documentation on implementing security with tomcat? Start with the servlet specification at http://java.sun.com/products/servlet/ . You could also look at JDBCRealm (sources and docs available at http://jakarta.apache.org/) as a sample implementation. -- Bill K.
RE: Java script problem using servlets
First question: Did you try running this in a browser debugger? MS has one for IE (search for JScript debugger), and Netscape 4 has one. parent.document.critere document.critere isn't defined, unless you're defining it somewhere else. And, is this actually, really the HTML you're using? You've got this option in there: option value= 3014680041687 219365303CAFE SOLUBLE MAXWELL 100 G3014680041687 219365303CAFE SOLUBLE MAXWELL 100 G/option You need to quote the value. You should also realize that the text outside the tags is never going to line up the way you want. You might want to replace the blanks with nbsp;, and set the style to font-family: monospace;. Or, replace the whole thing with a table and add some radio buttons to do selection. -- Bill K. -Original Message- From: Michel COTE [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 25, 2001 7:26 AM To: '[EMAIL PROTECTED]' Subject: Java script problem using servlets Hello, I'm using Jakarta since a few days and i encounter the following strange problem : I have build a sample servlet based page that contains two frames, one (issued from a servlet) with a sample form composed of a dynamic list (created with a JDBC SQL query) and a push button, and another one composed of a static html file (not coming from a servlet) including only a text field. I just want to copy the value content of the selected list item, in the text field by clicking the button. So i use a sample onClick java script function on the button that reads the value in the list and write into the text field. Then i allways get a java script error message Permission denied . When i replace the servlet HTML part in the first frame by exactly the SAME HTML STATIC code (not issued from a servlet but directly from an html file), everything works fine ! ! ? ? Have you ever eard about such a matter ? ? ? Thanks for any help. Michel COTE. Here is a copy of the HTML code in the first frame : HTML HEADTITLE Liste des articles /TITLE/HEAD BODY topmargin='0' script language='JavaScript' function majCode() { //The java script allways hangs on this line parent.document.critere.text_field.code.value=document.form_li ste_art.li ste_articles.value.substring(0,12) parent.close() } /script form name='form_liste_art' div align='center' select name='liste_articles' size='13' option4 articles trouves /optionoption value= 3014680041687 219365303CAFE SOLUBLE MAXWELL 100 G3014680041687 219365303CAFE SOLUBLE MAXWELL 100 G/optionoption value= 3014680008093275456007OT CAFE SOLUBLE MAXWELL 100 G3014680008093275456007OT CAFE SOLUBLE MAXWELL 100 G/optionoption value= 3014680041687275456007OT CAFE SOLUBLE MAXWELL 100 G3014680041687275456007OT CAFE SOLUBLE MAXWELL 100 G/optionoption value= 3014680008093219365303 CAFE SOLUBLE MAXWELL 100 G3014680008093219365303CAFE SOLUBLE MAXWELL 100 G/option/select /select brbrinput type='button' name='bt_select' value='Seacute;lectionner' onClick=majCode() /div /form /body /html Michel COTE Cooperateurs de Normandie Picardie Tel : 232111086 email : [EMAIL PROTECTED]
RE: keeping sessions when switching from http to https
Are you encoding the cross-protocol links (with HttpServletResponse.encode[Redirect]URL())? The only reason I ask is that it seems strange that it does OK with cookies but not with URL encoding: the code paths are similar, so I'd expect it to fail with both or succeed with both. -- Bill K. -Original Message- From: Brigger Patrick [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 24, 2001 11:05 PM To: '[EMAIL PROTECTED]' Subject: RE: keeping sessions when switching from http to https When I try with cookies enabled, it works both on Netscape and IE 5. Cookies disabled does not work on either. Pat -Original Message- From: Mike Spreitzer [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 24. Juli 2001 19:13 To: [EMAIL PROTECTED] Subject: Re: keeping sessions when switching from http to https Be careful when you experiment and report on this. I have found that IE 5 carries cookies from http to https but Netscape 4 does not. I have only tested this with cookies, not URL-rewriting. I'm grumped by this problem, but it's not critcal for me yet --- for my current site, I think I can get away with only having sessions on the https side. Mike
RE: Wat is JDBC realm basically
http://jakarta.apache.org/tomcat/tomcat-3.2-doc/JDBCRealm.howto -- Bill K. -Original Message- From: Mehul S Dave [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 24, 2001 6:00 AM To: Tomcat User archive Subject: Wat is JDBC realm basically Hi, I am sorry to ask this easiest query but i dont have any idea about it. Wat is JDBC realm . Wat is it all about wat can i do with it? * Mehul S Dave Scientific Officer, (STCS Dept.), Tata Institute of Fundamental Research Phone - 2152971 Extn - 2372 Mumbai . webpage:- http://www.csc.tifr.res.in/~mehul *
RE: tomcat 3.2.3 configuration
It should be http://localhost:8080/servlet/baseball ^^^ If you want to use http://localhost:8080/baseball you'll need to define your own web.xml, aliasing your servlet to /baseball like, cut here web-app servlet servlet-name BaseballServlet /servlet-name servlet-class baseball /servlet-class servlet-mapping servlet-name BaseballServlet /servlet-name url-pattern /baseball /url-pattern /servlet-mapping /web-app cut here For more information, read the JSDK spec, at http://java.sun.com/products/servlet/download.html -- Bill K. -Original Message- From: Aaron Cooper [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 24, 2001 7:59 AM To: [EMAIL PROTECTED] Subject: tomcat 3.2.3 configuration Hi folks I am really stumped here and am wondering if someone can lend a helping hand. I want to create my own web application. From what I have read, if I put a directory under /webapps, tomcat will automatically add that directory to its web applications using ContextManager. I created a /baseball directory under /webapps, however, whenever I type in http://localhost:8080/baseball, it does not find the directory. So, I went and changed server.xml and added the Context path=/baseball docBase=webapps/baseball /Context. But that also did not work :) Is there something I am doing wrong here? I've noticed in the /webapps directory there exists .war files... do I need to do create a war file? if so, how? Any help would be greatly appreciated! thanks! Aaron Cooper
RE: Tracking Threads inside Tomcat
Depending on your JVM, you may be able to do a break (Ctrl+Break on Windows, Ctrl+Y on several Unixes) in the window running Tomcat (or any Java application) to get a stack trace. Dunno how (or even if) it can be done on Macs. Failing that, you could use jdb to connect to the Tomcat process, enter stop, then where all to get a stack dump. -- Bill K. -Original Message- From: Ivan E. Markovic [mailto:[EMAIL PROTECTED]] Sent: Monday, July 23, 2001 4:28 AM To: [EMAIL PROTECTED] Subject: Tracking Threads inside Tomcat Importance: High I hope that someone will be able to help. I have tomcat 3.2 running on a Sun Solaris platform and on my Mac OS-X. But after 5 to 10 hours Tomcat reaches some kind of deadlock on the Sun. Now I know that this is NOT a Tomcat issue, it is my code. But due to the length of time it takes to get to this stage it is very hard to debug. But I believe that it is a problem related to Threads not completing; for some reason. is there any way that I can trace the Threads, check their Stack Trace or something? I only have access remotely via a terminal window. Thank you. I v a n ... Ivan Markovic SculptLight http://www.sculptlight.com (+353) 87 2939256 (+353) 1 2982205 114 Lower Churchtown Rd, Dublin 14, Ireland. --
RE: load-on-startup
I'm not sure I understand what you're trying to accomplish, but the JSDK explains how to use load-on-startup. Look at the JSDK spec, at, http://java.sun.com/products/servlet/download.html or web.dtd, at, http://java.sun.com/j2ee/dtds/web-app_2_2.dtd -- Bill K. -Original Message- From: Java Junkie [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 19, 2001 3:23 PM To: [EMAIL PROTECTED] Subject: load-on-startup Hello, I am trying to create a pooled resource. I am doing this by loading a wrapper class on startup that will recieve two parameters and manage the resources based on those parameters. I do not know the exact syntax for using the load-on-startup tag. Could someone please help?! Thank you. __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
RE: Setting Tomcat HTTP Request Timeout
Tomcat isn't timing out--your browser is. It gives up if it doesn't get a response from the server in a certain amount of time. And I don't think you can change that setting on any browser I've seen. You could try calling ServletOutputStream.flush() each time you write data: hopefully, that will tell the browser that you're working on it. But, depending on your server configuration, the data might still get bufferred, and flush() might not actually flush any data. The only useful answer is, Don't make a servlet that takes that long. Profile your code, calculate things ahead of time, cache results, split up the page, do work in multiple threads, all the standard speed-up things. -- Bill K. -Original Message- From: Andrew Birchall [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 18, 2001 5:25 AM To: [EMAIL PROTECTED] Subject: Setting Tomcat HTTP Request Timeout Hi, We are using a standalone Tomcat 3.2.1 for our servlet app. and we keep getting Error 500 read timeout errors from Tomcat on requests which take a long time. Is there any way of setting the Request timeout in Tomcat so we can set it to a larger value? Thanks Andy Birchall Software Developer Rchive-it.com
RE: Double Click
I can think of a few ways to deal with it: 1) Disallow double-clicking on the client, ever. Add ondblclick=javascript: return false; to the anchor tag(s). (The servlet engine never knows whether the user single- or double-clicked. If you need that specific information, you always need to deal with it on the client side.) 2) If you want to allow double-clicking to run the action twice, but you don't want both clicks running at the same time, synchronize on a session attribute. 3) If you want to disallow ever running the action twice in a row, set some session attribute to remember the last action you ran, and reject any action which matches the last action run. -- Bill K. -Original Message- From: Wang, Jianming [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 18, 2001 8:58 AM To: '[EMAIL PROTECTED]' Subject: Double Click Hi, I have an hyperlink, when user click on it, it will update the database. My question is how can I deal with the case when user double click on the link? Thank you in advance for your help. JW.
RE: Generate Excel File
We've got it working exactly as you say, but only if the data is delimited with _tabs_, not _commas_. -- Bill K. -Original Message- From: Erin Lester [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 18, 2001 2:21 PM To: [EMAIL PROTECTED] Subject: Generate Excel File Hi, I'm trying to generate an excel file as the response returned from a servlet. I have set the response's content type to application/vnd.ms-excel and this seems to cause excel to open. The data I return is comma separated values. Once upon a time I read on a newsgroup (don't think it was this one) that someone had done the same thing and excel interpreted the data as a csv file and it displayed nicely in excel. Unfortunately excel seems to think that the entire row of comma separated values that I'm sending it is one single cell (not a row of cells which are the values between the commas). Can anyone tell me where I'm going wrong or of another way to generate an excel spreadsheet using JSP? Thanks! Erin
RE: problems serving HTTP requests
From the HTTP spec at http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2068.html : ] 10.2.7 206 Partial Content ] The server has fulfilled the partial GET request for the resource. That means you called HttpServletResponse.setContentLength() with a number bigger than the actual amount of data you're returning. If you stop calling that, everything should be fine. (Calling setContentLength() is a good idea, but only if you actually know the length, which you rarely do without bufferring all the data yourself.) ] 10.3.5 304 Not Modified ] If the client has performed a conditional GET request and ] access is allowed, but the document has not been modified, ] the server SHOULD respond with this status code. That means that Tomcat's copy of your servlet's output is newer than the date returned by getLastModified(). If your implementation of getLastModified() is returning the right timestamp, then everything's OK. -- Bill K. -Original Message- From: David Treves [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 1:40 AM To: tomcat-user Subject: problems serving HTTP requests Hi, I searched the archives yet didn't find anything can help me... I installed the Tomcat 3.2.2 in an out-of-process mode with IIS 5, for some time it worked just fine. Today Tomcat decided it is on a strike... I cannot get any servlet/jsp file served by it. Instead I get the option to download the file I request and the files are filled with gibberish. The Tomcat's DOS window doesn't print any error and I see in the IIS log that the request went fine (08:15:19 192.114.206.189 GET /jakarta/isapi_redirect.dll 200) a few times (even though I saw no results) and some times I got 206 HTTP message or 304. What could make the sudden change? Thanks in advance! David.
RE: jdbc
(You know, this has nothing at all to do with Tomcat, or even servlets,...) Use a PreparedStatement, and call setString(). -- Bill K. -Original Message- From: Andrea Mari [mailto:[EMAIL PROTECTED]] Sent: Monday, July 16, 2001 6:58 AM To: [EMAIL PROTECTED] Subject: jdbc Hi, how can I escape automatically the query strinng when it contains invalid character as ' or \ ? I know that in php there is a directive that do it. Can you help me? Andrea
RE: multipart/form-data
Page not found is browser-speak for your servlet blew chunks. Take a look at the window Tomcat is running in: unless you wrote a good deal of code to avoid it, you should see a stack trace which tells you where your code broke. If there's no stack trace, chances are your servlet is locked up. Try hitting Control+Break to see where it's stuck. (Several threads will be in Object.wait(): those are just waiting around for something useful to happen, and you can ignore them. Just look at threads with your own code somewhere in the stack.) -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 7:23 AM To: [EMAIL PROTECTED] Subject: multipart/form-data Hello, I still have the following problem : I post some data to a servlet with enctype=multipart/form-data What ever file I pass to the input type=file ... the doPost() of the servlet will proced but when the file is bigger than a very small amout of space (about 30ko) though the servlet proceds my request, my navigator will show page not found. I find this very strange and wonder if it could not be a tomcat (may be apache) configuration purpose. If I'm asking the wrong mailing list please tell because I'm not cross something (cannot remember the english for this) over many mailing list. Thanks Sebastien
RE: Tomcat memory-leak problem
Then i would like to know if there is a program to clean up objects. Like a garbage collection on the system. Of course there is: it's Java. The JDK will garbage-collect released objects. The problem is, you aren't releasing them. You need to figure out _why_ you're caching them: is it on behalf of a specific user, or is it for all users of a servlet? If it's a specific user, you should save them as a session attribute, which will get released when the session times out; if it's for all users, save it on the servlet context, or in static memory. You might also want to look at the reference package in java.lang.ref for garbage-collectable object references. And, you should really figure out if you even _want_ to cache it: is it really worth a half a Gbyte of memory to just avoid reloading or recalculating whatever these objects are? -- Bill K. -Original Message- From: Bjarne Jørgensen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 6:18 AM To: [EMAIL PROTECTED] Subject: Re: Tomcat memory-leak problem Hi! Okay. Sounds okay. Because we have some caching servlets, but the object should be terminated after it has been used. Our server hosts 3 heavy-trafic sites, and you may be right about the source of the memory leak is from the servlet pages. Then i would like to know if there is a program to clean up objects. Like a garbage collection on the system. Thanks. - Original Message - From: Randy Layman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 11, 2001 1:13 PM Subject: RE: Tomcat memory-leak problem It isn't Tomcat, and it isn't Tomcat on windows that is causing your problem. I have a server, running NT 4 and has been running it for close to 2 months under moderate load, and haven't had any memory leaks. I would look at your web applications and find the place where you are holding on to memory. I guarantee that it is your application and not Tomcat. Randy -Original Message- From: Sam Newman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 5:32 AM To: [EMAIL PROTECTED] Subject: Re: Tomcat memory-leak problem I too have been having some problems with Tomcat + memory. I put it down to me running win98 and win98 not properly being able to address memory over 128MB. I normally have dreamweaver, netbeans and tomcat running, and reguarly run out of memory (I have 384MB Ram). I haven't noticed any similar problems running tomcat on linux (with a lower spec machine). Windows does have memory management issues however, and it might be the way tomcat threads means it causes problems with memory on win32 platforms. I downloaded Tweakall in the end, as this comes with a niffty utility which can free leaked memory. sam - Original Message - From: BJ To: [EMAIL PROTECTED] Sent: Wednesday, July 11, 2001 9:50 AM Subject: Tomcat memory-leak problem Hi! I'm using apache, tomcat jakarta 3.2.1, jdk1.2.2 on a linux 6.2 and a MS SQL server on a Nt4 with sp 6a. Having some trouble with memory-leak. After the server has been running for a couple of days, it has eaten up all 512MB of RAM. It is a server with some customers on and it handles about 1000 visitors a day. We use JSP pages and servlets to show webpages. Servlets primary for showing images from database or generating menues... So... what shall i do? It doesnt help to restart tomcat. I need to reboot the server and start tomcat all over before we can get in contact with the sites again. Thanks in adv. /)-._ Y. ' _] Greetings ,.._ |`--= Bjarne Jørgensen / Bigf00t /-/ `.\ /) | |_ `\|___ Email : [EMAIL PROTECTED] \:::\___/_\__\___\
RE: Tomcat problems on Solaris
Tomcat terminates when the user who starts tomcat logs off the server. man nohup. -- Bill K. -Original Message- From: Neil Anderson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 3:57 AM To: [EMAIL PROTECTED] Subject: Tomcat problems on Solaris Hi, I am having problems getting tomcat 3.2.2 to work on a Solaris server with apache 1.3.20. There is a couple of issues that I am not sure if they are related. Any help would be appreciated. The first problem is that tomcat logs the stdout and stderr to the user who starts the service. I have set the wrapper.properties to wrapper.stdout=$(wrapper.tomcat_home)/logs/jvm.stdout wrapper.stderr=$(wrapper.tomcat_home)/logs/jvm.stderr Tomcat terminates when the user who starts tomcat logs off the server. I start tomcat as the www user eg su - www -c /usr/local/jakarta-tomcat-3.2.2/bin/tomcat.sh start Despite this tomcat logs to the users consol who runs this command. I am also getting errors coming out in the mod_jk.log which are as follows. [jk_connect.c (143)]: jk_open_socket, connect() failed errno = 146 [jk_ajp12_worker.c (152)]: In jk_endpoint_t::service, Error sd = -1 [jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close, NULL parameter [jk_uri_worker_map.c (185)]: In jk_uri_worker_map_t::uri_worker_map_free, NULL parameters Are these errors related. Any help in resolving these issues would be appreciated. Regards Neil
RE: Help with using getRequestURL()
Assuming you mean the getRequestURI() (not URL) method of HttpServletRequest (not Servelt),... What exactly is the compiler complaining about? What's the error it's producing? -- Bill K. -Original Message- From: Tia Haenni [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 11, 2001 11:21 AM To: Tomcat Mailing List Subject: Help with using getRequestURL() Is anyone familiar with the method getRequestURL() of the HttpServeltRequest interface? I am trying to use it, but the compiler object to the method. By the way, this method is previously of javax.servlet.http.HttpUtils, which has been deprecated. Thanks in advance, Tia
RE: getServletContext() throws NullPoinetException
Looking at the source (available from http://jakarta.apache.org/builds/jakarta-tomcat/release/) it looks like the only way this would happen is if it doesn't have the ServletConfig passed into its init() method. Are you intercepting the call to init() in your servlet? If so, are you making sure to call the superclass' init() method? -- Bill K. -Original Message- From: Stefanos Karasavvidis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 10, 2001 7:46 AM To: [EMAIL PROTECTED] Subject: getServletContext() throws NullPoinetException I've just installed tomcat 3.2.2 and have the following problem. I want to call getServletContext() from a servlets service method but get the folowing exception *Internal Servlet Error:* java.lang.NullPointerException at javax.servlet.GenericServlet.getServletContext(GenericServlet. java:205) at TestServlet.service(TestServlet.java:32) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper .java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextM anager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro cessConnection(Ajp12ConnectionHandler.java:166) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin t.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo ol.java:501) at java.lang.Thread.run(Thread.java:484) Moreover the getServletConfig() returns null which is probably the main reason for this problem Any ideas?? Stefanos
RE: creating a instance of a servlet: takes too long!!
Note that a good deal of this time might be spent in HttpServletRequest.getSession(): the 3.2.1 implementation is much slower than the 3.2.2 version. You might want to time your calls and, if that's where the slow-down is, upgrade to 3.2.2. -- Bill K. -Original Message- From: pedro salazar [mailto:[EMAIL PROTECTED]] Sent: Friday, July 06, 2001 2:02 AM To: [EMAIL PROTECTED] Subject: creating a instance of a servlet: takes too long!! Greetings, why is that my servlet when the first time is invoked, it takes about 30 seconds or more to start when the servlets that came in tomcat are instantaneous? After the servlet container instantiated and initialized my servlet, all the following requests are very fast. Is there any advice for what we should do and don't do in init() method? I just initialize some properties and a connection pool Well is it possible that my servlet container at any time my may shutdown my servlet to release memory, and another time it will be requested to start again and take another time too long to start, correct? How can I benchmark the time of instantiation of my servlet and the time of my init method? System configuration: -Tomcat 3.2.1 -JDK 1.3 -Linux RedHat 6.2 [kernel 2.2.18] -PII400Mhz 256Mbytes thanks. -- psalazar/
RE: generic exceptions on startup
Looking at the source code, he's just throwing the execption to himself as a debugging message. You could turn it off by dropping your debug level to 20, but I wouldn't worry too much about it. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 05, 2001 12:50 PM To: [EMAIL PROTECTED] Subject: generic exceptions on startup Importance: High This is a partial list of exceptions that I'm getting at startup (Win 98, 3.2.1). Anybody know what's going on? TOMCAT_HOME is properly set to C:\tomcat Not Apache nor IIS nor NS (whatever that is) are not involved in my setup at all. Thanks. java.lang.Exception at org.apache.tomcat.core.ContextManager.getHome(ContextManager.java:224 ) at org.apache.tomcat.core.ContextManager.getAbsolute(ContextManager.java :1512) at org.apache.tomcat.context.LoaderInterceptor.contextInit(LoaderInterce ptor.java:111) at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java :491) at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) java.lang.Exception at org.apache.tomcat.core.ContextManager.getHome(ContextManager.java:224 ) at org.apache.tomcat.core.ContextManager.getAbsolute(ContextManager.java :1512) at org.apache.tomcat.context.LoaderInterceptor.contextInit(LoaderInterce ptor.java:116) at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java :491) at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) java.lang.Exception at org.apache.tomcat.core.ContextManager.getHome(ContextManager.java:224 ) at org.apache.tomcat.task.ApacheConfig.execute(ApacheConfig.java:92) at org.apache.tomcat.startup.Tomcat.generateServerConfig(Tomcat.java:217 ) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:200) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) java.lang.Exception at org.apache.tomcat.core.ContextManager.getHome(ContextManager.java:224 ) at org.apache.tomcat.task.IISConfig.execute(IISConfig.java:87) at org.apache.tomcat.startup.Tomcat.generateServerConfig(Tomcat.java:223 ) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:200) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) java.lang.Exception at org.apache.tomcat.core.ContextManager.getHome(ContextManager.java:224 ) at org.apache.tomcat.task.NSConfig.execute(NSConfig.java:86) at org.apache.tomcat.startup.Tomcat.generateServerConfig(Tomcat.java:229 ) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:200) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
RE: Killing endless loop servlet - howto ? killing JVM or unload class ?
OK, no one's answered this yet, so,... First, I don't know if it's killing a thread is the right approach. Should I do that, without shutdown Tomcat ? So, why are you creating an infinite loop? I mean, if you didn't, you wouldn't have to kill it. If you're generally asking how one can kill threads in Java, you could use java.lang.Thread.stop() (but read the deprecation warning). But as a rule, not creating infinite loops is a much better strategy. Is there a way to set a 'time-out' for a Servlet ? Not the way you mean. You can set a timeout for a session (by modifying your web.xml); but AFAIK, the only way to set a timeout for a request would be on your browser. -- Bill K. -Original Message- From: Renato Weiner [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 6:03 AM To: [EMAIL PROTECTED] Subject: Killing endless loop servlet - howto ? killing JVM or unload class ? Hi all, I'm rolling out a successful Tomcat instalation in a shared environment ( it's a great software ! ). But I have a concern. I created a servlet that loops forever ( a very stupid one, by the way ). When I executed it, it allocates a Tomcat thread and it just runs forever. If I try to kill it after it consumed, let's say, 30 seconds of processing, it ended up killing the whole JVM. First, I don't know if it's killing a thread is the right approach. Should I do that, without shutdown Tomcat ? Is there a way to set a 'time-out' for a Servlet ? What I can doin this situation ? Is there an Interceptor that can unload this class somehow ? Thanks in advance Renato - Brazil P.S. I'm running Linux, kernel 2.4.3, Tomcat 3.2.2 Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
RE: IOException and Tomcat hanging
I've got random java.sql.SQLException: Io exception: Socket closed error in my web application, which uses Tomcat 3.2.2 and struts. It happens only when a link is clicked without the page fully loaded. I don't get any exception while the page is fully loaded. That exception tells you that,... the user clicked on another link, before the page was completely loaded. Really. The page couldn't be delivered because a new page was selected. What you do with that exception is up to you. In most cases, though, you probably want to ignore it, and let it percolate back up to the servlet engine. After all, there's no one asking for the page anymore--what would you do with the output? If you're using the servlet call to do something unrelated to page generation (e.g., to start a service or pre-load data), you may want to move that work off to a separate thread, so it doesn't get interrupted by I/O failures. -- Bill K. -Original Message- From: Xiaoyu Zhang [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 10:16 AM To: [EMAIL PROTECTED] Subject: IOException and Tomcat hanging Hi, I've got random java.sql.SQLException: Io exception: Socket closed error in my web application, which uses Tomcat 3.2.2 and struts. It happens only when a link is clicked without the page fully loaded. I don't get any exception while the page is fully loaded. The exception caught in the application is : SQLExcpetion: Io Exceptoin: socket closed The exception at tomcat console is : ContextManager: SocketException reading request, ignored - java.net.SocketException: Connection reset by peer Did someone have similar case before ? Thanks. Xiaoyu attached: Error message in tomcat console: ContextManager: SocketException reading request, ignored - java.net.SocketException: Connection reset by peer at java.net.PlainSocketImpl.socketAvailable(Native Method) at java.net.PlainSocketImpl.available(PlainSocketImpl.java:451) at java.net.SocketInputStream.available(SocketInputStream.java:137) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:217) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) Error message our application caught: com.cisco.tte.rims.model.DatabaseErrorException: java.sql.SQLException: Io exception: Socket closed at com.cisco.tte.rims.model.Workspace.getAttributeById(Workspace.java:2809) at com.cisco.tte.rims.actions.ViewWorkspaceConfigAction.handleAction(ViewWorksp aceConfigAction.java:174) at com.cisco.tte.rims.actions.BaseAction.perform(BaseAction.java:174) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1726) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1536) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) 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.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484)
RE: Restarting Tomcat on NT
Maybe you didn't really kill off Tomcat, but just the DOS box it was running in,... (I've seen it happen after closing the DOS box, but not after Ctrl+C'ing the program.) Try bringing up the Task Manager, and make sure there aren't any instances of a java image name running. -- Bill K. -Original Message- From: Steven Turoff [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 3:30 PM To: [EMAIL PROTECTED] Subject: Restarting Tomcat on NT I am having problems restarting Tomcat on NT. After a reboot of the machine, Tomcat starts without a problem. However, if I stop Tomcat and then attempt to restart, I get the following error: FATAL:java.net.BindException: Address in use: bind java.net.BindException: Address in use: bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:390) at java.net.ServerSocket.init(ServerSocket.java:173) at java.net.ServerSocket.init(ServerSocket.java:124) at org.apache.tomcat.net.DefaultServerSocketFactory.createSocket( DefaultServerSocketFactory.java:97) at org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTc pEndpoint.java:239) at org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnec tor.java, Compiled Code) at org.apache.tomcat.core.ContextManager.start(ContextManager.jav a, Compiled Code) at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:202) at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235) I'm running Tomcat on port 8080. After I receive the above error, a netstat -a yields: TCPcx628443-b:80070.0.0.0:0 LISTENING TCPcx628443-b:80070.0.0.0:0 LISTENING TCPcx628443-b:80800.0.0.0:0 LISTENING TCPcx628443-b:80800.0.0.0:0 LISTENING So, for some reason, stopping Tomcat does not free up the port. I must then reboot my machine to run Tomcat again. I'm using Tomcat 3.2.1 and Classic VM (build JDK-1.2.2-001, native threads, symcjit). Ideally, I'd like to fix the problem, however, I'm also interested in any solution that doesn't require rebooting my machine. I'll be switching to a Linux-Tomcat platform soon, but need a solution for the meantime. Thanks, Steve
RE: multipart/form-datatomcat 3.2.2 problem
I think it's more accurate to say, Don't call anything that would read the upload stream--for instance, you could ask about the headers or the URL, but don't ask about the parameters. If this is the problem you're having, check the console window that Tomcat is running in: getReader()/getInputStream() should have tossed an exception kvetching about getting the input twice. -- Bill K. -Original Message- From: Brandon Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 6:46 AM To: [EMAIL PROTECTED] Subject: RE: multipart/form-datatomcat 3.2.2 problem I found that when uploading a multipart-form data post, you need to make sure to never attempt to access the HttpServletRequest object. You need to create your own request and access only that. If you try to access the regular HttpServletRequest, then it shows a page cannot be found. Brandon Cruz -Original Message- From: ahmet yilmaz [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 5:02 AM To: [EMAIL PROTECTED] Subject: multipart/form-datatomcat 3.2.2 problem Hello, I have written a page to upload files.The problem is although some files are uploaded correctly, some files end up with getting Cannot find server, The page can not be displayed error in Internet Explorer. Firstly i thought this was due to my bad coding practice, but I deleted the part that handles the upload. Now the file just posts the request, and the part recieving the multipart/form-data justs prints out the headers to stderr, and builds a basic page. But I still get the same errors? what may be the cause of this? __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
RE: How do I get context-params that are set in the web.xml file?
You want ServletConfig.getInitParameter(); you can get the ServletConfig with Servlet.getServletConfig(), or intercept it on the servlet's init() call. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 28, 2001 7:03 PM To: [EMAIL PROTECTED] Subject: How do I get context-params that are set in the web.xml file? I hope the subject says it all but here's a reiteration. The sample web.xml in TOMCAT_HOME/doc/appdev shows how to set and access context-params. The current docs on ServletContext do not seem to have a method to get context params. init-params on a per servlet basis work as described but I have several values that all servlets must access. Thanks in advance, --beeky
RE: port problem
Start tomcat on port 80 instead of 8080. (This is listed in your server.xml.) Note that you may have to start it with administrator/root privileges, since ports below 1024 are access-controlled. -- Bill K. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Sent: Friday, June 29, 2001 10:16 AMTo: [EMAIL PROTECTED]Subject: port problem Hi, I can type http://localhost/examples/jsp/index.html to get what I want. But I have to type http://localhost:8080/admin/index.html to get the page. Why difference here? How to get rid of 8080 in the second case. Thanks. Minglong
RE: trapping session invalidation
Look at HttpSessionBindingListener: http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpSess ionBindingListener.html -- Bill K. -Original Message- From: Pankaj Chhaparwal [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 12:10 PM To: [EMAIL PROTECTED] Subject: trapping session invalidation Importance: High Hi All, I want a certain functionality to be invoked when the session invalidates. How do I know that the session is getting invalidated? Any help on this will be greatly appreciated. Thanks Regards, Pankaj
RE: Using the servlet element on web.xml to define short name for a servlet in a package
Try adding, servlet-mapping servlet-name controller /servlet-name url-pattern /something /url-pattern /servlet-mapping to your web.xml. Then, http://localhost:8080/something should work. -- Bill K. -Original Message- From: Eitan Ben Noach [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 2:03 PM To: [EMAIL PROTECTED] Subject: Using the servlet element on web.xml to define short name for a servlet in a package Hello, I'm running standalone tomcat. I'm trying to use the servlet element on web.xml to define short name for a servlet in a package, but it doesn't work. I put a package called FTPExplorer.jar under /admin/web-inf/lib containing the servlet named com.company.ftpexplorer.FTPExplorerServlet.class When calling the servlet with following URL: http://localhost:8080/admin/servlet/com.company.ftpexplorer.FT PExplorerServl et the servlet works ok. I've defined the following servlet element on the main tomcat web.xml servlet servlet-name controller /servlet-name servlet-class com.company.ftpexplorer.FTPExplorerServlet /servlet-class /servlet When trying to call the servlet with either URLs: http://localhost:8080/controller http://localhost:8080/admin/servlet/controller Tomcat can't find the servlet ( 404 ) What is wrong ? Thanks, - Eitan Ben-Noach Proficiency, Ltd. Tel: +972.2.548.0287 Fax: +972.2.586.3871 email: [EMAIL PROTECTED] The Intelligence in Engineering Supply Chain Collaboration http://www.proficiency.com/ we have the following configuration: - Windows 2000 (Service Pack 1) (2, 4 and 8 processors) - Apache 1.3.19 with mod_ssl 2.8.3 - Tomcat 3.2.2 (Apache and Tomcat are talking AJP13) - We have a loadbalancer configured with 3 Tomcat workers - Our load generating test clients are implemented using HttpUnit 1.2.4 + JSSE 1.0.2 On heavy load (starting from 50 concurrent requests up to 200 concurrent requests) we observe non-deterministic TCP/socket problems. It seems that in almost every case, the only place where we can see some kind of exception is the mod_jk log file: ... [jk_connect.c (143)]: jk_open_socket, connect() failed errno = 61 [jk_ajp13_worker.c (173)]: In jk_endpoint_t::connect_to_tomcat, failed errno = 61 [jk_ajp13_worker.c (584)]: Error connecting to the Tomcat process. [jk_ajp13_worker.c (203)]: connection_tcp_get_message: Error - jk_tcp_socket_recvfull failed [jk_ajp13_worker.c (619)]: Error reading request ... [jk_ajp13_worker.c (271)]: read_into_msg_buff: Error - read_fully_from_server failed [jk_lb_worker.c (349)]: In jk_endpoint_t::service, none recoverable error... ... Analysing the exceptions that are thrown from HttpUnit, it looks like that sometimes the socket cannot connect at all and sometimes the response could not be retrieved completely. Most errors occur in the early startup phase of our load test. Using netstat we can observe a *lot* of sockets in CLOSE_WAIT state connected to the AJP13 port. The settings we use in our Apache configuration are as follows: ... Timeout 300 KeepAlive On MaxKeepAliveRequests 500 KeepAliveTimeout 300 MaxRequestsPerChild 0 ThreadsPerChild 500 ... I would appreciate, if there is anyone who has gone through the same kind of problems or if there is some kind of solution that may help to solve these problems. Perhaps, if there is someone with an equivalent Linux-Setup, i would appreciate, if she/he could tell us some of her/his experience? Mit freundlichen Grüßen / Kind regards, Norbert Klose
RE: open xml/xsl files inside classpath
ServletContext.getResourceAsStream(): http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContex t.html#getResourceAsStream(java.lang.String) (I believe it shows up starting in JSDK version 2.1, or Tomcat 3.2.) -- Bill K. -Original Message- From: Pedro Salazar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 6:24 AM To: [EMAIL PROTECTED] Subject: open xml/xsl files inside classpath Greetings, I have a servlet which read some properties (using the ResourceBundle) from a properties file in a package PT.teste.props where exists a relation like this: fileA.xml = file1.xsl fileB.xml = file2.xsl ... Of course getting the properties file is simple task because I just use the location in classpath, ex: rb=ResourceBundle.getBundle(PT.teste.props.+properties_file); But, now I would like to open both files, the xml and the xsl file, which are in a package PT.teste.xml. I tested using the absolute path to them, but is not very recommendable because tomorrow I probably will put it in another location or in another machine... Source xmlSource = new javax.xml.transform.stream.StreamSource (new java.net.URL(file:///opt/jakarta-tomcat-3.2.1/webapps/servlet _teste/WEB-INF/classes/PT/teste/xml/fileA.xml).openStream()); Source xslSource = new javax.xml.transform.stream.StreamSource (new java.net.URL(file:///opt/jakarta-tomcat-3.2.1/webapps/servlet _teste/WEB-INF/classes/PT/teste/xml/file1.xsl).openStream()); Is there a easy way to open a file in a classpath directly? Or at least a way where the path is relative to the web application? A not very recommendable way just to solve my problem is use a path in a properties file which I would read in the init() of servlet... but, I wouldn't like to do it! thanks, Pedro Salazar.
RE: How to mask servlet ?
Look at the web.dtd file in tomcat/conf--specifically, the url-pattern tag. The complete spec is at http://java.sun.com/products/servlet/ . -- Bill K. -Original Message- From: Eric MARTIN [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 5:48 AM To: [EMAIL PROTECTED] Subject: How to mask servlet ? Does anybody know how to mask the servlet ? Using Apache /Tomcat, i would like the URL le /aName (or /) be redirect to my Servlet (without the /servlet/myServlet). He's there a way to do so ? Thanks Eric
RE: mysteriously dying connections (Oracle - tomcat)
These look like two different issues: 1) Oracle is running out of cursors. a) Make sure you close every ResultSet, Statement and Connection when you're done with them. One trick you can use on Oracle is to log into the database in SQL*Plus as SYS while your application is running, and do, SELECT SQL_TEXT FROM V_$OPEN_CURSOR; to see the SQL for the cursors you have open. b) Try reusing connections and (prepared) statements wherever possible (assuming you use a common Oracle logon for all your accesses). c) Up the number of allowed open cursors, by putting open_cursors = 500 or so in your database's init.ora file. 2) Tomcat is running out of threads. Are you actually getting dozens of people connecting at the same time? Try increasing the max_threads parameter for PoolTcpConnector in your server.xml. -- Bill K. -Original Message- From: Jan M. STANKOVSKY [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:16 AM To: [EMAIL PROTECTED] Subject: Re: mysteriously dying connections (Oracle - tomcat) Same here but we have the stopping of the tomcatserver very frequently. At the end of the term when the students (aprox 50 working at the same time) got very busy the tomcatserver stoped replying frequently. We have a configuration with Two Sun Sparc Solaris 7 Servers both tomcat 3.2.1 3.2.2 and one Oracle817 Server on Soalris 7 Once I traped this error: -- 2001-06-19 07:41:23 - ThreadPool: Pool exhausted with 100 threads. 2001-06-19 09:02:25 - ThreadPool: Caught exception executing org.apache.tomcat.service.TcpWorkerThread@3598c3, terminating thread - java.lang.IllegalStateException at org.apache.tomcat.util.ThreadPool.runIt(ThreadPool.java:227) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:405) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) --- As you can see between 07:41:23 09:02:25 (the shutdown of the tomcat server) there was no activity except angry students (times are pm). And this: - 2001-06-20 04:51:10 - Ctx( /a9303541 ): Exception in: R( /a9303541 + /servlet/shop1 + null) - java.lang.NullPointerException at shopmanager.init(shopmanager.java:16) at shop1.init(shop1.java:14) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289) at org.apache.tomcat.core.Handler.service(Handler.java:254) 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.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) 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) 2001-06-20 05:01:12 - ThreadPool: Caught exception executing org.apache.tomcat.service.TcpWorkerThread@2c7887, terminating thread - java.lang.IllegalStateException at org.apache.tomcat.util.ThreadPool.runIt(ThreadPool.java:224) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:405) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) 2001-06-20 05:01:12 - ContextManager: Removing context Ctx( /examples ) 5:01:12 was the time where I shutdowned the tomcat server I now shutdown/restart the server hourly and it seems we don't have unsheduled stoppings. Another thing is, that the servlets dont get refreshed when they are changed/deleted (I have reload in server.xml).. Thanks jan ~| ~|problem: ~| ~| ~|database access is managed via a java class that is ~|instantiated and loaded into each clients session. every ~|PL/SQL function and/or SQL statement a client needs is ~|called in a method of this class. ~|first, a connection is opened, the statement is called, ~|all resultsets and statements are closed and finally the ~|connection is closed. (or returned back to the ~|connection pool if one is used) ~| ~|the driver we use is the Oracle jdbc ThinDriver (jdbc ~|driver type 4). after running the system for several ~|days, dead connections (and as we just discovered, tons ~|of open cursors) pile up. ~|eventually the webserver(tomcat) will crash or just ~|hang. ~|in the process, access gets slower and slower, there may ~|be delays of 3 minutes until the webserver (or,
RE: Javascript not working
I have some jsp files, which work under JRun on our intranet, but when I put them on our server on the internet and open them with a browser, I get a javascript error message in the status bar at the bottom of the browser window. Try debugging the javascript. Both Microsoft (for IE) and Netscape (for NS 4.7) have javascript debuggers. Also, compare the HTML pages generated in the two cases, and see what the difference is (if any). -- Bill K. -Original Message- From: Tassilo Pilati [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:19 AM To: [EMAIL PROTECTED] Subject: Javascript not working Hi, I have some jsp files, which work under JRun on our intranet, but when I put them on our server on the internet and open them with a browser, I get a javascript error message in the status bar at the bottom of the browser window. Since the jsp files are running on the server in the lan, the reason must have something to do with tomcat, but I have absolutely no idea what I`m doing wrong. Is there a special MIME type for using javascript ? TP
RE: Tomcat Version
javax.servlet.ServletContext: getMajorVersion(), getMinorVersion() (returns the version of the JSDK it implements) getServerInfo() (returns a text description of the Tomcat version) -- Bill K. -Original Message- From: Amer Mallah [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:20 AM To: '[EMAIL PROTECTED]' Subject: Tomcat Version Is there any way to get tomcat to return the version/milestone/build date?
RE: what is this number -2147483646
From the JSDK 2.2 spec, available at http://java.sun.com/products/servlet/download.html : The load-on-startup element indicates that this servlet should be loaded on the startup of the web application. The optional contents of these element must be a positive integer indicating the order in which the servlet should be loaded. Lower integers are loaded before higher integers. If no value is specified, or if the value specified is not a positive integer, the container is free to load it at any time in the startup sequence. -- Bill K. -Original Message- From: Venkatesh T [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:43 AM To: tomcat Subject: what is this number -2147483646 HI What is the meaning of the foll. code in web.xml file for startup servlets. load-on-startup -2147483646 /load-on-startup can any one know .. Rgds venkatesh
RE: mysteriously dying connections (Oracle - tomcat)
Eh,... It might have a different name on your version of Oracle, or be under a different schema. Try running, SELECT OWNER, VIEW_NAME FROM ALL_VIEWS WHERE VIEW_NAME LIKE '%OPEN%CURSOR%'; and see what pops up. -- Bill K. -Original Message- From: Adam Myatt [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:54 AM To: [EMAIL PROTECTED] Subject: RE: mysteriously dying connections (Oracle - tomcat) Bill, What if the V_$OPEN_CURSOR is not present in the SYS schema. Using the DBA Studio, I looked through all the schemas and users and V_$OPEN_CURSOR doesn't exist anywhere. Would it be under an alternative name? - Adam At 08:32 AM 6/21/2001 -0700, you wrote: These look like two different issues: 1) Oracle is running out of cursors. a) Make sure you close every ResultSet, Statement and Connection when you're done with them. One trick you can use on Oracle is to log into the database in SQL*Plus as SYS while your application is running, and do, SELECT SQL_TEXT FROM V_$OPEN_CURSOR; to see the SQL for the cursors you have open. b) Try reusing connections and (prepared) statements wherever possible (assuming you use a common Oracle logon for all your accesses). c) Up the number of allowed open cursors, by putting open_cursors = 500 or so in your database's init.ora file. 2) Tomcat is running out of threads. Are you actually getting dozens of people connecting at the same time? Try increasing the max_threads parameter for PoolTcpConnector in your server.xml. -- Bill K. -Original Message- From: Jan M. STANKOVSKY [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:16 AM To: [EMAIL PROTECTED] Subject: Re: mysteriously dying connections (Oracle - tomcat) Same here but we have the stopping of the tomcatserver very frequently. At the end of the term when the students (aprox 50 working at the same time) got very busy the tomcatserver stoped replying frequently. We have a configuration with Two Sun Sparc Solaris 7 Servers both tomcat 3.2.1 3.2.2 and one Oracle817 Server on Soalris 7 Once I traped this error: -- 2001-06-19 07:41:23 - ThreadPool: Pool exhausted with 100 threads. 2001-06-19 09:02:25 - ThreadPool: Caught exception executing org.apache.tomcat.service.TcpWorkerThread@3598c3, terminating thread - java.lang.IllegalStateException at org.apache.tomcat.util.ThreadPool.runIt(ThreadPool.java:227) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:405) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) --- As you can see between 07:41:23 09:02:25 (the shutdown of the tomcat server) there was no activity except angry students (times are pm). And this: - 2001-06-20 04:51:10 - Ctx( /a9303541 ): Exception in: R( /a9303541 + /servlet/shop1 + null) - java.lang.NullPointerException at shopmanager.init(shopmanager.java:16) at shop1.init(shop1.java:14) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289) at org.apache.tomcat.core.Handler.service(Handler.java:254) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:7 9 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Http C onnectionHandler.java:210) 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) 2001-06-20 05:01:12 - ThreadPool: Caught exception executing org.apache.tomcat.service.TcpWorkerThread@2c7887, terminating thread - java.lang.IllegalStateException at org.apache.tomcat.util.ThreadPool.runIt(ThreadPool.java:224) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:405) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) 2001-06-20 05:01:12 - ContextManager: Removing context Ctx( /examples ) 5:01:12 was the time where I shutdowned the tomcat server I now shutdown/restart the server hourly and it seems we don't have unsheduled stoppings. Another thing is, that the servlets dont get refreshed when they are changed/deleted (I have reload in server.xml).. Thanks jan ~| ~|problem: ~| ~| ~|database access is
RE: mysteriously dying connections (Oracle - tomcat)
Is there a sure fire way to have the cursors close when the servlet is done using them. I haven't used connection pooling (it's too easy to write your own that does what you want). But the only sure-fire way to close your ResultSets and Statements is,... call the close() method. The safest way to do that is to use try/finally blocks, like, Statement stmt = ...; try { ResultSet rs = stmt.executeQuery(...); try { // use the results,... } // catch whatever you want here finally { rs.close(); } } // catch whatever you want here finally { stmt.close(); } -- Bill K. -Original Message- From: Adam Myatt [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 9:51 AM To: [EMAIL PROTECTED] Subject: RE: mysteriously dying connections (Oracle - tomcat) All right. I found the sql_text listing in the open cursor view. Is there a sure fire way to have the cursors close when the servlet is done using them. (And if so is using connection pooling and closing the recordset and statement one way?) At 07:33 PM 6/21/2001 +0300, you wrote: you can use v$parameter view for getting OPEN_CURSORS paremeter value. or in sql plus or svrmgrl type show parameter OPEN_CURSORS -Original Message- From: William Kaufman [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 7:12 PM To: '[EMAIL PROTECTED]' tomcat) Eh,... It might have a different name on your version of Oracle, or be under Try running, SELECT OWNER, VIEW_NAME FROM ALL_VIEWS WHERE VIEW_NAME LIKE '%OPEN%CURSOR%'; and see what pops up. -- Bill K.-Original Message- From: Adam Myatt [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:54 AM To: [EMAIL PROTECTED] tomcat) Bill, What if the V_$OPEN_CURSOR is not present in the SYS schema. Using the DBA Studio, I looked through all the schemas and users and V_$OPEN_CURSOR doesn't exist anywhere. Would it be under an alternative name?- Adam At 08:32 AM 6/21/2001 -0700, you wrote: These look like two different issues: 1) Oracle is running out of cursors. a) Make sure you close every ResultSet, Statement and Connection when One trick you can use on Oracle is to log into the database in SQL*Plus as SYS while your application is running, and do, SELECT SQL_TEXT FROM V_$OPEN_CURSOR; to see the SQL for the cursors you have open. b) Try reusing connections and (prepared) statements wherever possible (assuming you use a common Oracle logon for all your accesses). c) Up the number of allowed open cursors, by putting open_cursors = 500 or so in your database's init.ora file. 2) Tomcat is running out of threads. Are you actually getting dozens of people connecting at the same time? parameter for PoolTcpConnector in your server.xml. -- Bill K. -Original Message- From: Jan M. STANKOVSKY [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 8:16 AM To: [EMAIL PROTECTED] tomcat) Same here but we have the stopping of the tomcatserver very frequently. At the end of the term when the students (aprox 50 working at the same time) got very busy the tomcatserver stoped replying frequently. We have a configuration with 3.2.2 and one Oracle817 Server on Soalris 7 Once I traped this error: -- 2001-06-19 07:41:23 - ThreadPool: Pool exhausted with 100 threads. 2001-06-19 09:02:25 - ThreadPool: Caught exception executing org.apache.tomcat.service.TcpWorkerThread@3598c3, terminating thread - java.lang.IllegalStateException at org.apache.tomcat.util.ThreadPool.runIt(ThreadPool.java:227) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:405) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) --- 09:02:25 (the shutdown of the tomcat server) there was no activity except angry students (times are pm). And this: - 2001-06-20 04:51:10 - Ctx( /a9303541 ): Exception in: R( /a9303541 + /servlet/shop1 + null) - java.lang.NullPointerException (shopmanager.java:16) (shop1.java:14) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:268) at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289) at org.apache.tomcat.core.Handler.service(Handler.java:254) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372
RE: Tomcat version
(You know, I just mailed this text _this_morning_,...) javax.servlet.ServletContext: getMajorVersion(), getMinorVersion() (returns the version of the JSDK it implements) getServerInfo() (returns a text description of the Tomcat version) -- Bill K. -Original Message- From: Brian Leader [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 6:01 PM To: '[EMAIL PROTECTED]' Subject: Tomcat version Here is kind of a silly question, but how do I determine the version of Tomcat that is running on my Linux machine other than by look at file dates? Also, I need to integrate SSL. Does Tomcat 3.2.2 support SSL? I heard that 3.2b did. Do I need to build the binaries myself or can I download them from somewhere? Thanks, Brian Brian J. Leader [EMAIL PROTECTED] 818-353-5588 P.O. Box 4307 Sunland, CA 91041
RE: 100% CPU Usage by upload from Netscape under Windows NT
Well, from your description, it sounds like it's a Netscape issue, not a Tomcat issue. Which process is taking the CPU? (Look at the process list in the Windows Task Manager.) If it's actually Tomcat sucking CPU, activate the window Tomcat is running in, and hit Ctrl+Break: that will give you a list of what's currently running. (Ignore any threads stuck in Object.wait(), obviously,...) If it's Netscape, try rummaging around their web site--maybe http://help.netscape.com/ ,... -- Bill K. -Original Message- From: Zsolt Koppany [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 12:10 AM To: [EMAIL PROTECTED] Subject: 100% CPU Usage by upload from Netscape under Windows NT Hi, when the user uploads files from Windows-NT-4.0 with Netscape-4.75 the CPU usage is 100%. Even when netscape is waiting for the response from the server it still has 100% CPU usage. What is the reason and can it be fixed? With IE we don't have this problem. Zsolt -- Zsolt Koppany Intland GmbH www.intland.com Tel: +49-711-7221873 Fax: +49-711-7221835
RE: Adding data to HTTP header responses?
http://java.sun.com/products/servlet/2.2/javadoc/index.html Look for Header in javax.servlet.http.HttpServletRequest and javax.servlet.http.HttpServletResponse. -- Bill K. -Original Message- From: Joe Dalessandro [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 10:39 AM To: [EMAIL PROTECTED] Subject: Adding data to HTTP header responses? 2001-06-20 Hello I am in the process of making our site P3P compliant. We are running Tomcat 3.2.2 on a Linux box. I am looking for information regarding adding data to HTTP header responses(see example below). One of the aspects of P3P compliancy is referencing where a Policy is located and referencing the Compact Policy via the CP tag. I need to add these values and as I am new to Tomcat I need know where to find the header information. !-- example -- HTTP/1.1 200 OK P3P: policyref=http://somesite.com/P3P/PolicyReferences.xml;, CP=NON DSP COR CURa ADMa DEVa CUSa TAIa OUR SAMa IND Content-Type: text/html Content-Length: 8104 Server: ... ...content... !-- end example -- Any suggestions would be appreciated. Joe Dalessandro --- e: [EMAIL PROTECTED]
RE: duplicate posts
Are you sure they're not double-clicking the submission control? Are these the kind of users who know the difference between a single-click and a double-click? Is it only happening with one user and not another? (Can you tell that from your logs?) (I find that many users single-click buttons and double-click anchors--I guess, because that's the way Windows generally works--so I only use an anchor if double-clicking doesn't have side-effects, like inserting two records in a database.) -- Bill K. -Original Message- From: Scott Weaver [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 8:33 AM To: [EMAIL PROTECTED] Subject: duplicate posts I'm running Tomcat 3.2.1 I have a servlet that receives posted data from a client. Some times I receive duplicate posts (the data is exactly the same...the message can't be because of some unique attributes included with the data). The client claims they are not sending duplicate messages so I'm wondering if any of you out there have ever encountered this problem. It doesn't happen all the time but it is happening. I have checked my servlet log (stdout.log) and from my servlet's point of view I am receiving 2 separate distinct posts (time stamp is milliseconds apart). Any advice? Thanks, Scott
RE: how to make a war file?
- is war-file a jar-file? Yes, except it's got some extra entries, and it ends in .war. See the servlet spec, at http://java.sun.com/products/servlet/2.2/ , for more information on the WAR file format. - which command/tool can I use to do it? jar. -- Bill K. -Original Message- From: Bo Xu [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 8:38 AM To: [EMAIL PROTECTED] Subject: how to make a war file? Hi :-) could anybody tell me how to put a myapp/Servlet-context into a war file? I can do something similar with J2EERI, but I don't know how to do it by myself: - is war-file a jar-file? - which command/tool can I use to do it? thanks in advance! Bo June 19, 2001
RE: memory allocation
The only time you need to set a variable to null is when the variable itself sticks around (e.g., a class variable, or an instance variable on some object on a class variable). You never have to null out local variables. This is a general Java question, not a Tomcat question. If my answer didn't make sense, ask on news:comp.lang.java.programmer, or on a Java mailing list. -- Bill K. -Original Message- From: Luba Powell [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 14, 2001 12:11 PM To: [EMAIL PROTECTED] Subject: Re: memory allocation Not to worry. The only time that I know you need to set objects to null is when you write servers and inside you (while (true).. eternal loop. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 14, 2001 1:41 PM Subject: memory allocation hi all , i want to ask something about jsp pages sample jsp code = ** %@ page import = java.util.* % %@ page import = MyBean % %@ page contentType=text/html;charset=ISO-8859-9 % jsp:useBean id=my_bean class=MyBean scope=page/ html head % ArrayList al = new ArrayList(); mybean.showData(al); // we are going to fill ArrayList Iterator it = al.iterator(); while( it.hasNext() ) { % %=(String)it.next()% % } //while al = null ; // should i do this ? or is it going to be garbage collected by itself it = null ; // shoul i do this ? or is it going to be garbage collected by itself % /head /html ** my_bean object will be garbage collected because it' scope is page but what about ArrayList and Iterator objects ? thanks Regards Altug B. Altintas
RE: Windows 2000 problems with HttpSession
1) Do you have cookies turned on in your browser? 2) Did you call HttpServletResponse.encode[Redirect]URL() on all your links? (See the javadoc for that method.) -- Bill K. -Original Message- From: James Manna [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:39 AM To: [EMAIL PROTECTED] Subject: Windows 2000 problems with HttpSession Hi All, I am having problmes with maintaing sessions on a win 2000 machine running tomcat 3.2.1. I seem to always get a new session everytime. We are only having this problme on some of our development machines. A basic example servlet that returns html works fine on all machines and maintains session state. The full system uses an Applet, serialized objects, request dispatching and forwarding, multiple servlets, DB backend etc. It works fine on some machines and not on others. All machines are runnig Win 200 with the same user, and environment variable setup etc I access the session in the main servlet and access it after I forward it on to other servlets. Any one got even any remote thoughts? We have investigated: - using windows machine name and IP instead of localhost:8080 - variations in tomcat config - variations in source code But no luck so far. Regards James Manna Power Solutions
RE: Problem in access control of resources
MS Word documents should use application/msword. (See the registry of MIME types at ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types .) -- Bill K. -Original Message- From: Hemant Singh [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 7:58 PM To: [EMAIL PROTECTED] Subject: Re: Problem in access control of resources HI Again Pankaj: When it comes to rendering of browser, i will say it all depends on headers that you send it from servlet, if send the right header applicable for word ( i guess application/doc, if not let me know i will checkout and find the correct one for u), than there is just no reason that why browser will not render it as a doc file, But here you are not only making ur website platform dependent but also browser dependent as in case of IE it is offcourse capable of opening the word file as inprocess because of IE have a plugin for it, But what about Netscape, he will offcourse bring the dialog box asking the user that whether he wishes to download it or not(Whatever) Regards Hemant - Original Message - From: Pankaj Chhaparwal To: [EMAIL PROTECTED] Sent: Monday, June 11, 2001 10:25 AM Subject: Re: Problem in access control of resources Hi Hemant, The user should have both the options to view it or download it. The problem with streaming is that it is somewhat slow(since you have to first read it and then write it in a stream).The second issue is that for e.g. if I read a word document in a stream and then write it in a stream , the browser doesnt know that its a word document and just renders it as a txt document. In the case of word docs and xls the output on the browser is all junk. Please let me know what you think on this. Thanks a lot for your help Hemant. Regards, Pankaj At 06:43 PM 2/10/2000 +0530, you wrote: HI Pankaj: How you transfer the word documents to the client? I mean you expect user to download it, or view it in there web browser? In both ways what you can do is that instead of redirecting the client to word files, you read those word files in your jsp or servlet and write that file to users stream, And as you jsp or servlet will always have maintained in session(or whatever) that user has logged in or not, so i guess this will solve your problem. Regards, Hemant - Original Message - From: Pankaj Chhaparwal To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 7:58 AM Subject: Problem in access control of resources Hi All, Servlet spec 2.2 states I am using Apache and Tomcat to build my website. The adapter is JServ.I have certain word documents which have to be displayed on the browser on demand from the end user. I dont want to end users to view these documents unless they have logged into the system. What happens right now is that user can see the url of word document when the jsp redirects him to word document on receiving the request. He can then access the document from the webserver even if he has not logged into the website. Is there anyway I can prevent this from happening? Ideally I would like Apache to serve all the word documents since they are static files. But I am also considering Tomcat to serve this file. Also I have another question on access control. Servel 2.2 spec states the following Access control for resources: The mechanism by which interactions with resources are limited to collections of users or programs for the purpose of enforcing availability, integrity, or confidentiality. How can we limit interaction with resources to collections of programs? Any help on this would be greatly appreciated. Thanks Regards, Pankaj
RE: Java Question
public static String getYear(String str){ synchronized(str){ newStr = str.substring(0,4); return newStr; } } While your use of synchronize is correct, _this_ synchronization is not necessary at all. java.lang.String is unmodifiable: there's nothing you can do with it that might conflict with what another thread will do with it. So, you never have to worry about conflicts, and you never need to synchronize. The answer is, 1) You need to synchronize when two threads running code might modify the same data at the same time. 2) You need to synchronize on the exact same object around all code which modifies a given bit of data. 3) Never synchronize on java.lang.Class objects. The only issue about static/non-static in there is that synchronizing a static method effectively synchronizes on the object's Class, which is a no-no. (You might want to read up on concurrency--see Doug Lea's Concurrent Programming, or his web site, http://g.oswego.edu/ .) -- Bill K. -Original Message- From: Brandon Cruz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2001 11:56 AM To: [EMAIL PROTECTED] Subject: RE: Java Question So would changing something simple from... public static String getYear(String str){ newStr = str.substring(0,4); return newStr; } to... public static String getYear(String str){ synchronized(str){ newStr = str.substring(0,4); return newStr; } } be correct if I want to avoid having incorrect results returned when accessed by multiple threads? It compiles like that, but is that all that is needed to synchronize something? Brandon -Original Message- From: Luba Powell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2001 1:52 PM To: [EMAIL PROTECTED] Subject: Re: Java Question Actually the outcome is predictable: monitorenter will obtain objectref on this (aload_0) * if no other thread has locked the object * if the object is currently locked by another thread (monitorenter instruction) * if the current thread already owns a lock - the lock is released when the counter returns to 0 .method static doSort([I)V aload_0 monitorenter ; sensitive code monitorexit ... return end method - Original Message - From: Brandon Cruz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 12, 2001 2:18 PM Subject: Java Question - Original Message - From: Pae Choi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 12, 2001 2:41 PM Subject: Re: Java Question When you access the 'synchronized' static method, it locks its class. so this will ensure the thread-safe access. Otherwise, the result is unknown. Pae I have looked all over and can't find the answer to this simple question. If you use a static method, do you have to synchronize it in case other people may access it at the same time. For example, I have a static Utility class to do date calculations. The method Utility.getMonth(String date) takes in a full date string, parses it, and returns just the month value. If 5 different people all using the website attempt to use Utility.getMonth(String date) at the same time for different dates, will it return the right results? If not, do I have to synchronize it or something in case multiple users attempt to access it? I know this is not really related to tomcat, but since I am using tomcat, and everyone else using tomcat is also a java developer, I figured this is the best place I can ask. Thanks for any help!!! Brandon
RE: Session timeout during long file upload
Are you sure it's the _session_ timeout, not the browser's connection timeout? The session timeout defaults to 30 minutes. That should be plenty of time to load anything, even a Word document at 9600 baud,... More likely, the browser is timing out when it doesn't get a response quickly enough. There are several things you could do for this: 1) Do some profiling on your code to find out why it's taking a long time to process the data. One profiler is jprof, which comes with the Sun JDK (see the Sun webpage, at http://java.sun.com/j2se/, for more info). Others are JProbe (www.jprobe.com) and JInsight (http://www.alphaworks.ibm.com/tech/jinsight). 2) If processing the file must take a long time, don't do it while the browser is waiting. Instead, fork a new thread to do the processing, and return a web page immediately. 3) If you can't do that, at least return _some_ of the page immediately--say, a header saying that you're working on it. Call flush() on the output stream before starting the processing. (Note that this isn't guaranteed to work--the servlet engine or the network layer might buffer the page until you write a ton of data, or you close the connection. But it works on my PC running Tomcat and IE locally.) -- Bill K. -Original Message- From: Tal Dayan [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 1:30 PM To: [EMAIL PROTECTED] Subject: Session timeout during long file upload Hello, When we try to upload a long file to a servlet we encounters a problem with the session timeout because of the long time it takes to upload the file over a slow connection (sometimes several hours). It seems that the problem is in the way the session timeout is specified in the servlet session. It measures time between request, not just idle time (no activity related to that session). A possible solution would be to increase the session timeout to several hours but this will affect also affect the automatic logout of users after a predefined idle time period (by the automatic invalidation of the session). Is there a way to reset the session timer as if a new request has arrived ? With this option, we could add to the loop that reads the incoming files a periodic call that will reset the session timeout (watchdog). Thanks, Tal
RE: Reloading changed servlets problem
I think the reason no one responded was, you didn't say _what_ problem you had. If you're getting an exception/error somewhere, post the stack trace, and the line of code where it happened. If it's just that the servlet didn't reload, it might be a problem with the timestamp on the file (esp. if the directory is remotely mounted),... -- Bill K. -Original Message- From: RANDRIAMPARANY Honitriniela [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 1:01 AM To: [EMAIL PROTECTED] Subject: Reloading changed servlets problem Hi, Not having received a response for my mail, I would like to send it again. It is very significant for us to have Tomcat that is able to reload the changed servlets since we use it for the exercises of the students in a computer science course. So, please help me. I put my original message below. We use Tomcat-3.2.1 standalone. -- Honitra. original message -Date: Wed, 06 Jun 2001 14:15:33 +0200 From: RANDRIAMPARANY Honitriniela [EMAIL PROTECTED] Subject: Reloading changed servlets problem To: [EMAIL PROTECTED] Hi, I use tomcat-3.2.1. I still have problem with the reloading of changed servlets whereas I have the following entry in the server.xml file. Context path=/TP_genielog docBase=webapps/TP_genielog crossContext=false debug=0 reloadable=true /Context I read this in the FAQ: Note: Do NOT include the classes or .jar files from WEB-INF directories for which you want to enable automatic servlet reloading in the CLASSPATH of the shell that starts Tomcat. I followed this instruction. The reloading worked fine for a moment, and then the problem arised again. Could somebody say me what I must do? How can one erase the cache memory of Tomcat? Thanks for any help. -- Honitra.
RE: Problem: Using Tomcat 3.2.1 on NT 4.0 SP5, get Internal Servlet E rror on writing POST response approx. 800kb in length
Location: /servlet/MyServlet Internal Servlet Error:java.lang.ArrayIndexOutOfBoundsException: 10 at MyServlet.doPost(MyServlet.java:157) This isn't a Tomcat issue: _your_ code is throwing an ArrayOutOfBoundsException, at line 157. Moreover, the code you posted doesn't look like it'd throw such an exception; line 157 must be a line you didn't post. -- Bill K. -Original Message- From: Barry Draper [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 12:55 PM To: [EMAIL PROTECTED] Subject: Problem: Using Tomcat 3.2.1 on NT 4.0 SP5, get Internal Servlet E rror on writing POST response approx. 800kb in length Using Tomcat 3.2.1 on NT 4.0 SP 5, I have a servlet which sends XML-encoded strings in response to POST requests. When the XML -encoded response is approximately 800 bytes in length (my test case is 889 bytes - I don't know the exact threshold yet), I get the following error: Error: 500 Location: /servlet/MyServlet Internal Servlet Error:java.lang.ArrayIndexOutOfBoundsException: 10 at MyServlet.doPost(MyServlet.java:157) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) 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.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) 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:479) I tried increasing the ServletResponse buffer size to 64kb (the default is 8kb) and also setting content length as follows: public void doPost( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... response.setContentType(text/plain); response.setBufferSize(64 * 1024); PrintWriter out = response.getWriter(); ... String result = null; // do processing which sets result string int len = result.length(); response.setContentLength(len); ... out.println(result); I verified that the response buffer size was increased to 64kb and the content length was set correctly. Still, I get the error on writing the response. Is this a known problem with a fix? Am I doing something wrong? Please advise. Thanks. Barry Draper [EMAIL PROTECTED]
RE: Messages
See this posting: http://marc.theaimsgroup.com/?l=tomcat-userm=98770302314327w=2 -- Bill K. -Original Message- From: Daniel de Almeida Alvares [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 7:03 AM To: Tomcat-user Subject: Messages Hi, When I run my webpages they run correctly but this kind of messages appear at tomcat window: 2001-06-06 11:00:29 - Ctx( /cnpi ): IOException in: R( /cnpi + /jsp/index2.jsp + null) Connection reset by peer: socket write error 2001-06-06 11:00:29 - Ctx( /cnpi ): IOException in: R( /cnpi + /jsp/index2.jsp + null) Connection reset by peer: socket write error What is happening ??? Regards and thanks Daniel ___ Daniel de Almeida Alvares Santos - SP - Brasil [EMAIL PROTECTED]
RE: Questions about Tomcat Cookies
1) If the cookies are not found in the directory , where are they ? In memory. The cookie is set with an expiration of -1, which suggests to the browser that it shouldn't bother writing it to disk. 2) If I disable cookies in the browser , still session tracking will work ? Your servlet needs to call HttpServletResponse.encode[Redirect]URL() on each URL it outputs, to add the session ID to the URL. 3) What exact combination does tomcat uses of cookies + URL re-writing It uses cookies if enabled, URL re-writing (with the servlet's help) if not. 4) If Tomcat is used with Apache , then which one sets the cookies ? Tomcat, AFAIK. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 4:25 AM To: [EMAIL PROTECTED] Subject: Questions about Tomcat Cookies Hi, I have used tomcat as standalone and w/ apache also. In my applications , session tracking is working fine. To the best of my knowledge , Tomcat does session tracking by combining use of 1) Cookies 2) URL re-writing. My browser alerts me , when tomcat tries to set the cookie. But when i see cookies folder of my Win NT machine (C:\Winnt\profiles\Administrator\cookies) , I didn't found any cookie by name 'JSESSIONID' MY QUESTIONS ARE : 1) If the cookies are not found in the directory , where are they ? 2) If I disable cookies in the browser , still session tracking will work ? 3) What exact combination does tomcat uses of cookies + URL re-writing 4) If Tomcat is used with Apache , then which one sets the cookies ? TIA Regards, -Amit. Sansui Software Pvt. Ltd.
RE: Jakarta Tomcat NT service stopping itself
And to remind folks, the archives are at two locations: http://marc.theaimsgroup.com/?l=tomcat-user http://tomcat.mslinn.com/ (under Listservs) -- Bill K. -Original Message- From: Randy Layman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 6:43 AM To: [EMAIL PROTECTED] Subject: RE: Jakarta Tomcat NT service stopping itself Your problem is not reading the mailing list archives. This morning several people were discussing this issue. The problem is a bug in Sun's 1.3 JVM on NT handles the user logoff event incorrectly. Sun has reported this fixed in the 1.3.1 version and several users here had confirmed it, but today someone indicated that the fix wasn't working for them. I would suggest (besides putting a little effort into your investigation before asking questions) downgrading your JVM to the latest 1.2 (since earlier versions have threading issues). Also, there exists wrappers around the JVM that trap this logoff event and don't pass it to the JVM (called JavaService.exe), but I would suggest going with a plain JVM with no wrapper unless you really need 1.3 and find that 1.3.1 doesn't work for you. (Why introduce more layers with more complexity and the possibility of more bugs when its not needed.) Randy -Original Message- From: Tim Hughes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 10:09 AM To: [EMAIL PROTECTED] Subject: Jakarta Tomcat NT service stopping itself I have just set up Tomcat to run as an NT service (carefully following the how to from the doc). Everything works fine while I am logged on to the machine that I have set the service up on i.e. I can connect up from a client and request servlets and jsps. However, when I log off from the server it appears that the service is stopping, Tomcat will not service requests. This is confirmed by the fact that when I log back on again, the service has been stopped. When I look in Control Panel\Services, the tomcat service is set up exactly the same way as other services and these services work fine (whether I am logged on to the server or not). Any suggestions on what might be the problem? Tim. Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie
RE: download files using ftp
Do you mean you're trying to do an FTP download _of_ Java _in_ Java? I wouldn't attempt this: there's one form (the license agreement) followed by another form (the FTP download site selection). And Sun would probably consider bypassing the forms (if possible) as legally questionable, especially the license agreement. If you're just trying to do an FTP download in Java (of something else), look at http://java.sun.com/j2se/1.3/docs/api/java/net/URL.html specifically, URL.openConnection(). -- Bill K. -Original Message- From: aswath satrasala [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 6:57 AM To: [EMAIL PROTECTED] Subject: download files using ftp Hi, I have seen on Sun's web site, an option to download JDK using ftp download. Are there any samples to do this. Please point to the documentation. Thanks -Aswath From: François Andromaque [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: TOMCAT and APACHE Date: Tue, 5 Jun 2001 15:44:07 +0200 I've configured separately apache to work with SSL and TOMCAT to establish a distant database connection, i would like know to make the both to work together. If mod_jk is really necessary, what are the steps to compile it? _ Get your FREE download of MSN Explorer at http://explorer.msn.com
RE: About GET and POST methods
Look at the method attribute of the form element in HTML, and form submission: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13 -- Bill K. -Original Message- From: Swart, James (Jim) ** CTR ** [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 7:51 AM To: '[EMAIL PROTECTED]' Subject: RE: About GET and POST methods as far as I know, if you are going to send information to a servlet from a input form (html or jsp) you have to use a GET when invoking the servlet? At least, that's how mine are developed. -Original Message- From: Rainer Schweigkoffer [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 7:07 AM To: [EMAIL PROTECTED] Subject: About GET and POST methods Hi folks ! Being a newbie concerning the use of Tomcat I am marvelling about the following : On SunOS 5.8 I have installed Tomcat 3.2.1 connected to Apache 1.3.19 via mod_jk.so with both an AJP12 (port 8007) and an AJP13 (port 8009) handler installed. The Apache Server is listening on ports 80, 1080, 2080 and 8080, while, for test purposes, I added a Tomcat Http Connection handler on port 7080. Now, we have written a test servlet with differing doGet and doPost methods and an HTML page containing a form that uses method POST, and we observe the following behaviour : o When defining the form's action to directly invoke the servlet via Tomcat on port 7080, method doPost is invoked, o however, when defining action to invoke the servlet via Apache on one of the other ports mentioned above, always method doGet is invoked. Is there any explanation for that - at least to me - surprising behaviour ? Did I overlook anything ? Or is it intended to work that way ? Thank you very much for your kind assistance Rainer -- All statements above reflect my personal opinion only. Speaking for my company is highly above my salary.
RE: About GET and POST methods
On the browser side: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13 On the servlet side: http://java.sun.com/products/servlet/download.html -- Bill K. -Original Message- From: Nael Mohammad [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 9:40 AM To: '[EMAIL PROTECTED]' Subject: RE: About GET and POST methods Where can I find information to learn about the proper Get and post methods? CONFIDENTIALITY NOTICE: This e-mail may contain confidential information that is legally privileged. Do not read this e-mail if you are not the intended recipient. This e-mail transmission, and any documents, files or previous e-mail messages attached to it may contain confidential information that is legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify us by reply e-mail or by telephone at (415) 403-7300, and destroy the original transmission and its attachments without reading or saving in any manner. Thank you. -Original Message- From: Swart, James (Jim) ** CTR ** [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 9:35 AM To: '[EMAIL PROTECTED]' Subject: RE: About GET and POST methods *ducks to avoid the swinging claws* Thanks for the info! -Original Message- From: Jose Euclides da Silva Junior - DIGR.O [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 9:04 AM To: [EMAIL PROTECTED] Subject: RES: About GET and POST methods -BEGIN PGP SIGNED MESSAGE- No, i guess you are wrong! You can use either get(doGet) or post(doPost) method ! The only difference between them is the following: Get command sends data through get' header and Post sends data through new http headers. This is a HTTP RFC. The problem below seems to be very strange. José Euclides Júnior __ E-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] http://euclides.8m.com - -Mensagem original- De: Swart, James (Jim) ** CTR ** [SMTP:[EMAIL PROTECTED]] Enviada em: Terça-feira, 5 de Junho de 2001 11:51 Para: '[EMAIL PROTECTED]' Assunto: RE: About GET and POST methods as far as I know, if you are going to send information to a servlet from a input form (html or jsp) you have to use a GET when invoking the servlet? At least, that's how mine are developed. - -Original Message- From: Rainer Schweigkoffer [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 7:07 AM To: [EMAIL PROTECTED] Subject: About GET and POST methods Hi folks ! Being a newbie concerning the use of Tomcat I am marvelling about the following : On SunOS 5.8 I have installed Tomcat 3.2.1 connected to Apache 1.3.19 via mod_jk.so with both an AJP12 (port 8007) and an AJP13 (port 8009) handler installed. The Apache Server is listening on ports 80, 1080, 2080 and 8080, while, for test purposes, I added a Tomcat Http Connection handler on port 7080. Now, we have written a test servlet with differing doGet and doPost methods and an HTML page containing a form that uses method POST, and we observe the following behaviour : o When defining the form's action to directly invoke the servlet via Tomcat on port 7080, method doPost is invoked, o however, when defining action to invoke the servlet via Apache on one of the other ports mentioned above, always method doGet is invoked. Is there any explanation for that - at least to me - surprising behaviour ? Did I overlook anything ? Or is it intended to work that way ? Thank you very much for your kind assistance Rainer - -- All statements above reflect my personal opinion only. Speaking for my company is highly above my salary. -BEGIN PGP SIGNATURE- Version: PGP 6.5.1 iQCVAwUBOx0fNd0YhuJ3BUxtAQHEngP7B9RPn8VyEnrLlFWbGslZCXJVt4BYCig0 2jsA64OGZwoAyLVjvQ0Vys/jUjtt72IUwxRpMLifITP6mIOAMSNhq2tD/5ZrpYOb mWskDp5EU9DBoFm2rRMna8s5JQtn2z/gQ24CYl7V6SysuUMCl59FJO8s5qE9HznI T1vUGWZy6Kc= =Wxt7 -END PGP SIGNATURE-
RE: Netscape crash!
You might need to specify the content type to convince Netscape that the content is HTML (while IE just looks for an html tag). Try, HttpServletResponse resp; resp.setContentType(text/html); before streaming the XSL results. You can also try adding, xsl:output method=html media-type=text/html to the top of your XSL stylesheets. (See the XSLT spec, at http://www.w3.org/TR/xslt.html, for more info.) -- Bill K. -Original Message- From: Carlos Mayorga [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 05, 2001 10:44 AM To: [EMAIL PROTECTED] Subject: Netscape crash! Hello, We have a problem with tomcat (v. 3.2.1) / apache (v.1.3.14), xsl and netscape 6. We cannot see the pages correctly. The pages are processed for the xsl proccesor, but we see in Netscape 6 the html code. In Explorer we don't have any problem. The Netscape shows exactly the same that if I push the button View page source. Thanks in advance, Carlos Mayorga. TADECOM
RE: get/setAttribute and getParameter...
Hemant's right, that performance is often dependent on many things,... but doing new Boolean is guaranteed to be slower. If you look at the source of java.lang.Boolean, you'll see that the your version of the code is identical to what Boolean itself does: therefore, using Boolean is no win (and is a possible loss, since it's an extra method call). But anytime you create an object (like new Boolean), that will _always_ slow you down on creation, on garbage collection, and possibly on memory fragmentation. If you really want to use Boolean instead of a string literal, you can mitigate the problem by using Boolean's static methods, and not creating a Boolean. For instance, replace, new Boolean(true) with Boolean.TRUE and new Boolean(String).booleanValue() with Boolean.getBoolean(String) But using a string literal is no bad thing: since literals are intern()'ed (see the javadoc for java.lang.String.intern()), more copies of the same literal take no extra memory. Even better, you can use simple equality (==) instead of Object.equals() to compare them. So, you can do something like, JSP1: % request.setAttribute(FLAG, true); % jsp:include page=JSP2.jsp flush=true/ JSP2: % if (request.getAttribute(FLAG) == true) { /* ... */ } % (At a guess, setAttribute()/getAttribute() is going to be faster than getParameter(), just because you avoid parsing the request string, but it's worth comparing the two.) -- Bill K. -Original Message- From: Hemant Singh [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 03, 2001 1:45 PM To: [EMAIL PROTECTED] Subject: Re: get/setAttribute and getParameter... HI Zinger: answer to this question depends on env conditions setAttribute method stores the attribute in JVM itself for every session, while set parameter will pass the attribute as a header information to you new jsp. So it all depends on memory available, cpu speed, and no of pages you are going to use this technique. Cheers Hemant - Original Message - From: Oskar Zinger [EMAIL PROTECTED] To: TomcatDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, June 03, 2001 12:15 AM Subject: get/setAttribute and getParameter... Hi, What is more time consuming? JSP1: % request.setAttribute(FLAG, new Boolean(true)); % jsp:include page=JSP2.jsp flush=true/ JSP2: % boolean FLAG = ((Boolean) request.getAttribute(FLAG)).booleanValue(); if (FLAG) { .. ... } % OR?: JSP1: jsp:include page=JSP2.jsp?FLAG=true flush=true/ JSP2: % String FLAG = request.getParameter(FLAG); if (FLAG.equals('true)) { .. .. } % OR?: JSP1: jsp:include page=JSP2.jsp?FLAG=true flush=true/ JSP2: % boolean FLAG = (new Boolean(request.getParameter(FLAG))).booleanValue(); if (FLAG) { .. .. } % AND, which way is it best practiced. Thankss for any help! -- Oskar Zinger
RE: IE calls servlet multiple times for one request
Most likely, your problem is the same as the one spelled out here: http://marc.theaimsgroup.com/?l=tomcat-userm=98770302314327w=2 -- Bill K. -Original Message- From: Rod Frey [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 11:53 AM To: [EMAIL PROTECTED] Subject: IE calls servlet multiple times for one request I've got a threading issue that I can't work out. I've got a servlet that gets called from my web application. It takes an object model that's stored in the session, asks the object model to cough up a representation of itself in XML-FO, then generates a PDF representation using FOP. It then writes that to the response output stream. The servlet is mapped to the name report.pdf:, because using that extension seems to be the only way I can get IE to open the thing inline, even tho' I call resp.setContentType(application/pdf). (IE reports the content-type as text/html, although other browser seem to get it fine). Other browsers work fine. That's not the item, though. The item is that my servlet gets called four times in succession by IE. Eventually, (on the fourth go), the servlet throws an IO exception (Broken Pipe) on the out.write(byte[]) call that I use to write the PDF file to the Servlet's outputstream. After that, the file displays fine in IE. Here's the code after the PDF is generated and put into the byte[] data: outs = resp.getOutputStream(); resp.setContentType(application/pdf); resp.setContentLength(data.length); resp.setDateHeader(Expires, 0L); resp.setHeader(Cache-Control, no-cache); outs.write(data); outs.flush(); resp.flushBuffer(); The outputstream is closed in a finally block. I've also tried wrapping the outputstream in a bufferedoutput stream. I've also tried a call to resp.setBufferSize(data.length); neither of which had any effect: IE calls the servlet four times; the fourth time the call to outs.write(data) fails with an IO exception, and the page displays successfully in the IE window. This doesn't happen with other browsers: Netscape and Opera both call the servlet only once. I could live with it (big hack: just catch the fourth-call IO exception), except generation of the PDF is a 4-5 second operation. The data I'm sending is about 200k in length. Any ideas? Rod
RE: URL Help
I can only get it to work if I include 'servlet' like the following: http://localhost/Gillette/servlet/Venus?SerialId=ZVXZVContactId=1 ... web.xml: servlet servlet-nameVenus/servlet-name servlet-classGVservlet/servlet-class /servlet Which is the name of your servlet class--Venus or GVservlet? (That may be the problem you're having,...) -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, June 04, 2001 2:48 PM To: [EMAIL PROTECTED] Subject: URL Help I need my URL to look like this: http://localhost/Gillette/Venus?SerialId=ZVXZVContactId=1 where Gillette is a directory and Venus is the servlet name. I can only get it to work if I include 'servlet' like the following: http://localhost/Gillette/servlet/Venus?SerialId=ZVXZVContactId=1 I've got a few good responses in previous postings but haven't been able to get it to work. Here is some configurationscan anybody tell me what I'm doing wrong? server.xml: Context path=/Gillette docBase=webapps/Gillette crossContext=false debug=0 reloadable=true /Context web.xml: servlet servlet-nameVenus/servlet-name servlet-classGVservlet/servlet-class /servlet servlet-mapping servlet-nameVenus/servlet-name url-pattern/Venus/url-pattern /servlet-mapping I've tried it with and without the servlet-mapping tag. Any ideas? Jason E. Brawner
RE: Security Questions
RequestInterceptorclassName="org.apache.tomcat.request.AccessInterceptor" debug="0" / From that class' javadoc: * Access control - find if a request matches any web-resource-collection* and set the "required" attributes.** The spec requires additive checking ( i.e. there is no "best match"* defined, but "all requests that contain a request path that mathces the* URL pattern in the resource collection are subject to the constraing" ).** In "integrated" mode this interceptor will be no-op, we'll use the* web server ( assuming we can map the security to web-server equivalent* concepts - I think we can do that, but need to experiment with that) RequestInterceptor className="org.apache.tomcat.request.SimpleRealm" debug="0" / From that class' javadoc: * Memory based realm - will authenticate and check the permissions* for a request using a simple, in-memory list of users.* This is for "demo" purpose only, to allow auth in standalone tomcat* for developers.** There are no restrictions or rules on how to authenticate - you have* full control over the process. I don't seem to have a simple xml file, should I? You do: it's named $TOMCAT_HOME/conf/tomcat-users.xml . -- Bill K. -Original Message-From: Gerry Duhig [mailto:[EMAIL PROTECTED]]Sent: Wednesday, May 30, 2001 4:00 AMTo: [EMAIL PROTECTED]Subject: Security Questions Hi! I have Tomcat setup, actually running with JBoss, and I am looking at security. I can setup an application with a login-conf in web.xml, but I cannot see who or what handles that. Is it Tomcat directly, or some loaded subsystem? In detail: In my server.xml file I have thefollowing: RequestInterceptorclassName="org.apache.tomcat.request.AccessInterceptor" debug="0" / What is this actually saying or doing? I also have: !-- Check permissions using the simple xml file. You can plug more advanced authentication modules. -- RequestInterceptor className="org.apache.tomcat.request.SimpleRealm" debug="0" / Same question! What's it for, what's it do? I don't seem to have a simple xml file, should I? Gerry
RE: servlet error..
The AWT classes need an x-server to work with images. Worse yet, the server has to be unlocked: you can't connect to a locked server. -- Bill K. -Original Message- From: Ralph Einfeldt [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 11:52 PM To: '[EMAIL PROTECTED]' Subject: AW: servlet error.. The AWT classes need an x-server to work with images. Can it be that there isn't one running, when this error happens ? -Ursprüngliche Nachricht- Von: Krishna Kishore Thotakura [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 30. Mai 2001 01:05 An: [EMAIL PROTECTED] Betreff: servlet error.. Hi, i am trying to write an image to the outputstream of a servlet. The image is actually obtained from an invisible awt Canvas. I'm using Jimi package to encode the Image into JPEG format and writing this out to the ServletOutputStream. Sometimes this works fine and i see a nice image in the browser but at times, i get the following error: in tomcat.log Xlib: connection to :0.0 refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key in browser --- Error: 500 Location: /wms/servlet/WmsServlet Internal Servlet Error: java.lang.NoClassDefFoundError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:120) at java.awt.Toolkit$2.run(Toolkit.java:498) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:489) at java.awt.Component.getToolkitImpl(Component.java:657) at java.awt.Component.getToolkit(Component.java:641) at java.awt.Component.createImage(Component.java:2265) at stt.View.ViewJava3D.initMem(ViewJava3D.java:190) at stt.View.ViewJava3D.(ViewJava3D.java:214) at stt.Display.DisplayManager.initView(DisplayManager.java:126) at stt.Display.DisplayManager.(DisplayManager.java:64) at sttx.Display.GeoDisplayManager.(GeoDisplayManager.java:79) at WmsServlet.init(WmsServlet.java:49) Any comments,suggestions,explanations would be greatly appreciated.
RE: Using JDBCRealms
It turned out I was being an idiot: I modified tomcat/conf/server.xml, where our batch file was actually executing Tomcat with -f /some/where/else/server.xml. Once I put it in the right file, everything worked fine, so I don't know how much help my responses would be. (You could look through the archives at one of, http://tomcat.mslinn.com/ http://marc.theaimsgroup.com/?l=tomcat-userr=1w=2 Maybe you should post the problem(s) you're having, and whatever debug info you're getting,... -- Bill K. -Original Message- From: Ben Sifuentes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 7:49 AM To: [EMAIL PROTECTED] Subject: RE: Using JDBCRealms I'm trying to utilize teh JDBCRealm also. I see you are trying to get some of the same information I am. Did you get a response for your previos e-mail -Ben -Original Message- From: William Kaufman [mailto:[EMAIL PROTECTED]] Sent: Friday, March 16, 2001 8:05 PM To: Tomcat Users (E-mail) Subject: Using JDBCRealms (Tomcat version 3.2.1.) I'm trying to use JDBCRealm to manage access to some static files. Is there any documentation for that? I've successfully configured authorization in web.xml (though it only seems to work if the files are under webapps/ROOT--that's OK for what I'm doing, but I am curious about why that is). But I can't seem to get JDBCRealm (or my own subclass of that) to get called. I've added, RequestInterceptor className=org.apache.tomcat.request.JDBCRealm debug=99 driverName=oracle.jdbc.driver.OracleDriver connectionURL=jdbc:oracle:thin:@localhost:1521:adb connectionName=metax connectionPassword=tiger userTable=contacts userNameCol=username userCredCol=password userRoleTable=user_roles roleNameCol=role / to my conf\server.xml, and commented out the SimpleRealm interceptor. JDBCRealm is on my classpath--javap can print it. And that JDBC connection works fine outside of JDBCRealms, so it's not a JDBC issue. Near as I can figure, Tomcat isn't even loading the class. Is there some debugging I can turn on in Tomcat to see what's going wrong? -- Bill K.
RE: Retrieving the current directory path...
Yes, there is. Don't do it. What are you actually trying to accomplish? -- Bill K. -Original Message- From: Rui Oliveira [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 12:19 PM To: [EMAIL PROTECTED] Subject: Retrieving the current directory path... Hello, is there a way to find out the operating system path where a JSP is being executed? Many thanks Rui
RE: Query
It means what it sounds like: the method isn't defined in the version of HttpSession that's on your CLASSPATH. I thinkthat method was added in JSDK 2.1. What version are you compling against? -- Bill K. -Original Message-From: haneesh [mailto:[EMAIL PROTECTED]]Sent: Thursday, May 24, 2001 12:19 AMTo: [EMAIL PROTECTED]Subject: Query on compiling the attached java file i receive the following error C:\test\changed\loginagain.java:27: cannot resolve symbolsymbol : method setMaxInactiveInterval (int)location: interface javax.servlet.http.HttpSession httpsession.setMaxInactiveInterval(1800); ^1 error advice thanks
RE: Changing Tomcats default servlet url?
I need the url to not have the 'servlet' in it. Anybody know how to do this? Add a servlet-mapping tag to your web.xml file. The DTD for that file (for JSDK 2.2 / Tomcat 3.2) is available at http://java.sun.com/j2ee/dtds/web-app_2_2.dtd and in the JSDK 2.2 specification. Also, how does tomcat determine the servlet is in the WEB-INF\classes directory? Does it alias that as 'servlet'? Yup. If so, where is this done? I believe that's done in code, not in a configuration file. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 7:48 PM To: [EMAIL PROTECTED] Subject: Changing Tomcats default servlet url? Sorry, if this is a duplicate posting...but I received no responses and thought I sent it incorrectly. I'm in the process of switching from JServ to Tomcat. All the servlets that were running previously are running now on tomcat but they have different urls. I need the url to be the same as it was before I switched to tomcat and am having trouble. My servlet is in: c:\tomcat\webapps\dir1\WEB-INF\classes I used the same setup as the examples that come with tomcat. To reach that servlet you have to use the following url: http://localhost/dir1/servlet/ServletName I need the url to not have the 'servlet' in it. Anybody know how to do this? Also, how does tomcat determine the servlet is in the WEB-INF\classes directory? Does it alias that as 'servlet'? If so, where is this done? Frustrated... Jason E. Brawner Consultant Silenus Group, Inc. 248.735.8077 Ext. 184 810.252.9944 Cellular
RE: Aliasing urls in Tomcat (without using Apache)
I'm not sure I get you, but, can't you just alias the servlet's URL using the url-pattern tag in your web.xml? (Take a look at the DTD for web.xml, at, http://java.sun.com/j2ee/dtds/web-app_2_2.dtd or in the JSDK spec.) -- Bill K. -Original Message- From: Graeme Miller [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 2:38 PM To: '[EMAIL PROTECTED]' Subject: Aliasing urls in Tomcat (without using Apache) Hi guys, During development we would like to use Tomcat locally without having an Apache front end, then only have an Apache front end proxy passing to Tomcat when it goes into production. We are running into problems with how to replicate the proxy pass functionality of Apache in Tomcat. Eg say we have a context of /context and in its base directory there was a subdirectory called my_directory. To get rid of the context out of the url in Apache for the public site we would just do the following proxy pass proxypass /my_directory http://localhost:8080/context/my_directory where localhost:8080 is of course picked up by Tomcat. This would mean the url would look like http://mydomain.com/my_directory - much tidier than http://mydomain.com/context/my_directory We cannot work out how to set up a similar arrangement in Tomcat. Note: we are *not* asking how to make context=my_directory, so we can't just add another context my_directory that maps through to the same base directory as context. Any ideas people? Regards, Graeme.
RE: JDBC/ODBC: Technological choice
-first, is it possible to use a JDBC IV sheme with Tomcat Yes. -if so, how is it possible? How is it made? The same way you use any JDBC implementation. In other words, where can i find documentation about that? The obvious place would be Sun's JDBC home page: http://java.sun.com/products/jdbc/ You should also check the home page of your JDBC implementation's vendor (e.g., www.oracle.com .) -why it is recommended to use JDBC IV when dealing with intranet? Type 1 and 2 generally require direct access to the database (i.e., that it's sitting on your own computer); and types 1 through 3 use JNI (which may be restricted by sandbox permissions). -JDBC-ODBC bridge vs JDBC IV: how slower? Which one is simplier to setup? Sun's JDBC-ODBC isn't supported for production environments. Your best bet is to use the vendor's own JDBC implementation (if available), or a third-party's. -Finally, is it difficult to deal with JDBC, to deploy it? No more than any Java code, especially with a type 4 driver. -- Bill K. -Original Message- From: Alexandre Bouchard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 5:34 PM To: tomcat-user Subject: JDBC/ODBC: Technological choice Hello guys I am building an intranet on a window NT environment. I hate ASP, so I decided to use JSP as the server-side language. I chose Tomcat to run my JSP and I installed it as a IIS plugin. Now, I have to connect my JSPs with the databases (they use Access -- ouch! ) I never did that before and I don't know if I should use JDBC I or IV. So my questions are: -first, is it possible to use a JDBC IV sheme with Tomcat -if so, how is it possible? How is it made? In other words, where can i find documentation about that? -why it is recommended to use JDBC IV when dealing with intranet? -JDBC-ODBC bridge vs JDBC IV: how slower? Which one is simplier to setup? -Finally, is it difficult to deal with JDBC, to deploy it? A lot of question, isn't it? I would also apreciate if some of you could share their experience of building a JDBC/JSP/Tomcat infrastructure. Thx !
RE: servlet deployment
Try http://myserver:8080/servlet/dummy.HelloWorld 1) 8080 is the default port for Tomcat: you can change it in server.xml. 2) All servlets (by default--settable in web.xml) appear under /servlet. 3) After that comes the full class name. -- Bill K. -Original Message- From: Montgomery, Kendal L [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 22, 2001 6:43 AM To: Tomcat-User (E-mail) Cc: Sharma, Puneet Subject: servlet deployment Hello all, I am just wandering how I deploy a servlet that is part of a package, and how to reference it. For example.. say you take the HelloWorldExample servlet that comes with and modify it. Rename the source to HelloWorld.java, and change the file appropriately, including adding a line at the top: package dummy; so, it is in the dummy class. When I deploy this new HelloWorld servlet, I put it in ...webapps/examples/WEB-INF/classes/dummy/HelloWorld.class. Now, to reference this, I expected to be able to go to my browser and hit http://myserver/examples/servlet/dummy/HelloWorld http://myserver/examples/servlet/dummy/HelloWorld . That did not work. So, what do I have to do to make this work? By the way, I am running Apache 1.3.19 and Tomcat 3.2.1.fasdf Thanks.. Kendal L. Montgomery Qwest - eFlow Development Team 614-215-4937
RE: Context loading of .properties files
Take a look at web.xml--specifically, the context-param element. -- Bill K. -Original Message-From: Ronald G. Louzon [mailto:[EMAIL PROTECTED]]Sent: Tuesday, May 22, 2001 7:33 AMTo: '[EMAIL PROTECTED]'Subject: Context loading of .properties files I have several contexts which use a ".properties" file for configuration. I need each context to have its own version of that configuration file. Is there a way to load properties files based on context? I am looking for a way to load properties files that is similar to the way in which class and lib files are loaded by the servlet class loader. Ideally, the properties files would be automatically loaded from some place under the WEB-INF directory of a given contest. Thanks, ron
RE: modify html error page in Tomcat
Look at the error-page element in web.xml; the DTD is in the JSDK spec, and at http://java.sun.com/j2ee/dtds/web-app_2_2.dtd -- Bill K. -Original Message- From: Andrew Chou [mailto:[EMAIL PROTECTED]] Sent: Monday, May 21, 2001 4:06 PM To: [EMAIL PROTECTED] Subject: RE: modify html error page in Tomcat Martin, Thanks for the help. Howerver, I have only Tomcat 3.2.1 running without Apache web server. Is there any other place I should look into? I did not find any helpful info in the User's Guide. I was hoping there is a place I can simply tell Tomcat where my HTML error file is. Thanks! I don't exactly (depends on your exact scenerio) , but it is possible to redirect apache error pages to servlets. (see httpd.conf) Mvgr, Martin -Original Message- From: Andrew Chou [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 22, 2001 12:45 AM To: [EMAIL PROTECTED] Subject: modify html error page in Tomcat Hi, This might be a newbie question but is it possible for tomcat to return a customized html error page such as 404 File Not Found? I'd like to do that just like in IIS where you can specify customized error page for each return code. Thanks for your help! __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
RE: Cookies
(I'm not sure what this question has to do with cookies,...) I use JDBCRealm and I'd like to have the connection times out after a certain period of time. Currently, it seems that once you have logged in, as long as you don't exit from your browser, the servlets can be run forever. Is there anything I can set in server.xml? What exactly are you trying to time out--JDBCRealm's database connection, or the servlet session, or the authenticated account? (Your mention of JDBCRealm confuses me,...) 1) The database connection won't be closed until some error occurs. 2) The servlet session has a time-out specified by webapp/session-config/session-timeout in your web.xml file. 3) Authentication, I believe, is maintained by the browser, not the server, and there's no way to tell the browser to discard its credentials. Assuming you're only worried about access to your servlets (not static files on your system), you could always use your own authentication (e.g., a login form with the credentials stored as a session attribute) and bypass the browser's authentication. -- Bill K.
RE: Difficult question Urgent!!!
javax.servlet.http.HttpServletRequest.getRemoteUser(). -- Bill K. -Original Message- From: mohamed imdadullah [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 9:17 AM To: [EMAIL PROTECTED] Subject: Difficult question Urgent!!! Hhi all, I have Tomcat running under apache, i have been able to have same authentication for both apache (serving perl) and tomcat(serving jsp). The problem is , after authenticating user in jsp, i need to get the user name of the person who has logged in to make further queries with the database. I dunno how it is done, i dont even know whether it could could be retrieved from the http session. iam pretty sure that the user name can be extracted as the apache maintains a different session for the perl part and another for the jsp part any ideas would be appreciated regards __ ___ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: inserted line feeds in concatenated strings
So what's the value of text? Does it include some kind of line break character, or doesn't it? (You might want to try something like, for (int i = 0; i != text.length(); i++) { char c = text.charAt(i); if (Character.isSpace(c) c != ' ') System.err.println(Char + i + =0x + Integer.toHexString(text.charAt(i)); } to see whether you've got one of: 0x9 (tab); 0xA (newline); 0xC (form feed); or 0xD (carriage return).) The problem is almost certainly that you're emitting a DOS newline (0xA 0xD) where you really want a standard newline (0xA). -- Bill K. -Original Message- From: Christoph Kukulies [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 10:31 AM To: [EMAIL PROTECTED] Subject: inserted line feeds in concatenated strings I'm seeing different browser behaviour between unix netscape vs. Windows (NT) Netscape or MSIE. I'm generating a page with text between PRE.../PRE. The text is generated via out.println(text + , + number); and I get a line break after 'text' while under Unix browsers I don't get a line break. Any idea? -- Chris Christoph P. U. Kukulies [EMAIL PROTECTED]
RE: Browser Closed
javax.servlet.http.HttpServletRequest.isRequestedSessionIdValid(). -- Bill K. -Original Message- From: Alin Simionoiu [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 11:34 AM To: [EMAIL PROTECTED] Subject: Re: Browser Closed Is possible to find out if a specific session is no longer valid?.. - Original Message - From: Milt Epstein [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 17, 2001 1:15 AM Subject: Re: Browser Closed On Wed, 16 May 2001, Alin Simionoiu wrote: I think this event as also fired when you browse thru the pages..wright?.. Want I will really like to have is a SessionEnd event... Basically ... there isn't a generic, catch-all way to do this, so you're going to need to rely on the session timeout mechanism. - Original Message - From: Richard Draucker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 16, 2001 9:26 PM Subject: Re: Browser Closed Try clicking the logout button with a javascript triggered by the body onunload. This is how the porn sites feed you a zillion popups when you try to get outta their site... ooops, you weren't supposed to know I know that. On Thu, 17 May 2001, you wrote: Hello everybody, I'm implementing a login/logout from a web page. Everithing is absolutly fine if the user it's using my logout button. But, if the user just close the browser, without using the logout button, then I'm in trouble. Has anybody any ideea if is possible to know when a user close the browser?.. I'm not using a keep-alive connection. Probably is not possible, considering that http is a stateless protocol. Alin -- Richard Draucker, [EMAIL PROTECTED] Protected-Data.Com www.protected-data.com Remote data support for web developers. Milt Epstein Research Programmer Software/Systems Development Group Computing and Communications Services Office (CCSO) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED]
RE: inserted line feeds in concatenated strings
Orignal poster, correct me if I'm wrong, but it sounds like the _browser_ is on Unix, not necessarily the _server_. Asking about the line separator on the server will always return the same value, regardless of the browser; in fact, I can't think of any way to find out the proper line separator on the browser side. As long as you always output a newline (\n, or 0x0A) as a line terminator, it should work on every server platform, and on every browser. This may mean, for instance, that you need to strip out carriage return ('\r', or 0x0D) from all your pre-formatted strings, at least if line.separator is not \n. -- Bill K. -Original Message- From: Tim O'Neil [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 12:18 PM To: [EMAIL PROTECTED] Subject: Re: inserted line feeds in concatenated strings At 07:30 PM 5/17/2001 +0200, you wrote: I'm seeing different browser behaviour between unix netscape vs. Windows (NT) Netscape or MSIE. I'm generating a page with text between PRE.../PRE. The text is generated via out.println(text + , + number); and I get a line break after 'text' while under Unix browsers I don't get a line break. Any idea? Yep. Oh, you want the idea? Use the System property to get the line.separator property and use that rather than assume that line breaks will happen. (They obviously won't on every platform unless you use the System property object, as you have experienced.)
RE: SessionListener
You mean HttpSessionBindingListener? (I can't find any other reference to Listener in tomcat/conf/* or the JSDK 2.2 spec; nor can I find that class in the Tomcat sources.) That's not related to web.xml, and I find it pretty easy to use. What troubles are you having? -- Bill K. -Original Message- From: Alin Simionoiu [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 2:20 PM To: [EMAIL PROTECTED] Subject: SessionListener Does anybody use SessionListener?.. I try to use this, but is absolutly an nightmare to put everithing in place. I cannot find a very clear documentation about how the web.xml file should be set. Alin
RE: Browser Closed
If you got an HttpSession from HttpServletRequest, and you didn't invalidate it yourself, then it's valid. There's no session you can get which isn't valid. Maybe you mean whether it's new? Call HttpSession.isNew() for that. Or whether you invalidated it? You could call isNew() for that, too, and catch the IllegalStateException it would throw for an invalid session. -- Bill K. -Original Message- From: Alin Simionoiu [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 2:56 PM To: [EMAIL PROTECTED] Subject: Re: Browser Closed Corect. But this is true for existing session. Want I'm trying to find is something like : isSessionValid(Session) Alin - Original Message - From: William Kaufman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 17, 2001 1:11 PM Subject: RE: Browser Closed javax.servlet.http.HttpServletRequest.isRequestedSessionIdValid(). -- Bill K. -Original Message- From: Alin Simionoiu [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 17, 2001 11:34 AM To: [EMAIL PROTECTED] Subject: Re: Browser Closed Is possible to find out if a specific session is no longer valid?.. - Original Message - From: Milt Epstein [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 17, 2001 1:15 AM Subject: Re: Browser Closed On Wed, 16 May 2001, Alin Simionoiu wrote: I think this event as also fired when you browse thru the pages..wright?.. Want I will really like to have is a SessionEnd event... Basically ... there isn't a generic, catch-all way to do this, so you're going to need to rely on the session timeout mechanism. - Original Message - From: Richard Draucker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 16, 2001 9:26 PM Subject: Re: Browser Closed Try clicking the logout button with a javascript triggered by the body onunload. This is how the porn sites feed you a zillion popups when you try to get outta their site... ooops, you weren't supposed to know I know that. On Thu, 17 May 2001, you wrote: Hello everybody, I'm implementing a login/logout from a web page. Everithing is absolutly fine if the user it's using my logout button. But, if the user just close the browser, without using the logout button, then I'm in trouble. Has anybody any ideea if is possible to know when a user close the browser?.. I'm not using a keep-alive connection. Probably is not possible, considering that http is a stateless protocol. Alin -- Richard Draucker, [EMAIL PROTECTED] Protected-Data.Com www.protected-data.com Remote data support for web developers. Milt Epstein Research Programmer Software/Systems Development Group Computing and Communications Services Office (CCSO) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED]
RE: Session Question
Call HttpServletRequest.encodeURL() or encodeRedirectURL() on each URL you put in the page. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 5:34 AM To: [EMAIL PROTECTED] Subject: Re: Session Question John, In what ways may I have amend my pages due to cookies being disabled? John Holman j.g.holman@qTo: [EMAIL PROTECTED] mw.ac.ukcc: Subject: Re: Session Question 05/15/01 07:15 AM Please respond to tomcat-user - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 12:54 PM Subject: Session Question I am currently writing a pretty complex data entry HTML page for an application. The HTML has 7 different frames where data is input, one represents the master table and the others detail tables. I am trying to come up with a way to keep all of the data entered into each frame for updating the database (I want to update all the records in one transaction). There some obvious ways of doing this as with invisible fields on the master frame, and URL rewriting (cookies are out in this case) but I have also been looking into using the Session object. I know the object is used for shopping carts on commercial web sites but would it be a good to use it to keep all the input values for various input forms? There will be from 40 - 50 items of data stored in the session object and a user will only be able to one form at a time? Yes, sessions are provided for this kind of thing. Note that Tomcat uses cookies to maintain the session if it can. It will use URL rewriting if cookies are disabled but you may have to amend your pages to support that. It may be worth looking at a web application framework such as Jakarta Struts that can run within Tomcat and help with some of this. John.
RE: RTFM?
Please read the fine Jargon File, at http://www.tf.hut.fi/cgi-bin/jargon . -- Bill K. -Original Message- From: Sachin Phatak [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 4:08 AM To: [EMAIL PROTECTED] Subject: RTFM? RTFM - I've seen this abbr. in use. What does it stand for? Sachin PS. I can see a few sniggering faces but how's a guy to know if he doen't ask?
RE: Accessing environment variables
Yes, there is. But it's not really a good idea. What you ought to do instead is to specify these properties in your web.xml file as a context-param element, like, webapp !-- ... -- context-param param-nameTomcatHome/param-name param-valuec:/tomcat/param-value /context-param /webapp And specifically, I I'm not sure you even need to know TOMCAT_HOME, when you've got methods like ServletContext.getRealPath(). -- Bill K. -Original Message- From: Brandon Cruz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: Accessing environment variables I have a question which is somewhat off topic... Is there a way to access my environment varibables(ex. TOMCAT_HOME) from my servlets running in tomcat? I just need to somehow return the path to TOMCAT_HOME. Is there some simple method call that can achieve this? Thanks in advance! Brandon
RE: socket write error
This is IE being goofy. Look at this email from the Tomcat mailing list archives: http://marc.theaimsgroup.com/?l=tomcat-userm=98770302314327w=2 -- Bill K. -Original Message- From: Sankaranarayanan Ganapathy [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 8:03 AM To: '[EMAIL PROTECTED]' Subject: RE: socket write error So my question is , does anybody what could be causing this? -Original Message- From: Sankaranarayanan Ganapathy Sent: Friday, May 11, 2001 8:01 AM To: '[EMAIL PROTECTED]' Subject:socket write error I have an application deployed under the root context of Tomcat3.2.1 running in standalone mode. I ofen see this Connection reset by peer: socket write error but things continue to work fine. 2001-05-10 07:06:36 - Ctx( ): IOException in: R( + /awi/external/images/AWILog o.gif + null) Connection reset by peer: socket write error Thanx Ganesh
RE: Tomcat start error
Don't start Tomcat in a new window. In tomcat.bat, there's be a line like, start Tomcat java org.apache.tomcat.startup.Tomcat ... Strip everything before java. Then, when you run tomcat.bat, any errors will show up in your current window. -- Bill K. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 8:03 AM To: [EMAIL PROTECTED] Subject: Tomcat start error I installed the tomcat 3.2.1 with jdk 1.3 in Win98. The enviroment setup is PATH=%PATH%;c:\jdk13\bin set JAVA_HOME=C:\jdk13 set TOMCAT_HOME=C:\tomcat When I run tomcat run, i just get an error message, Exception in thread main java.lang.NoClassDefFoundError: org/apache/tomcat/startup/Tomcat If I run startup, it just say start a new window and the new window just a blinking and disappear, as follwing message displayed, Including all jars in C:\TOMCAT\lib in your CLASSPATH. Using CLASSPATH: C:\TOMCAT\classes;C:\TOMCAT\lib\ANT.JAR;C:\TOMCAT\lib\JAXP.JAR; C:\TOMCAT\lib\SERVLET.JAR;C:\TOMCAT\lib\PARSER.JAR;C:\TOMCAT\lib\ WEBSER~1.JAR;C: \TOMCAT\lib\JASPER.JAR;C:\TOMCAT\lib\webserver.jar;C:\JDK13 \lib\tools.jar; Starting Tomcat in new window Your help is greatly apreciated. Thanks, Peter
RE: Posting multipart/form-data
You'll need to package your data in a MIME message. There may be something in the O'Reilly package for that; if not, you can use JavaMail, available at, http://java.sun.com/products/javamail/index.html Look specifically at the javax.mail.internet package, and all the Mime* classes. -- Bill K. -Original Message- From: Bo Xu [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 8:07 AM To: [EMAIL PROTECTED] Subject: Re: Posting multipart/form-data Frans Verhoef wrote: One good API for dealing with multipart/form-data is the com.oreilly.servlet package. http://www.servlets.com/cos/index.html I used it myself, and it works really great. And if you want to use it commercially, you just need to buy the book of oreilly. Frans On 10 May 2001, at 17:25, Brandon Cruz wrote: When I try to specify enctype=multipart/form-data, the page just goes blank and IE says that it can't find server. Anyone know why this might happen? Brandon [...] Hi :-) I also use multipart/form-data with Jason Hunter's API com.oreilly.servlet.MultipartRequest, in the client I use a HTML Form from his book: FORM ACTION=/servlet/UploadTest ENCTYPE=multipart/form-data METHOD=POST What is your name? INPUT TYPE=TEXT NAME=submitter BR Which file do you want to upload? INPUT TYPE=FILE NAME=file BR INPUT TYPE=SUBMIT /FORM now I have a question: now I want to upload a file to MyServlet from a Java Application(or a Java Applet), I guess I need to use (Http)URLConnection, but I don't know how to use it: - how to set ENCTYPE=multipart/form-data? - do I need to read the file into a byte[], then put this byte[] into (Http)URLConnection? where/how can I put? -... Thanks in advance! Bo may.11, 2001
RE: Classpath Question
Tomcat has its own ClassLoader implementations (in 3.2, org.apache.tomcat.loader.*) which can pull the classes from the webapps directory. Look up java.lang.ClassLoader for more info. -- Bill K. -Original Message- From: Dalia, Keith A - TOS-DITT1 [mailto:[EMAIL PROTECTED]] Sent: Friday, May 11, 2001 10:56 AM To: '[EMAIL PROTECTED]' Subject: Classpath Question I have a question about how the dynamic class path is set based upon the .war file. I know that whatever classpath is set prior to tomcat startup is appended to the classpath in the startup.bat. Furthermore, whatever .jar files that reside in tomcat_home\lib are also dynamically added to the classpath and tomcat_home\classes is also put on the classpath. I have verifed this by call a System.getProperty(java.class.path) from a servlet. What I don't fully understand is how the contents of the .war files \lib path are seen by tomcat since they don't appear when I call System.getProperty(java.class.path). I would really appreicate a bit of clarity on this. TIA, Keith
RE: problem with amp;
PATIENT: Doctor, it hurts when I raise my arm. DOCTOR: Well, then, stop raising your arm. (Translation: don't use amp;, use . amp; is only necessary in XHTML, which few browsers support.) -- Bill K. -Original Message- From: C Santosh Kumar [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 1:42 AM To: [EMAIL PROTECTED] Subject: problem with amp; hai guys I have a problem with Netscape navigator html head script window.location.href=ShowItem.po?name=laovaamp;remoteid=2351 2amp;b=rajuu /script /head /html It is working fine in IE. But if i am opening this page with Netscape it is not passing the name value pairs to the servlet. It requires and not amp; IE requires the opposite. The above html is output from a stylesheet which forces me to use amp; only (and not just ). Thanks, -csk