Re: Multi-part response
If the browser supports it you would send the whole page in one multipart response a bit like a mail message. Here's one way to do it: So, you'd have to buffer the response. Then create a javax.mail.internet.MimeMultipart and add BodyParts (javax.mail.internet.MimeBodyPart) for the html and each of the images. For each image link in the html you'll have to change it for the Content-Id of the corresponding image MimeBodyPart. For example (IIRC): For an image blah.gif with a Content-Id of piccy1 replace the contents of the src attribute of the image tag in the html with cid:piccy1 http://www.ietf.org/rfc/rfc2111.txt javax.mail.Multipart has a handy writeTo(...) method so you can splurge the entire thing down the response outputstream. HTH and intrigued to see if any browser supports it, Jon ALEX HYDE wrote: Hi David, I guess I meant that I wanted to write part of a page, and then write the image straight othe stream, then some more of the page, and then another image direct to the stream, and then I am not sure of the syntax? --- David Delbecq [EMAIL PROTECTED] wrote: Well am not sure of what you mean, and am not sure browser accept multi-part response that way, but i dont know http protocol enough. Could you provide an example http response you would like to get?? Anyway, struts in itself is not extensible that way. ALEX HYDE a écrit : Cheers. I think I wanted to know how and if there was a good way of incororating mulitpart response into a framewrok like struts? Let's say I have a page with a number of src tags embeded in it, and I don't want the browser to have to pull in each image individually, how could I write them all out to a single response and still stay within a tidy framework like Struts? --- David Delbecq [EMAIL PROTECTED] wrote: If you want to alter the response of a servlet (like struts servlet), a ServletFilter is a good choice. ALEX HYDE a écrit : Hi All, This is probably not strictly a Tomcat question so apologies. If I am using Struts, how can I filter the output so that I convert it into a multipart response? Using a filter probably! But I'm not sure how. For example, how could I send all my embedded images and the response in one mulit-part response? Thanks alot Alex ___ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat WAP/WML
You don't need a WAP gateway. The mobile operator's have them and they proxy the browser request :) You just need to make sure the wml you vend is valid and sent with the correct mime type and the operator's gateway will do the rest (conversion to wmlc, a wbxml tokenized version of the markup). HTH, Jon Carl Olivier wrote: Thanks! Appreciate that. -Original Message- From: t.n.a. [mailto:[EMAIL PROTECTED] Sent: 08 November 2005 11:54 To: Tomcat Users List Subject: Re: Tomcat WAP/WML Carl Olivier wrote: Hi. Thanks for the info - but I was actually wonderin about the whole WAP gateway - generating the different presentation layers is no problem - however the protocol handler? Maybe I should go do more reading - but I assume a WAP gateway is required in order to process the WAP stacck to HTTP stack and send to the web server? I see your point. I'll forward your query to my colleagues and see what they have to say about it. t.n.a. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat WAP/WML
Sure. All the big boys sell gateways. The Nokia gateway seems to be used (or at least was) a fair bit within the operators themselves. Here's a Nokia SDK which may be of use: http://www.forum.nokia.com/main/0,,034-741,00.html The major OSS gateway is kannel (http://www.kannel.org/) The last time I looked there weren't any mature OSS gateways written in java. That could have changed though... Jon Carl Olivier wrote: Hi. Great. Thanks! Is there Gateway software available though? If you wanted to set your own gateway up? Carl -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: 08 November 2005 12:11 To: Tomcat Users List Subject: Re: Tomcat WAP/WML You don't need a WAP gateway. The mobile operator's have them and they proxy the browser request :) You just need to make sure the wml you vend is valid and sent with the correct mime type and the operator's gateway will do the rest (conversion to wmlc, a wbxml tokenized version of the markup). HTH, Jon Carl Olivier wrote: Thanks! Appreciate that. -Original Message- From: t.n.a. [mailto:[EMAIL PROTECTED] Sent: 08 November 2005 11:54 To: Tomcat Users List Subject: Re: Tomcat WAP/WML Carl Olivier wrote: Hi. Thanks for the info - but I was actually wonderin about the whole WAP gateway - generating the different presentation layers is no problem - however the protocol handler? Maybe I should go do more reading - but I assume a WAP gateway is required in order to process the WAP stacck to HTTP stack and send to the web server? I see your point. I'll forward your query to my colleagues and see what they have to say about it. t.n.a. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: advice on auto logout servlet
I did an AJAX version of this a couple of months ago. The slight gotcha is that the AJAX request prolongs the life of the session (you can't, it seems, override the cookie for AJAX requests) so the interval has to be slightly longer than the expiry time for the session. Reynir Hubner wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I would suggest that you do this by using somethinglike JSON or AJAX. See jasonspec: http://www.crockford.com/JSON/index.html You could make the client query your server, in some interval and check the session state. hope it helps - -reynir Mark wrote: Is there any way to allow servlets to auto-logout a user when the timeout has been reached. Right now, I have tomcat configured for a 20 minute session timeout. When the session times out, the user gets no notification of this event. Is there any way to show the user that they have logged out? Thank you. -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDeeqn19KgIQihNwgRAqT8AJ9ijf9kZZlldgjRTcAEtua+89enKQCgnqjm iuCZACbq4A/JkmtB5yiIc8M= =HSCq -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Starting the apache tomcat 4.05 servlet engine on windows xp
Try the binary distribution instead of the source bundle: http://archive.apache.org/dist/tomcat/tomcat-4/archive/v4.0.5/bin/ Either jakarta-tomcat-4.0.5.zip or jakarta-tomcat-4.0.5.exe should be fine. CATALINA_HOME will probably then be: C:\tomcat\jakarta-tomcat-4.0.5 HTH, Jon Aaron Bortman wrote: Hello, In my job I recently have been assigned to work with Cocoon. In order to be able to use cocoon I need to be able to deploy it on a servlet engine. The book I am reading to learn Cocoon has chosen tomcat 4.0.5 as the servlet engine to use. I am having a problem getting tomcat to start. Any help that could be given would be much appreciated. So far I have: 1) Installed the java sdk 1.4.1_07 and set the environment variable JAVA_HOME to its location 2) Copied the jakarta-tomcat-4.0.5-src.zip to a file on my computer (running Windows XP professional) 3) Extracted the zip file 4) Brought up a command prompt and set the environment variable CATALINA_HOME like this: set CATALINA_HOME=C:\tomcat\jakarta-tomcat-4.0.5-src\catalina\src 5) Navigated to the CATALINA_HOME directory and run the startup script. 6) When I run the script I get the following echoed to the screen. Using CATALINA_BASE: C:\tomcat\jakarta-tomcat-4.0.5-src\catalina\src Using CATALINA_HOME: C:\tomcat\jakarta-tomcat-4.0.5-src\catalina\src Using CATALINA_TMPDIR: C:\tomcat\jakarta-tomcat-4.0.5-src\catalina\src\temp Using JAVA_HOME: c:\tools\j2sdk1.4.1_07 7) I have been unable to get the welcome page to display when I point a browser at http://localhost:8080. I have looked at the FAQ's and tried changing the port 8080 to something else, but that did not fix my problem. I also have checked and am not behind a proxy. I am not sure what I am doing wrong, but I have been searching the help pages for Apache and other sites with little luck. If you could help me look in the right place I would be greatful. Thanks for your time, Aaron - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDBC/MySQL user login goes stale
Also be aware that autoReconnect=true only works (according to the mysql docs) for Connections with autocommit set to true. If you are using a connection pool make sure it checks the validity of Connections every so often. This is configurable for DBCP: http://jakarta.apache.org/commons/dbcp/configuration.html If you aren't using a pool then implement some sort of heart beat code as the previous poster suggested. HTH, Jon Lists wrote: This is an interesting problem. But first try setting autoReconnect=true in your connections string. If you continue to experience a timeout.. Check the logs, and see what specifically is happening. You may be experiencing an exhaustion of connections not being released properly. If it is a true timeout and autoReconnect does not solve it... try writing a heart beat (1/hour) to test if this keeps it up and running. Be cognizant of connections NOT being returned back to the pool by a proper close. Which does not mean that you're not closing correctly from your code, you maybe experiencing a close issue with JDBC. So, the version of JDBC is certainly another item to check. :-) Hope that helps! jes On Nov 29, 2005, at 2:21, David W. Brown wrote: Hello TC dev and Gurus, I have a webapp comprised of several Servlets and JSP pages. The webapp is functioning very well but after a few hours of no connections or interaction the TC webapp loses its connection with the MySQL DB. We are using the server.xml defined JDBC/MySQL security model using the users and user_roles tables DB structure. The logins work perfectly until a few hours of (like overnight) in attendance. Even thought the TC Servlet server is still up and running logins all fail. After restarting TC the login mechanism works perfectly. Particulars follow. Please advise. TC Servlet server 5.5.7 MySQL 4.1 OS Windows XP (whistler). David Brown IT/Systems USM-I KBR-Central APO AE 09316 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extending webappclassloader
Our custom loader sits in a jar in $CATALINA_HOME/server/lib Our classloader uses different parent classloaders depending on which version of TC is running. In 4.1 we just use the parent classloader as supplied in the constructor. In 5.0.x we use the classloader of WebAppClassLoader as the parent. It's a while since the code was written but I seem to recall the creating parent is the bootstrap classloader which knows nothing of the server classloader, and hence can't find the servlet api classes. We haven't tried it in 5.5.x yet. HTH, Jon Niels Soeffers wrote: Hello, I have a problem extending the webappclassLoader. In the company I work for, we are using eclipse as our IDE. We have multple projects in eclipse and we would like to have an in-place deployment (so tomcat works on the (bin) directories of our eclipse projects). That way we don't have to copy all the modified classes over all the time to a WEB-INF/classes folder. I do realize that the WEB-INF/classes is the correct place to put these classes. And in our continuous integration environment we are using a war to deploy our application. However to ease and speed up the development and test process we would like to have Tomcat to look in our bin directories of eclipse to find our class files. For this to work I have created an InPlaceDeployWebappClassLoader which extends of the default WebappClassLoader. However if i add a Loader tag to my server.xml configuration file. I always get the following exception: SEVERE: Error loading WebappClassLoader delegate: false repositories: /WEB-INF/classes/ -- Parent Classloader: [EMAIL PROTECTED] org.apache.jasper.servlet.JspServlet java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet at org.apache.catalina.loader.WebappClassLoader.loadClass( WebappClassLoader.java:1338) at org.apache.catalina.loader.WebappClassLoader.loadClass ( WebappClassLoader.java:1187) at org.apache.catalina.core.StandardWrapper.loadServlet( StandardWrapper.java:1027) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java :925) at org.apache.catalina.core.StandardContext.loadOnStartup ( StandardContext.java:3880) at org.apache.catalina.core.StandardContext.start(StandardContext.java :4141) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start (StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java :442) at org.apache.catalina.core.StandardService.start (StandardService.java :450) at org.apache.catalina.core.StandardServer.start(StandardServer.java :680) at org.apache.catalina.startup.Catalina.start(Catalina.java:536) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 5-dec-2005 14:55:24 org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /HotDeployOnTomcat threw load() exception java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet at org.apache.catalina.loader.WebappClassLoader.loadClass( WebappClassLoader.java :1338) at org.apache.catalina.loader.WebappClassLoader.loadClass( WebappClassLoader.java:1187) at org.apache.catalina.core.StandardWrapper.loadServlet( StandardWrapper.java:1027) at org.apache.catalina.core.StandardWrapper.load (StandardWrapper.java :925) at org.apache.catalina.core.StandardContext.loadOnStartup( StandardContext.java:3880) at org.apache.catalina.core.StandardContext.start(StandardContext.java :4141) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java :1012) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start (StandardEngine.java :442) at org.apache.catalina.core.StandardService.start(StandardService.java :450) at org.apache.catalina.core.StandardServer.start(StandardServer.java :680) at org.apache.catalina.startup.Catalina.start (Catalina.java:536) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke ( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:413) 5-dec-2005
Re: Multilingual usernames and passwords does not works.
Your html isn't correct: http://www.w3.org/TR/html4/interact/forms.html#h-17.3 I would remove the enctype attribute, correct the accept-charset name and see if you get any further. HTH, Jon Manish Dalakoti wrote: Hi, I'm using form-based authentication. Although i'm able to create multilingual user names and passwords, tomcat is not able to authenticate using the same. I'm not able to make out if this is a problem related to j_security_check or what, because the username and password which my Authenticator receives from j_security_check is all garbage. *At JSP level, in my login.jsp page i'm using :* ** /%@ page errorPage=/jspError.jsp pageEncoding=UTF-8 contentType=text/html; charset=UTF-8 % . . . form name=login method=post action=j_security_check acceptCharset=UTF-8 encType=UTF-8 onKeyPress=return submitOnEnter(event, login) . ./ * *, *to make sure UTF-8 support is there, but to no avail. Otherwise, the rest of my application is fully internationalized and localized too in few languages.* Thanx, Manish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem calling request.getParameter(myparameter) in jsp
Your underlying problem is the exclamation mark at the start of your scriptlet. This makes the jsp ompiler put free standing code into the init method or creates methods on the servlet that you can call within your jsp. Without the exclamation mark the compiler inlines the scriptlet into the _jspService() method, which is the behaviour you require. So, you should have: % String query = request.getParameter(display) ; % instead of %! String query = request.getParameter(display) ; % HTH, Jon marju jalloh wrote: I got it. HttpRequest throws an exception by enclosing String query = request.getParameter(display) in a try and catch block everything was fine marju jalloh [EMAIL PROTECTED] wrote: I see %! String query = request.getParameter(display) ; % is declared in the init() of the servlet.I changed it but now I`m getting org.apache.jasper.JasperException java.lang.NullPointerException which should not execute the query Can anyone throw licht on this Thanks marju jalloh wrote: Hi everyone I `m writing a bean application to execute sql query.The query properties in the Bean works perfect.I have a jsp with textArea where the user can enter query.The query is the required parameter that the Bean should execute. snippet ... [input] %! String query = request.getParameter(display) ; % % if(!query.equals() || !query.equals(null)) { String selector = (query.substring(0,6)).trim(); out.write(selector); if(selector.equals(SELECT)){ out.write(myBean.getData()); }else if(selector.equals(INSERT)){ myBean.setData(query) ; }else if(selector.equals(DELETE)){ myBean.setDelete(query); } else out.write(nothing is entered); } % ... My problem is when the jsp page is requested for the first time I got this error: cannot find symbol variable request. I know I should have null for request.getParameter(display) at first access and that is caugt.If I submit the form then the content of the textarea should be request.getParameter(display) .That was what I was expecting. Can anyone help Thanks in advance - Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Image problem on tomcat
Is it a mime-type issue? The content is probably being vended as application/octet-stream, which the mobile device is probably not liking. You can add additional mime-mappings into your web.xml. If you are fronting tomcat with apache httpd you can also add mime-mappings into the httpd.conf Jon Zilberstein Yuval wrote: Hello all, I have an image problem on the Tomcat server. I have a picture with a special Korean format: cwsis. It is just like any other jpg or gif image, but with a format that is not popular. The image itself is on the tomcat server. I am trying to display the image on a special mobile browser, by requesting it from a jsp on the tomcat server, But the browser can not display it. When I am trying to display it from another apache server it works ok. The code is as follows: jsp:useBean id=entryB class=com.pele.mmbox.beans.AlbumEntryBean scope=session/ pre /pre img src=http://10.171.193.85:8090/mmbox/o549d000212946200.cwsis; a href=testDownload.jspdown/a Any ideas? TIA Yuval TX YuvalZ - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Version problem
You are using jdk1.5 features (autoboxing, for example ) in your JSP pages. Early versions of the 5.5 tree bundled a jsp compiler (JDT) which didn't support these new language features. Later versions bundled an updated version of the compiler... For deploying on 5.5.9 just get rid of your autoboxing: int thing = 4; request.setAttribute(stuff, new Integer(thing)); instead of request.setAttribute(stuff, thing); Regards, Jon Girish Havaldar wrote: On 05/07/07, Girish Havaldar [EMAIL PROTECTED] wrote: Hi, we have an application developed using the following components as listed below mysql 5.0.27 jdk 1.5.0_06 jre 1.5.0_06 tomcat5.5.20 Apache 2 phpMyAdmin 2.9.2 Servlets 2.3 JSP1.2 Our application is showing errors when deployed on tomcat 5.5.9(the Hosting company is using Tomcat 5.5.9.) ERROR: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 67 in the jsp file: /classification.jsp Generated servlet error: Type mismatch: cannot convert from Integer to int An error occurred at line: 67 in the jsp file: /classification.jsp Generated servlet error: The method add(int, Object) in the type ArrayList is not applicable for the arguments (int) An error occurred at line: 226 in the jsp file: /classification.jsp Generated servlet error: The method setAttribute(String, Object) in the type ServletRequest is not applicable for the arguments (String, int) An error occurred at line: 263 in the jsp file: /classification.jsp Generated servlet error: The method setAttribute(String, Object) in the type ServletRequest is not applicable for the arguments (String, int) org.apache.jasper.compiler.DefaultErrorHandler.javacError( DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError( ErrorDispatcher.java:328) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java :397) org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile( JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service( JspServletWrapper.java:293) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:853) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs. so what is the solution. Also plz send me info abt hosting comapny who can support the above specification. Thank you, Girish S.Havaldar. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] JDBC problem: PreparedStatement.setTimestamp function ignores milliseconds in TOMCAT + ddbb Oracle
That looks ok. Timestamp is the correct thing to use. You have two systems: one that works, one that doesn't. So, check for differences in the SQL sub-systems between the two: Are the drivers of the same (uptodate) version? Are the database schemas using the same column type? (ie the one that fails is silently truncating the data) In your original post you mentioned Oracle9i and Postgres. If one works and the other doesn't, again, check the column type is correct. Jose Gargallo wrote: This is the code: java.sql.Timestamp time = new Timestamp(System.currentTimeMillis()); ... pstmt = this.conexion.prepareStatement(INSERT); ... pstmt.setTimestamp(1, time); should I use java.sql.Date instead of java.util.Data? thanks Christopher Schultz escribió: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Barry, Propes, Barry L wrote: and what date type are you using? sql.date or util.date? I'm pretty sure that's going to be the problem. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGuIVQ9CaO5/Lv0PARArnpAJ93DhQqc6o9l7P49h3AVJkK20mxYQCdFvSO oPt8Wv6Y4Al0jqJBets5UuY= =Mn29 -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] JDBC problem: PreparedStatement.setTimestamp function ignores milliseconds in TOMCAT + ddbb Oracle
It's a long time since my last Oracle project ;) The OP was finding milliseconds weren't being stored. I was under the impression this would be the case if the date datatype were being used instead of a timestamp. Propes, Barry L wrote: if he's using Oracle, a date field should take any kind of timestamp variable. Oracle does have a Timestamp field/data type, but you don't have to make it as such to get this to work. Could have been that my JDK API differed slightly from your's. -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 08, 2007 4:49 AM To: Tomcat Users List Subject: Re: [OT] JDBC problem: PreparedStatement.setTimestamp function ignores milliseconds in TOMCAT + ddbb Oracle That looks ok. Timestamp is the correct thing to use. You have two systems: one that works, one that doesn't. So, check for differences in the SQL sub-systems between the two: Are the drivers of the same (uptodate) version? Are the database schemas using the same column type? (ie the one that fails is silently truncating the data) In your original post you mentioned Oracle9i and Postgres. If one works and the other doesn't, again, check the column type is correct. Jose Gargallo wrote: This is the code: java.sql.Timestamp time = new Timestamp(System.currentTimeMillis()); ... pstmt = this.conexion.prepareStatement(INSERT); ... pstmt.setTimestamp(1, time); should I use java.sql.Date instead of java.util.Data? thanks Christopher Schultz escribió: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Barry, Propes, Barry L wrote: and what date type are you using? sql.date or util.date? I'm pretty sure that's going to be the problem. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGuIVQ9CaO5/Lv0PARArnpAJ93DhQqc6o9l7P49h3AVJkK20mxYQCdFvSO oPt8Wv6Y4Al0jqJBets5UuY= =Mn29 -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] JDBC problem: PreparedStatement.setTimestamp function ignores milliseconds in TOMCAT + ddbb Oracle
Ah, I see. So the OP's data may be intact but he may be covering one eye and squinting when looking at the results... Propes, Barry L wrote: no I think they will, you just have to alter the session's NLS date format, correct? To see them, I mean? -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 08, 2007 10:13 AM To: Tomcat Users List Subject: Re: [OT] JDBC problem: PreparedStatement.setTimestamp function ignores milliseconds in TOMCAT + ddbb Oracle It's a long time since my last Oracle project ;) The OP was finding milliseconds weren't being stored. I was under the impression this would be the case if the date datatype were being used instead of a timestamp. Propes, Barry L wrote: if he's using Oracle, a date field should take any kind of timestamp variable. Oracle does have a Timestamp field/data type, but you don't have to make it as such to get this to work. Could have been that my JDK API differed slightly from your's. -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 08, 2007 4:49 AM To: Tomcat Users List Subject: Re: [OT] JDBC problem: PreparedStatement.setTimestamp function ignores milliseconds in TOMCAT + ddbb Oracle That looks ok. Timestamp is the correct thing to use. You have two systems: one that works, one that doesn't. So, check for differences in the SQL sub-systems between the two: Are the drivers of the same (uptodate) version? Are the database schemas using the same column type? (ie the one that fails is silently truncating the data) In your original post you mentioned Oracle9i and Postgres. If one works and the other doesn't, again, check the column type is correct. Jose Gargallo wrote: This is the code: java.sql.Timestamp time = new Timestamp(System.currentTimeMillis()); ... pstmt = this.conexion.prepareStatement(INSERT); ... pstmt.setTimestamp(1, time); should I use java.sql.Date instead of java.util.Data? thanks Christopher Schultz escribió: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Barry, Propes, Barry L wrote: and what date type are you using? sql.date or util.date? I'm pretty sure that's going to be the problem. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to configure my Realm class from context.xml?
Your Realm implementation needs to sit in the server classloader as the Realm interface is only defined there (in catalina.jar). This is a PITA so when we did this we made the Realm implementation just lookup the real implementation via JNDI. That way all the authentication logic stayed in the webapp and only a couple of simple wrapper classes and interfaces went into the server and common classloaders. HTH, Jon Zsolt wrote: Does anybody know how to configure Realm from .../META-INF/context.xml? Realm className=my.realm.JNDIRealm resourceName=my/RealmFactory/ I always get a ClassNotFoundException but the class does exist (under ../WEB-INF. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to configure my Realm class from context.xml?
Erm. Ok. My Realm extends RealmBase so I don't need to worry about such things. But, I guess in the Filter you could cast the request to an o.a.catalina.HttpRequest and then call getContext() on it. http://tomcat.apache.org/tomcat-5.0-doc/catalina/docs/api/index.html Jon PS I've never done the above, nor needed to. Good luck. Zsolt wrote: Thank you Jon, That's what I'm also trying but I always get a NPE because JNDIRealm.containerLog is null. Do you know how I can figure out the Container from for example a Filter? In the case I could call realm.setContainer(container) no NPE would happen. Zsolt -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Thursday, February 23, 2006 5:05 PM To: Tomcat Users List Subject: Re: How to configure my Realm class from context.xml? Your Realm implementation needs to sit in the server classloader as the Realm interface is only defined there (in catalina.jar). This is a PITA so when we did this we made the Realm implementation just lookup the real implementation via JNDI. That way all the authentication logic stayed in the webapp and only a couple of simple wrapper classes and interfaces went into the server and common classloaders. HTH, Jon Zsolt wrote: Does anybody know how to configure Realm from .../META-INF/context.xml? Realm className=my.realm.JNDIRealm resourceName=my/RealmFactory/ I always get a ClassNotFoundException but the class does exist (under ../WEB-INF. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to reduce bandwidth (meaning message size) with Axis
Compression works very well. I added a homegrown GZip filter to the AXIS urls and also saw approx 10x compression. There are also a number of similar OSS Filters out there. There were .NET clients accessing the web-services and they needed a tweak to handle the compression: http://www.dotnetjunkies.com/Tutorial/90D3B3E0-6544-4594-B3BA-E41D8F381324.dcik The original messages could be of the order of 3MB and the client's network pipe wasn't so big: GZip was a saviour :) Jon David Rees wrote: On 3/15/06, David Kerber [EMAIL PROTECTED] wrote: Are there any adjustments I can do to my Axis settings to reduce the bandwidth usage on my SOAP requests? XML compresses very well, typically I have seen compression ratios over 10x! The key is to get your clients and servers configured to handle content compression. If you have Tomcat behind Apache, use mod_deflate. If Tomcat is running standalone, have a look at the default server.xml to turn it on. Finally, you have to pray that your clients have content compression support! The net result has been a huge bandwidth win in my experience, that when serving your typical html content. -Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Data Truncation Error
Try replacing the ampersand character with the xml entity amp; HTH, Jon Mark Whitby wrote: Further to my email earlier I've discovered I can either have the truncation on or the reconnect on, but I can't include both in the url otherwise Tomcat doesn't start up. Also, if I take off the autoreconnect I get a null pointer error on my connection class. I'm getting desperate so does anyone know how I can set the truncation to false and still have the auto reconnect on? Mark - Original Message - From: Mark Whitby [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, March 21, 2006 8:59 PM Subject: Data Truncation Error Hello all, I am using a MySQL 5.0.18 server with the mysql-connector-java-3.1.12-bin Connector/J driver to connect to it on a Tomcat 5.5.15 server. The connection works fine but occasionally when I try to add a Java double value to the database (a row set to DECIMAL(10,2))I get the following error: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'TotalCost' at row 1 Now I believe to solve this you have to turn data truncation off in the connection url. However, when I try url=jdbc:mysql://localhost:3306/fyp?jdbcCompliantTruncation=falseautoReconnect=true Tomcat fails to start and I have to remove the truncation bit so it just reads url=jdbc:mysql://localhost:3306/fyp?autoReconnect=true with which Tomcat does start up. So how can I get rid of this error? Many thanks Mark Whitby - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Distinguish between users and robots in access log?
Looks like you are running the default access log settings. For logging of user-agent and referer (when given) try: CustomLog logs/access_log combined http://httpd.apache.org/docs/1.3/logs.html#accesslog HTH, Jon Scott Purcell wrote: I really would like to find out how my (and if my site) is being indexed. I am using Tomcat 5.5 and I am running a ecommerce site. I have had nothing but trouble getting seen in search engines, so I would like to be able to somehow trace what pages robots are indexing. I did add a robots.txt and allow my whole domain to be indexed. So that being said, I added an access log but by default, I cannot really tell if I have users hitting my site, or when robots are visiting my site. Below is my access_log from Saturday. What I would like to be able to do, is distinguish between normal users, and robots. If I can verify that the robots are indexing my site, I would be happy, and then know I need to work more meta. But if they are not indexing my site, then I need to find out why. Does this make sense? Has anyone been through this before? Thanks ahead of time, Regards Scott Access log Saturday 152.163.100.73 - - [26/Mar/2006:02:27:13 -0600] GET /unique/viewThumbProducts.do?type=categorysearchString=Candles%20%20Ar omacategoryID=13pageNumber=1 HTTP/1.0 200 17139 152.163.100.72 - - [26/Mar/2006:02:27:14 -0600] GET /unique/includes/siteWide.css HTTP/1.0 200 15402 152.163.100.134 - - [26/Mar/2006:02:27:14 -0600] GET /unique/images/head_text.jpg HTTP/1.0 200 18661 152.163.100.138 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/spacer_transparent.gif HTTP/1.0 200 49 152.163.100.133 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/browseProducts.gif HTTP/1.0 200 659 152.163.100.66 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/moregreatfinds.gif HTTP/1.0 200 564 152.163.100.69 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/searchText.gif HTTP/1.0 200 624 152.163.100.138 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/go.gif HTTP/1.1 200 308 152.163.100.204 - - [26/Mar/2006:02:27:16 -0600] GET /unique//images/thumb/UP00130.jpg HTTP/1.0 200 10044 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding user-agent and possibly refer to log4j Tomcat 5.5
Is the unique.log where your site hits are being logged? I'm running tc5.0.x. For that version you would change the pattern attribute for the Valve doing the logging in server.xml (or context.xml depending on config). Just looked. It's the same in 5.5 http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html The last paragraph of the Access Log valve section mentions the combined pattern. HTH, Jon Scott Purcell wrote: Thanks Jon, After reviewing your response ... I believe this fix is for a Apache server? I am running Standalone Tomcat. It appears I need to somehow log the user-agent and possibly referrer to my default access log. Is this correct? If this is the case, does anyone know how to do this with Tomcat log4j? Here is my current properties file for logging: log4j.rootCategory=INFO, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=C:/Tomcat5.5/logs/unique.log log4j.appender.R.MaxFileSize=1500KB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d - %5p (%C:%L) - %m%n log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhos t][/unique]=INFO, R -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Monday, March 27, 2006 8:15 AM To: Tomcat Users List Subject: Re: Distinguish between users and robots in access log? Looks like you are running the default access log settings. For logging of user-agent and referer (when given) try: CustomLog logs/access_log combined http://httpd.apache.org/docs/1.3/logs.html#accesslog HTH, Jon Scott Purcell wrote: I really would like to find out how my (and if my site) is being indexed. I am using Tomcat 5.5 and I am running a ecommerce site. I have had nothing but trouble getting seen in search engines, so I would like to be able to somehow trace what pages robots are indexing. I did add a robots.txt and allow my whole domain to be indexed. So that being said, I added an access log but by default, I cannot really tell if I have users hitting my site, or when robots are visiting my site. Below is my access_log from Saturday. What I would like to be able to do, is distinguish between normal users, and robots. If I can verify that the robots are indexing my site, I would be happy, and then know I need to work more meta. But if they are not indexing my site, then I need to find out why. Does this make sense? Has anyone been through this before? Thanks ahead of time, Regards Scott Access log Saturday 152.163.100.73 - - [26/Mar/2006:02:27:13 -0600] GET /unique/viewThumbProducts.do?type=categorysearchString=Candles%20%20Ar omacategoryID=13pageNumber=1 HTTP/1.0 200 17139 152.163.100.72 - - [26/Mar/2006:02:27:14 -0600] GET /unique/includes/siteWide.css HTTP/1.0 200 15402 152.163.100.134 - - [26/Mar/2006:02:27:14 -0600] GET /unique/images/head_text.jpg HTTP/1.0 200 18661 152.163.100.138 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/spacer_transparent.gif HTTP/1.0 200 49 152.163.100.133 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/browseProducts.gif HTTP/1.0 200 659 152.163.100.66 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/moregreatfinds.gif HTTP/1.0 200 564 152.163.100.69 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/searchText.gif HTTP/1.0 200 624 152.163.100.138 - - [26/Mar/2006:02:27:16 -0600] GET /unique/images/go.gif HTTP/1.1 200 308 152.163.100.204 - - [26/Mar/2006:02:27:16 -0600] GET /unique//images/thumb/UP00130.jpg HTTP/1.0 200 10044 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Valve, how to Create Pattern
I may be wrong but I think there are only two predefined names: common and combined. For all others you set the pattern attribute to the required number and ordering of pattern elements as defined in the docs. From the docs: The shorthand pattern name common (which is also the default) corresponds to %h %l %u %t %r %s %b So, for example, if all you wanted was the url, the time it took to serve and the user agent you would set the pattern to: %U %D %{User-Agent}i The latter pattern element I got from the javadoc: http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/index.html Jon Scott Purcell wrote: Tomcat 5.5 OS=Win2000 I would like to change the pattern for a valve in my server.xml. The API shows when you have the element pattern for the AccessLogValve that you give it a name. So where can I define a pattern for my needs, give it a name, then use it? Does anyone have an example of that? Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: InputBuffer and Posting Data
What is buf.length? Is it the actual length of the data you want to post or is it 8k? The data you receive on the Tomcat side may be truncated by the Connector if the body data is longer than the value set for the Content-Length header. HTH, Jon Vikram Goyal wrote: Hi all, I am trying to post some data via an applet to a JSP running on Tomcat 5.5.16. In my applet code, I am setting the following: postConn.setRequestMethod(POST); postConn.setRequestProperty(Content-Length, (buf.length) + ); postConn.setRequestProperty(Content-Type, application/octet-stream); Now, on the server side, I am retrieving my actual data by using the ServletInputStream gathered from request.getInputStream() method. The connection also contains some query parameters, which I am retrieving on the server side using request.getParameter(). Now, irrespective of the size of the data that I post, the ServletInputStream is truncating the data to a size of 8K (for files greater than that size, smaller files are the received correctly). I understand, after going through the source code, that the Request class uses the InputBuffer class for reading from this stream and the default size of the buffer for this operation is 8K. However, I would have expected this buffer to grow, if the data was larger than this default, but this is not happening. Is there a setting to increase this buffer automatically that I need to set? Alternatively, is there a setting that I need to set that will set the default to a larger value? I have searched and searched and cannot find anything. Thanks, Vikram - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: InputBuffer and Posting Data
After re-reading the original description you should probably be aware of this portion of the javadocs for request.getParameter: quote If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method. /quote The reverse is probably true, too. The getParameter call probably affects the reading of body data for POSTs. Are the parameters you need in the query string? If so you may need to parse that yourself instead. The above may not be the problem. But... Jon Vikram Goyal wrote: It's funny you should say that. maxHttpHeaderSize is the incorrect parameter to use in this case, but I noticed that by changing the size of this header parameter, I was able to send larger files, although not consistently. But what I don't understand is how this parameter is affecting the size of the received data. There is clearly a bug here, but I just can't put my finger on what exactly the bug is. Vikram -Original Message- From: Lothar Krenzien [mailto:[EMAIL PROTECTED] Sent: Wednesday, 29 March 2006 1:17 AM To: Tomcat Users List Subject: Re: InputBuffer and Posting Data Look for the value of maxHttpHeaderSize in your server.xml in the CATALINA_HOME/conf diretory. I had a similar problem. -Ursprüngliche Nachricht- Von: Tomcat Users List users@tomcat.apache.org Gesendet: 28.03.06 16:24:20 An: Tomcat Users List users@tomcat.apache.org Betreff: Re: InputBuffer and Posting Data What is buf.length? Is it the actual length of the data you want to post or is it 8k? The data you receive on the Tomcat side may be truncated by the Connector if the body data is longer than the value set for the Content-Length header. HTH, Jon Vikram Goyal wrote: Hi all, I am trying to post some data via an applet to a JSP running on Tomcat 5.5.16. In my applet code, I am setting the following: postConn.setRequestMethod(POST); postConn.setRequestProperty(Content-Length, (buf.length) + ); postConn.setRequestProperty(Content-Type, application/octet-stream); Now, on the server side, I am retrieving my actual data by using the ServletInputStream gathered from request.getInputStream() method. The connection also contains some query parameters, which I am retrieving on the server side using request.getParameter(). Now, irrespective of the size of the data that I post, the ServletInputStream is truncating the data to a size of 8K (for files greater than that size, smaller files are the received correctly). I understand, after going through the source code, that the Request class uses the InputBuffer class for reading from this stream and the default size of the buffer for this operation is 8K. However, I would have expected this buffer to grow, if the data was larger than this default, but this is not happening. Is there a setting to increase this buffer automatically that I need to set? Alternatively, is there a setting that I need to set that will set the default to a larger value? I have searched and searched and cannot find anything. Thanks, Vikram - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Source for Tomcat 5.5.15
At a guess: http://svn.apache.org/repos/asf/tomcat/build/tags/tc5.5.x/TOMCAT_5_5_15/ Joe Bohn wrote: Mark, Thanks for the clarification. One more question. Is there a branch or tag in SVN for 5.5.15? I can get the source for 5.5 but I don't know how to get the source for a dot release. Thanks, Joe Mark Thomas wrote: Joe Bohn wrote: Is there another way to get the source for Tomcat 5.5.15 other than the zip file from the tomcat download page? SVN. I'm not certain that the source in the zip matches the binary distribution. It is. Explanations below. I ask because I noticed some strange things with the zip file: 1) There is a problem with jasper in the image. You cannot do a top-level build unless you move the contents of /jasper/jasper2 up into just /jasper. Sorry. My bad. In removing the unnecessary jasper2 directory, I missed the src part of build process. The directory move is the only difference. This has since been fixed. 2) When accessing the server the reported version is simply 5.5 rather than 5.5.15 as when running the binary image. I'm looking at the browser 404 messages or the output of snoop for example. The version is set in the build properties. In the past, the RM has set this in their local copy as part of the build. We have recently changed to checking this change into the repo so it is included in the tag. Any clarification you can provide would be appreciated. HTH. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Own implementation WebdavServlet
From previous posts to this list I believe the WebDAV servlet shipped with tomcat is intentionally a bare bones implementation. Have you seen the Slide project? http://jakarta.apache.org/slide/index.html Jon [EMAIL PROTECTED] wrote: I want to make my own implementation of org.apache.catalina.servlets.WebdavServlet. I first wanted to make a test by copying the contents of this class to a new class. Now there's a strange phenomenon: the ProxyDirContext resources cannot be retrieved. It is retrieved from the contextAttribute org.apache.catalina.resources, but I can't find where it is set. Can anybody help me with this? Why is it the DefaultServlet, and its subclass WebdavServlet can find it, but my own subclass with exactly the same code can't? Has anybody successfully made an own implementation of WebDAV? Jeroen - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java.lang.NoClassDefFoundError
Or better, read http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html and http://tomcat.apache.org/faq/classnotfound.html and deploy your application code appropriately. For the impatient: Tomcat doesn't use CLASSPATH. It sets up its own based on the servlet specification. Each deployed webapp has defined repositories for dependent class files/jars. Miguel Angel Ruz wrote: Can you send the Tomcat log and the Servlet code ?? -Mensaje original- De: Mann, Bradley [mailto:[EMAIL PROTECTED] Enviado el: lunes, 05 de junio de 2006 16:57 Para: users@tomcat.apache.org Asunto: java.lang.NoClassDefFoundError Hello, I am using Solaris 10 and Tomcat 5.5. I have deployed a web application using the Tomcat manager, but when I try to access the servlet, I am receiving a class not found error. This class is in my CLASSPATH environment variable. Where do I add this class so that my servlet can see it? Thanks, Brad Mann Software Engineer - Information Access Services HARRIS Corporation / GCSD (321) 984-6292 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat creating two threads for one request
I would turn on the access logs (if you haven't already) and check that the browser isn't actually sending two requests. This can sometimes happen if the user double-clicks submit buttons. There are plenty of threads in the archives of this list suggesting ways to mitigate this double-submission problem. HTH, Jon Nikita Tovstoles wrote: Sourab, I'm facing the exactly same problem and yet to find a solution. Is your Tomcat instance listening on 2 ports by chance? Also is the request.getParameterMap() of one of those parallel requests missing any query parameters? -nikita Sourabh Antani wrote: Hi, I am facing this situation. I have a login screen, when the user clics the submit button, Tomcat sometimes creates two threads in parallel to process the request. This causes a problem with the database. This does not always happen. Most of the time it creates only one thread as expected. However, every once in a while it will create two threads that run in parallel. Any ideas? Thanks, Sourabh Antani __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: web.xml error page redirect, Java EE 5
Have you tried the request attributes specified in section SRV.9.9 Error Handling of the servlet spec? Specifically, the request attribute named javax.servlet.error.request_uri. HTH, Jon Tomas Pop wrote: Hello, I have a problem with change of the method HttpServletRequest.getRequestURL() in Java EE 5. I have this situation: URL matches http://server/app/page-key-word-string These URLs generates 404 Tomcat error page, which redirects (according to web.xml settings) to redirectServlet, where I get the client URL by calling request.getRequestURL() and then I parse the page-key-word-string and select the matching page from DB. This worked fine in Java EE 1.4 but in Java EE 5 the getRequestURL() method returns the path to redirectServlet instead of the client URL. Please, where can I get the path specified by the client after Tomcat 404 error page redirection? Or is there other way to implement these functionality? Thanks a lot. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: profiling a webapp
Netbeans profiler. Free and does a pretty good job. http://profiler.netbeans.org/ http://profiler.netbeans.org/docs/help/5.5/profile_j2ee.html asaf.lahav wrote: Can anyone recommend a good (and FREE) java profiling tool that can be used to profile a webapp running under Tomcat 5.5? Thanks in advance, Asaf - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat pauses then crashes after a period of time
Another thing to note is that mysql automatically closes idle connections after 8hrs (by default). You can configure DBCP to test on borrow or to periodically squirt some sql down idle connections. HTH, Jon David Wood wrote: Chris, Thanks very much for the suggestion. I'm not using connection pooling at this stage. I have deployed my web service scoped as an Application. It only uses one connection, and the classes maintain some medium sized data structures which I do not want to have to re-create each time the service is consumed. I'll investigate the pooling, as an auto-reconnect feature will be necessary in some form or another, and if DBCP can do it then that would be great, even if I maintain only one connection I guess... cheers Dave -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Tuesday, 12 December 2006 10:33 AM To: Tomcat Users List Subject: Re: tomcat pauses then crashes after a period of time -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David, David Wood wrote: Ok, I have found the problem. A firewall between my tomcat server and a MySQL server was closing the database connection. [snip] The execution continued and an exception was thrown, where in the catch{} section I was then calling System.exit(), which I thought would shut down the web service only, but it is actually shutting down the whole JVM, causing tomcat to stop too. Heh, well /there's/ yer problem. Firewalls are known for terminating idle TCP/IP connections after a certain period of time, which is unfortunate, as many deployments put the database behind the firewall and the app servers out front. Are you using any kind of database connection pooling? If so, perhaps there is an auto-reconnect feature available for that component. For instance, Jakarta Commons DBCP includes such a feature. Once you are using DBCP, your code doesn't have to know how to handle unexpected disconnects like that, since the connection pool handles the automatic reconnection for you. Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFffjT9CaO5/Lv0PARAl6EAJ4haR5ZfDodrGTK3oF3gdkotulG3ACgha8t wozRXyBuzTQDxPakjMFeqgI= =O8Fy -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: one filter for all webapps?
Can't you add the filter to conf/web.xml? I think tomcat (conceptually) folds all of conf.xml into each webapp's web.xml. Again, this behaviour is tomcat specific but at least the filter isn't. Jon Filip Hanik - Dev Lists wrote: in tomcat you can write a Valve http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html this is tomcat specific, so it wouldn't be portable across containers. Filip Dean Hiller wrote: Is there any way to install a ServletFilter that is run before all webapps(including the default servlet as well)? thanks, dean No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.2/372 - Release Date: 6/21/2006 -- Filip Hanik - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: many No Referrers in logs
Additionally, many client-side Security/Anti-Virus software packages automatically remove the referer header from requests. Markus Schönhaber wrote: Robert Kudyba wrote: We have our server.xml file set w/ the following entry: Valve className=org.apache.catalina.valves.AccessLogValve directory=../logs prefix=ws_access_log. suffix=.txt pattern=combined However, there are still many log entries showing no referrers. Some are from user spiders such as the following: [...] So should we assume that if there is no referrer logged than the user was just using links within the site? No. IMO you should first of all assume that no-one guarantees that a client is sending any referrer headers at all. Most modern browsers will do so but it is more or less easy to change their configure to not send them. And moreover, it is very easy to use a proxy the removes referrer headers from all requests - idependent of the client used or it's configuration. Because of this you can't draw any safe and definite conclusion from the absence of referrers. That said, David's answer stands: in propably most cases, no referrer means the request was made from a bookmark or by typing the URL into the address bar and not by clicking on a link on some page (which then would be the referring page). Wether or not the referring page was within the site is of no relevance. Regards mks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MyPrincipal cannot be resolved to a type
In addition, custom Realms merely need to create instances of Principal. There is no requirement for them to extend GenericPrincipal. Our Realm classes are deployed to server/lib Our extension to Principal is deployed to common/lib See the thread Is custom realm using user/role data in webapp possible? from 26th May for more details. HTH, Jon Nicholas Sushkin wrote: MyPrincipal cannot be resolve to a type when trying the following: ((MyPrincipal)request.getUserPrincipal()).getDisplayName(); Yuri, Josso implemented their own Principal that has additional properties. You may want to poke around http://www.josso.org/developer-howto.html - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MyPrincipal cannot be resolved to a type
Fair enough. We also extend RealmBase and just override hasRole(Principal principal, String role), which is the only place GenericPrincipal is referenced in RealmBase. We use our own storage mechanism for Roles. http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/RealmBase.java As to moving server/lib/* to common/lib/*. Sounds scary to me :) Yuri de Wit wrote: Yes, in the spirit of dont reinvent the wheel I was trying to leverage as much as possible from the catalina BaseRealm, but that implementation requires GenericPrincipal to get the list of roles associated with the principal. Thanks for the pointer. Any issues moving all the jar from server/lib to common/lib for a quick workaround? On 6/29/06, Jon Wingfield [EMAIL PROTECTED] wrote: In addition, custom Realms merely need to create instances of Principal. There is no requirement for them to extend GenericPrincipal. Our Realm classes are deployed to server/lib Our extension to Principal is deployed to common/lib See the thread Is custom realm using user/role data in webapp possible? from 26th May for more details. HTH, Jon Nicholas Sushkin wrote: MyPrincipal cannot be resolve to a type when trying the following: ((MyPrincipal)request.getUserPrincipal()).getDisplayName(); Yuri, Josso implemented their own Principal that has additional properties. You may want to poke around http://www.josso.org/developer-howto.html - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with doPost method - executed twice
You need to look at your access logs. You'll probably see two requests. Your form submit button calls javascript which also calls form.submit(). I think, if you don't return false from the javascript you will get two form submissions. Try removing the form.submit() from the javascript. HTH, Jon [EMAIL PROTECTED] wrote: Dear all, I have developed a web application that is running under tomcat 5.5.17 that is under windows XP. I have a servlet that retrieves data from a html form, creates an object and passes this object to a manager class that inserts the data into Oracle. Everything works fine except that I noticed that my doPost method executes twice each command. It is incrementing twice the Oracle sequence and inserting twice the same record. Does anyone have a clue on what is going on? When I look into the table this is what I get: SQL select * from marcapropriedade; IDMARCAPROPRIEDADE DESCRICAO -- -- 1 Acordos Internacionais 2 Adm Pública Federal 3 Defesa 4 Mercosul 45 lalalala 46 lalalala 47 papapapapapa 48 papapapapapa 49 another test 50 another test 10 linhas selecionadas. This is my servlet: //package servlets; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import objeto.MarcaPropriedade; import objeto.MarcaPropriedadeGestor; public class RegistraMarcaPropriedade extends HttpServlet { /** * Process the HTTP Post request */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println(I am here 1); // Create object to store information from previous form MarcaPropriedade marcaPropriedade = new MarcaPropriedade(); marcaPropriedade.setDescricao(request.getParameter(txtDescricao)); System.out.println(marcaPropriedade.getDescricao()); System.out.println(I am here 2); // Create a MarcaPropriedadeGestor to add marcaPropriedade to the database MarcaPropriedadeGestor marcaPropriedadeGestor = new MarcaPropriedadeGestor(); marcaPropriedadeGestor.add(marcaPropriedade); System.out.println(I am here 3); // Release resources marcaPropriedadeGestor.releaseResources(); // Here the registration is complete. // Now send the user to the 'Relação de Marcas de Propriedades' page RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(//Sisc/exibeMarcaPropriedade. htm); dispatcher.forward(request, response); } } this is what I get from LOG: I am here 1 I am here 1 papapapapapa papapapapapa I am here 2 I am here 2 [Fri Jun 30 11:21:12 BRT 2006] info: PoolManager: registered JDBC driver oracle.jdbc.driver.OracleDriver 10 [Fri Jun 30 11:21:12 BRT 2006] info: oracle: New pool created [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Opened a new connection [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Delivered connection from pool dentro do add -inicio Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Opened a new connection [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Delivered connection from pool dentro do add -inicio Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Opened a new connection [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Delivered connection from pool [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Opened a new connection [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Delivered connection from pool [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Returned connection to pool 47 [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Returned connection to pool 48 insert into MARCAPROPRIEDADE values (?, ?) insert into MARCAPROPRIEDADE values (?, ?) I am here 3 I am here 3 [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Returned connection to pool [Fri Jun 30 11:21:13 BRT 2006] info: oracle: Returned connection to pool I am here 1 another test I am here 2 [Fri Jun 30 11:22:19 BRT 2006] info: oracle: Delivered connection from pool dentro do add -inicio Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL [Fri Jun 30 11:22:19 BRT 2006] info: oracle: Delivered connection from pool [Fri Jun 30 11:22:19 BRT 2006] info: oracle: Returned connection to pool 49 insert into MARCAPROPRIEDADE values (?, ?) I am here 1 another test I am here 2 [Fri Jun 30 11:22:19 BRT 2006] info: oracle: Delivered connection from pool dentro do add -inicio Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL [Fri Jun 30 11:22:19 BRT 2006] info: oracle: Delivered connection from pool I am here 3 [Fri Jun 30 11:22:19 BRT 2006] info: oracle:
Re: Getting the date/time from the client
The HTTP spec (rfc2616) says clients should only send the Date header with http messages with body content (POST, PUT) and even then it's optional. Try adding a date string as a parameter on your GET request which your servlet can then parse from request.getParameter(...). One way to do this would be to change your link to a form with a hidden input field for your date value. Add an onclick/onsubmit javascript handler to your form button which sets the value of the hidden field to the current date in a format that your servlet will understand. for example: function setDate(form) { form.dateField.value = new Date().toString(); } Example assumes a hidden form input field with name dateField. HTH, Jon Vinu Varghese wrote: SK, That javascript prints the current client time. But I want the client time with the request. The scenario is : I have a index.jsp %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 titleInsert title here/title /head body Client time : a href=clienttime.htm Click/a /body /html and a servlet that can take the client time (Hoping to :-) ) which is mapped to 'clienttime.htm' protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(text/plain); long time = request.getDateHeader(Date); // Hoping to get the client date. PrintWriter out = response.getWriter(); out.println(Server time + new Date()); out.println(Client time (long) + time); out.println(Client time + new Date(time)); } Is there any way to do this (get the client time from the request) ? Or Am I trying to do a dumb thing ? ;) Thanks Regards Vinu Shinya Koizumi wrote: Vinu Yeah, you are right about it, I can't get getDateHeader working. For the solution one, I have setup like this for jsp and worked. %@ page session=false % html head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 title%= application.getServerInfo() %/title /head body Current Time: % out.println(SCRIPT LANGUAGE=JavaScript); out.println(var currentTime = new Date();); out.println(document.write(currentTime.toLocaleString());); out.println(/SCRIPT); out.println(/HEAD); % /body /html SK - Original Message - From: Vinu Varghese [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, July 11, 2006 1:24 AM Subject: Re: Getting the date/time from the client Thanks SK, I tried the second solution , but request.getDateHeader(Date) returns -1 . Also I didn't understand the first solution ( embed a javascript), Can u pls elaborate that. Thanks and regards Vinu Shinya Koizumi wrote: One is to embed javascript in the output out.println(HTMLHEADtitleJavaScriptExample/title); out.println(SCRIPT LANGUAGE=JavaScript); out.println(function back() {); out.println(history.back(-1);); out.println(}); out.println(/SCRIPT); out.println(/HEAD); The other solution is to get it from the request header. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { long l = request.getDateHeader(Date); Date d = new Date(l); System.out.println(d); } SK - Original Message - From: Vinu Varghese [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, July 11, 2006 12:51 AM Subject: Getting the date/time from the client Hi All, I am doing a project in jsp/servlet and tomcat, which requires to take the client date/time (ie the time of the machine the browser is running). Is there any way to accomplish this ? Thanks regards Vinu -- Vinu Varghese [EMAIL PROTECTED] www.x-minds.org - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Vinu Varghese [EMAIL PROTECTED] www.x-minds.org - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using a property file in java class (not servlet)
Probably not without using standard java io and a file path (which you can't rely on for packed web-apps). If the file was in /appName/WEB-INF/classes it would be a resource that could be found by the classloader. HTH, Jon sbell wrote: Hello, Is there anyway of referencing a properties file located in: /appName/WEB-INF/file.propertes From inside a standard java class file? steve - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing a servlet
I would check in tomcat logs directory for reasons why the servlet is not available. One reason could be that classes should be in a package: http://tomcat.apache.org/faq/classnotfound.html HTH, Jon McRaven, Brian wrote: OK I did that and now my system is hanging which I guess could be an error in my code or something with the server. I think it is my code so I'll look that over. Thanks for your help. Sorry for the confusion. Brian -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 2:48 PM To: Tomcat Users List Subject: Re: Accessing a servlet Did you reload the webapp after making the change? All changes to WEB-INF/web.xml or files in WEB-INF/classes and WEB-INF/lib will require a reload before they become active in tomcat. --David McRaven, Brian wrote: I was able to refer to a book I have and so I dropped the .class extensions altogether. I get an error that requested resource is not available still. Any suggestions on this? My web.xml file has this entry: servlet servlet-nameJustALittleTest/servlet-name servlet-classJustAlittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/JustALittleTest/url-pattern /servlet-mapping And my action attribute=JustALittleTest. Brian -Original Message- From: McRaven, Brian Sent: Tuesday, July 11, 2006 1:14 PM To: users@tomcat.apache.org Subject: Accessing a servlet Well I'm ticking these newbie questions off. I have a simple servlet that I want my form to access. I compiled the file fine and it is called JustALittleTest.class. I placed this file in the ROOT/WEB-INF/classes folder. In my JSP I have a form with some submit buttons. The action element of the form is set to =JustALittleTest. I changed my web.xml file so it now has the following entries: servlet servlet-nameJustALittleTest/servlet-name servlet-classJustAlittleTest.class/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/JustALittleTest.class/url-pattern /servlet-mapping I've tried a few changes to the above entries but I haven't gotten it right yet. Should the servlet-class value have a .class extension? Is my url pattern accessing the correct folder? Brian - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing a servlet
OK. The web.xml entries should probably be something like this: servlet servlet-namejust-a-little-test/servlet-name servlet-classfirstpack.JustAlittleTest/servlet-class /servlet servlet-mapping servlet-namejust-a-little-test/servlet-name url-pattern/some/useful/mapping/url-pattern /servlet-mapping and the form action should be /some/useful/mapping. I changed the names so they weren't all JustAlittleTest ;) As to the logs, I assumed there would be stacktraces in the logs for ClassNotFound/NoClassDefFound exceptions if the mapping was not valid. HTH, Jon McRaven, Brian wrote: I made the servlet part of a package but I'm getting a Servlet not Found Exception. The actions I took to make the servlet part of a package are the following: 1 added package line to java code, recompiled 2 placed new class file in new subdirectory of WEB-INF/classes folder with same name of package 3 changed entry in web.xml file to reflect package that servlet is in for the url-pattern 4 changed JSP so that the forms action=firstpack.JustALittleTest I've looked at the log files but I'm not sure what to look for. Brian -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 7:49 AM To: Tomcat Users List Subject: Re: Accessing a servlet I would check in tomcat logs directory for reasons why the servlet is not available. One reason could be that classes should be in a package: http://tomcat.apache.org/faq/classnotfound.html HTH, Jon McRaven, Brian wrote: OK I did that and now my system is hanging which I guess could be an error in my code or something with the server. I think it is my code so I'll look that over. Thanks for your help. Sorry for the confusion. Brian -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 2:48 PM To: Tomcat Users List Subject: Re: Accessing a servlet Did you reload the webapp after making the change? All changes to WEB-INF/web.xml or files in WEB-INF/classes and WEB-INF/lib will require a reload before they become active in tomcat. --David McRaven, Brian wrote: I was able to refer to a book I have and so I dropped the .class extensions altogether. I get an error that requested resource is not available still. Any suggestions on this? My web.xml file has this entry: servlet servlet-nameJustALittleTest/servlet-name servlet-classJustAlittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/JustALittleTest/url-pattern /servlet-mapping And my action attribute=JustALittleTest. Brian -Original Message- From: McRaven, Brian Sent: Tuesday, July 11, 2006 1:14 PM To: users@tomcat.apache.org Subject: Accessing a servlet Well I'm ticking these newbie questions off. I have a simple servlet that I want my form to access. I compiled the file fine and it is called JustALittleTest.class. I placed this file in the ROOT/WEB-INF/classes folder. In my JSP I have a form with some submit buttons. The action element of the form is set to =JustALittleTest. I changed my web.xml file so it now has the following entries: servlet servlet-nameJustALittleTest/servlet-name servlet-classJustAlittleTest.class/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/JustALittleTest.class/url-pattern /servlet-mapping I've tried a few changes to the above entries but I haven't gotten it right yet. Should the servlet-class value have a .class extension? Is my url pattern accessing the correct folder? Brian - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing a servlet
You've deployed this in the ROOT webapp? form action should be /firstpack/JustALittleTest McRaven, Brian wrote: OK so now I have this: action=JustALittleTest/firstpack/JustALittleTest For a web.xml of file of: servlet servlet-nameJustALittleTest/servlet-name servlet-classfirstpack.JustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack/JustALittleTest/url-pattern /servlet-mapping And I get requested resource not found. Brian -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 11:05 AM To: Tomcat Users List Subject: Re: Accessing a servlet check your ./WEB-INF/web.xml servlet servlet-nameFooServlet/servlet-name servlet-classFooServlet/servlet-class /servlet servlet-mapping servlet-nameFooServlet/servlet-name url-pattern/servlet/Foo/url-pattern /servlet-mapping reference to invoke is ServletServletNameFromWeb.xml/Url-patternFromActionMapping e.g. FooServlet/servlet/Foo Martin-- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: McRaven, Brian [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, July 12, 2006 10:43 AM Subject: RE: Accessing a servlet If the url-pattern should be /firstpack/JustALittleTest then should the form on the JSP refer to action=firstpack.JustALittleTest or action=firstpack/JustALittleTest ? Brian -Original Message- From: McRaven, Brian Sent: Wednesday, July 12, 2006 9:55 AM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Accessing a servlet When I use this entry I get a request resource not found error. servlet servlet-nameJustALittleTest/servlet-name servlet-classfirstpack.JustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack/JustALittleTest/url-pattern /servlet-mapping Under the previous error to this one I was using an entry of: servlet servlet-nameJustALittleTest/servlet-name servlet-classJustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack.JustALittleTest/url-pattern /servlet-mapping With the following entry: servlet servlet-nameJustALittleTest/servlet-name servlet-classfirstpack.JustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack.JustALittleTest/url-pattern /servlet-mapping I get an error of 'Error allocating a servlet instance' Brian -Original Message- From: Pid [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 9:46 AM To: Tomcat Users List Subject: Re: Accessing a servlet servlet servlet-nameTheServletName/servlet-name servlet-classpackage.ThisIsTheClassName/servlet-class /servlet servlet-mapping servlet-nameTheServletName/servlet-name url-pattern/a/path/to/theservlet/url-pattern /servlet-mapping servlet-name is used to link the definition to the mapping. defs are grouped together in web.xml, as are mappings. url-pattern refers to the path by which you'll access the servlet. it can any unique url on your system, and does not have to reflect the class name. McRaven, Brian wrote: I made the servlet part of a package but I'm getting a Servlet not Found Exception. The actions I took to make the servlet part of a package are the following: 1 added package line to java code, recompiled 2 placed new class file in new subdirectory of WEB-INF/classes folder with same name of package 3 changed entry in web.xml file to reflect package that servlet is in for the url-pattern 4 changed JSP so that the forms action=firstpack.JustALittleTest I've looked at the log files but I'm not sure what to look for. Brian -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 7:49 AM To: Tomcat Users List Subject: Re: Accessing a servlet I would check in tomcat logs directory for reasons why the servlet is not available. One reason could be that classes should be in a package: http://tomcat.apache.org/faq/classnotfound.html HTH, Jon McRaven, Brian wrote: OK I did that and now my system is hanging which I guess could be an error in my code or something with the server. I think it is my code so I'll look that over. Thanks for your help. Sorry for the confusion. Brian -Original Message- From: David Smith [mailto
Re: Accessing a servlet
ROOT/WEB-INF/classes/firstpack/JustALittleTest.class and JustALittleTest.java should have a package declaration of firstpack prior to compilation. McRaven, Brian wrote: Yes, the forms are in the ROOT webapp. The firstpack is in the ROOT/WEB-INF/classes folder. Where should the firstpack go? Brian -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 11:30 AM To: Tomcat Users List Subject: Re: Accessing a servlet You've deployed this in the ROOT webapp? form action should be /firstpack/JustALittleTest McRaven, Brian wrote: OK so now I have this: action=JustALittleTest/firstpack/JustALittleTest For a web.xml of file of: servlet servlet-nameJustALittleTest/servlet-name servlet-classfirstpack.JustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack/JustALittleTest/url-pattern /servlet-mapping And I get requested resource not found. Brian -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 11:05 AM To: Tomcat Users List Subject: Re: Accessing a servlet check your ./WEB-INF/web.xml servlet servlet-nameFooServlet/servlet-name servlet-classFooServlet/servlet-class /servlet servlet-mapping servlet-nameFooServlet/servlet-name url-pattern/servlet/Foo/url-pattern /servlet-mapping reference to invoke is ServletServletNameFromWeb.xml/Url-patternFromActionMapping e.g. FooServlet/servlet/Foo Martin-- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: McRaven, Brian [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, July 12, 2006 10:43 AM Subject: RE: Accessing a servlet If the url-pattern should be /firstpack/JustALittleTest then should the form on the JSP refer to action=firstpack.JustALittleTest or action=firstpack/JustALittleTest ? Brian -Original Message- From: McRaven, Brian Sent: Wednesday, July 12, 2006 9:55 AM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Accessing a servlet When I use this entry I get a request resource not found error. servlet servlet-nameJustALittleTest/servlet-name servlet-classfirstpack.JustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack/JustALittleTest/url-pattern /servlet-mapping Under the previous error to this one I was using an entry of: servlet servlet-nameJustALittleTest/servlet-name servlet-classJustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack.JustALittleTest/url-pattern /servlet-mapping With the following entry: servlet servlet-nameJustALittleTest/servlet-name servlet-classfirstpack.JustALittleTest/servlet-class /servlet servlet-mapping servlet-nameJustALittleTest/servlet-name url-pattern/firstpack.JustALittleTest/url-pattern /servlet-mapping I get an error of 'Error allocating a servlet instance' Brian -Original Message- From: Pid [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 9:46 AM To: Tomcat Users List Subject: Re: Accessing a servlet servlet servlet-nameTheServletName/servlet-name servlet-classpackage.ThisIsTheClassName/servlet-class /servlet servlet-mapping servlet-nameTheServletName/servlet-name url-pattern/a/path/to/theservlet/url-pattern /servlet-mapping servlet-name is used to link the definition to the mapping. defs are grouped together in web.xml, as are mappings. url-pattern refers to the path by which you'll access the servlet. it can any unique url on your system, and does not have to reflect the class name. McRaven, Brian wrote: I made the servlet part of a package but I'm getting a Servlet not Found Exception. The actions I took to make the servlet part of a package are the following: 1 added package line to java code, recompiled 2 placed new class file in new subdirectory of WEB-INF/classes folder with same name of package 3 changed entry in web.xml file to reflect package that servlet is in for the url-pattern 4 changed JSP so that the forms action=firstpack.JustALittleTest I've looked at the log files but I'm not sure what to look for. Brian -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 7:49 AM To: Tomcat Users List Subject: Re: Accessing a servlet I would check
Re: out of memory error
The process running tomcat can't (read isn't allowed by OS) to create any more threads: java.lang.OutOfMemoryError: unable to create new native thread If you are on unix you can up the number by tinkering with the ulimit command. HTH, Jon MW Janssen wrote: Hi, Can anyone explain and suggest a solution on error below: Jul 19, 2006 12:49:18 PM org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run SEVERE: Caught exception (java.lang.OutOfMemoryError: unable to create new native thread) executing HYPERLINK mailto:[EMAIL PROTECTED]org.apa [EMAIL PROTECTED], terminating thread Jul 19, 2006 1:25:30 PM org.apache.coyote.http11.Http11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-80 Jul 19, 2006 1:25:31 PM org.apache.catalina.core.StandardService stop INFO: Stopping service Tomcat-Standalone Jul 19, 2006 1:25:32 PM org.apache.catalina.core.ApplicationContext log INFO: action: Finalizing this controller servlet Jul 19, 2006 1:25:32 PM org.apache.catalina.core.StandardWrapper unload INFO: Waiting for 3 instance(s) to be deallocated Jul 19, 2006 1:25:33 PM org.apache.catalina.core.StandardWrapper unload INFO: Waiting for 3 instance(s) to be deallocated Jul 19, 2006 1:25:34 PM org.apache.catalina.core.StandardWrapper unload INFO: Waiting for 3 instance(s) to be deallocated Jul 19, 2006 1:25:34 PM org.apache.catalina.core.ApplicationContext log INFO: action: Finalizing this controller servlet Jul 19, 2006 1:25:34 PM org.apache.coyote.http11.Http11Protocol destroy INFO: Stopping Coyote HTTP/1.1 on http-80 Regards, Maarten Janssen - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: out of memory error
This may be of help (emphasis on may): http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4765019 Has a bit about tuning Xss for a high number of threads. MW Janssen wrote: Hi, These are my parameters: I have Xmx1024m and Xms1024m as well for the heap size memory. I dont set Xss so I presume I use the default value. My Operating System: OS Name: Windows 2003 OS Version: 5.2 Total RAM: 2.00Gb Free RAM: 2.00Gb Committed JVM memory: 1.02Gb Total swap: 4.00Gb Free swap: 3.87Gb (from lambdaprobe) Maarten -Oorspronkelijk bericht- Van: David Tonhofer [mailto:[EMAIL PROTECTED] Verzonden: woensdag 19 juli 2006 16:57 Aan: Tomcat Users List Onderwerp: Re: out of memory error MW Janssen wrote: java.lang.OutOfMemoryError: unable to create new native thread Are you it isn't just the heap and/or stack that's too small? Try starting the Jvm with one of the extended options line -Xss500k -Xmx100m (if it is the Sun JVM) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/391 - Release Date: 18-7-2006 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Removal of headers in HttpServletResponse object
You'll probably need to write your own connector! See prepareResponse method: http://svn.apache.org/repos/asf/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11Processor.java http://svn.apache.org/repos/asf/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java In any case, at the very least the Date header is mandatory in the response for an HTTP/1.1 response (see rfc2616). Jon Geir Øvsttun (AS/ETO) wrote: Hi all, I am still struggling with the removal of header problem. I found that the ServletResponse has a reset() method which should delete all headers. I thought maybe I could use this and then reconstruct the response object with only the headers I want. I tried to do call this method in the http servlet code itself but when the object is returned Tomcat reconstruct the original headers before sending the response to the client. For this to work must the reset() method be called from a Filter or a Valve ? Geir :-) -Original Message- From: Geir Øvsttun (AS/ETO) [mailto:[EMAIL PROTECTED] Sent: 21. juli 2006 08:41 To: Martin Gainty; users@tomcat.apache.org Subject: RE: Removal of headers in HttpServletResponse object Hi Martin, Thanks for the feedback but I am afraid that the example did not really solve my problem. As far as I can understand your example only includes adding a header not removing. It also relies on the standard HttpServletResponse methods which does not include a removeHeader method. Geir :-) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: 20. juli 2006 19:25 To: Geir Øvsttun (AS/ETO) Subject: Re: Removal of headers in HttpServletResponse object Geir- I found a complete Tomcat Valve example here at http://www.explain-it.org/mediawiki/index.php/TomcatValve where the invoke() method would modify the outgoing response to omit the Header .. Sverige Altid- Martin -- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Geir Øvsttun (AS/ETO) [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Thursday, July 20, 2006 6:09 AM Subject: Removal of headers in HttpServletResponse object Hi , For fast prototyping and test purposes I am trying to simulate the responses of various devices (web cameras with embedded web servers) by using Tomcat. The problem I have is that Tomcat (5.5.17) seems to add by default the following headers to the HTTP/1.1 200 OK response: Server: Apache-Coyote/1.1 Content-Type: text/html;charset=ISO-8859-1 Content-Length: 82 Date: Thu, 20 Jul 2006 09:53:33 GMT These headers are not included by the various embedded devices I am trying to simulate. As the HttpServletResponse class does not have a removeHeader method (only add... And set...) I am stuck. I have tried to look into the use of Filters but to my understanding the Filter also relies on the methods of HttpServletResponse for manipulation of the response object. Can Tomcat in any way be configured to not include the headers ? Are there any other way to remove the headers ? Geir :-) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Removal of headers in HttpServletResponse object
Another approach would be to put Apache in front and use mod_headers: http://httpd.apache.org/docs/1.3/mod/mod_headers.html http://httpd.apache.org/docs/2.0/mod/mod_headers.html Note: I've not tried this approach and don't know if you can remove mandatory headers... Jon Wingfield wrote: You'll probably need to write your own connector! See prepareResponse method: http://svn.apache.org/repos/asf/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11Processor.java http://svn.apache.org/repos/asf/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java In any case, at the very least the Date header is mandatory in the response for an HTTP/1.1 response (see rfc2616). Jon Geir Øvsttun (AS/ETO) wrote: Hi all, I am still struggling with the removal of header problem. I found that the ServletResponse has a reset() method which should delete all headers. I thought maybe I could use this and then reconstruct the response object with only the headers I want. I tried to do call this method in the http servlet code itself but when the object is returned Tomcat reconstruct the original headers before sending the response to the client. For this to work must the reset() method be called from a Filter or a Valve ? Geir :-) -Original Message- From: Geir Øvsttun (AS/ETO) [mailto:[EMAIL PROTECTED] Sent: 21. juli 2006 08:41 To: Martin Gainty; users@tomcat.apache.org Subject: RE: Removal of headers in HttpServletResponse object Hi Martin, Thanks for the feedback but I am afraid that the example did not really solve my problem. As far as I can understand your example only includes adding a header not removing. It also relies on the standard HttpServletResponse methods which does not include a removeHeader method. Geir :-) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Memory Status?
Hi OP, They probably mean what they say ;) See the jdk javadocs for the System/Runtime classes. The Free Memory stat often causes confusion initially. It's the free memory in the block of RAM currently assigned to the JVM. So, it looks like at startup Tomcat is assigned 8Mb under your JVM on Win95. The max the JVM is set to use is 64Mb, meaning you really had ~58Mb free at the time of the snapshot. How much physical memory do you have in the box? You can tweak the maximum available memory using JAVA_OPTS http://tomcat.apache.org/faq/memory.html#adjust HTH, Jon Propes, Barry L wrote: MB Not GB? How are you even running Win 95 with 63.56MB? That's not enough swap space for anything is it? -Original Message- From: Gamigin Gamigin [mailto:[EMAIL PROTECTED] Sent: Saturday, July 22, 2006 5:13 PM To: users@tomcat.apache.org Subject: Tomcat Memory Status? I've been having OutOfMemory problems and I've been watching the Server Status section under Tomcat Manager. Immediately after starting Tomcat (with my main application undeployed) I see: Free memory: 2.17 MB Total memory: 5.84 MB Max memory: 63.56 MB Can anyone explain what these numbers mean? I can't find any explanation in the Tomcat documentation. What is the difference between Total memory and Max memory? Free memory is a lot lower than expected for just starting the server. I can't only have 2MB available after starting the server and not even running my application. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Missing Request Parameters
Rache, Tools like ieHTTPHeaders and LiveHTTPHeaders will also help you determine what the browser actually sends to the server, including any redirects caused by 302 response codes. HTH, Jon Rache, But this usually occur after redirects. This is what I was going to ask about: if you fail to put all the important parameters into the redirect, then you will lose them. For example, if you have a form handler that accepts 5 request parameters, you cannot simply say: response.sendRedirect(/foo/bar/baz); and expect those request parameters to be included for you. You must do this: response.sendRedirect(/foo/bar/baz?a=bc=de=g[etc]); getRequestDispatcher(url).forward(req, resp); Forwards should retain the request parameters. I've read something with 302 codes/redirects having to cause lost parameter/session info. This is not an HTTP problem; 302 codes can include complete URLs, including request parameters and even cookies (since they are just stored in the HTTP headers). Check your code very carefully to see where the parameters disappear, and I think you'll find that you are not building your URLs for redirection properly. -chris - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Missing Request Parameters
Erm. ok. Where does the redirectURL variable come from? Unless it has parameters encoded into it that will be your problem. Also, be a bit wary in using the RequestDumperValve with non-ascii charset data as it can corrupt some parameters: http://marc.theaimsgroup.com/?l=tomcat-userm=112530311007782w=2 The above (and other similar threads on this list) is why I tend to use the browser plug-ins first. Jon rache wrote: This is how the code redirects: if (redirectURL.toUpperCase().startsWith(/SERVLET)) { // routing to another request to the servlet... response.sendRedirect(request.getContextPath() + redirectURL); } else if (redirectURL.toUpperCase().startsWith(HTTP)) { // routing to another request to the servlet... response.sendRedirect(redirectURL); } else { // routing to a JSP... getRequestDispatcher(redirectURL).forward(request, response); } -Jon, we have enabled the RequestDumperValve in the tomcat server.xml to enable request logging. That way, we are able to monitor the requests coming in. The logs helped us to see that no parameters where set in the request. This application is connected to IIS thru the AJP connectors. Aside from the parameter-setting code which I need to check, could this connection also cause request parameters to be dropped? I have quite a bit of a problem checking the urls with parameters set since this happens in production and happens on and off. I can't even see the page source to check on the url set since the pages aren't cached. Any tips on these? I'm really grateful for all your inputs! - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTTP 408 Login timeout
If you have a custom error page set up you can trap the 408 response code and redirect to an appropriate resource. Works for me :) Alternatively, you can set up a meta refresh on your login page so you never get the 408. Of course, because the refresh has to go to some protected page and not back to the login page you lose the exact protected resource that the user originally requested. But hey, they couldn't have wanted it that badly if the session timed out while waiting to login ;) HTH, Jon C S wrote: I'm dealing with a problem where if a user hits a secured page and is forwarded to a login page (using Form Auth). If the user sits on that login page for too long, and then try to login they are confronted with a nasty HTTP 408 error. I don't know if this behaviour is part of the servlet spec, but rather then giving the user an error, could they be forwarded to a welcome page for the app? Or perhaps to the context's /? - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: After stopping tomcat, the tomcat process still appears to be running
You've also got other candidates such as database connections, JMS connections etc which could spawn threads (For example, for keep-alive functionality). The easiest thing to do is a thread dump (send the process a SIGQUIT signal) after stopping tomcat to see which thread(s) are keeping the JVM up. Once identified you need to fix your code. HTH, Jon Tomas Hulek wrote: At JVM shutdown, the JVM is terminated only if all remaining running threads are daemon threads. Therefore, if the application starts own threads, it is necessary to ensure that 1) either all these threads are destroyed before JVM shutdown by calling the stop() method for each of the threads, 2) or make them daemon threads by calling setDaemon() right after thread creation. Tomas Jørgen Nørgaard [EMAIL PROTECTED] To 18.10.2006 10:02 Tomcat Users List users@tomcat.apache.org cc Please respond to Tomcat Users Subject List Re: After stopping tomcat, the [EMAIL PROTECTED] tomcat process still appears to be che.org running Hello, If your servlet(s) start new threads that run independently of request this may happen. Could this be the case? On Wed, October 18, 2006 01:42, Elaine TING wrote: Hi, This is what I have done: 1) use shutdown.sh to shut down tomcat 2) Now the website appears to be down 3) Use ps -ef | grep tomcat to check the processes, tomcat still appears to be running: ps -ef | grep tomcat root 21892 1 1 14:30 pts/21 00:00:17 /local/Java/bin/java -Djava.endorsed.dirs=/opt/jakarta-tomcat/common/endorsed -classpath /local/Java/lib/tools.jar:/opt/jakarta-tomcat/bin/bootstrap.jar:/opt/jak arta-tomcat/bin/commons-logging-api.jar -Dcatalina.base=/opt/jakarta-tomcat -Dcatalina.home=/opt/jakarta-tomcat -Djava.io.tmpdir=/opt/jakarta-tomcat/temp org.apache.catalina.startup.Bootstrap start 4) use startup.sh to start tomcat 5) website appears to be up and running again 6) check the processes, now there are 2 tomcats running: ps -ef | grep tomcat root 21892 1 1 14:30 pts/21 00:00:17 /local/Java/bin/java -Djava.endorsed.dirs=/opt/jakarta-tomcat/common/endorsed -classpath /local/Java/lib/tools.jar:/opt/jakarta-tomcat/bin/bootstrap.jar:/opt/jak arta-tomcat/bin/commons-logging-api.jar -Dcatalina.base=/opt/jakarta-tomcat -Dcatalina.home=/opt/jakarta-tomcat -Djava.io.tmpdir=/opt/jakarta-tomcat/temp org.apache.catalina.startup.Bootstrap start root 22108 1 1 14:33 pts/21 00:00:19 /local/Java/bin/java -Djava.endorsed.dirs=/opt/jakarta-tomcat/common/endorsed -classpath /local/Java/lib/tools.jar:/opt/jakarta-tomcat/bin/bootstrap.jar:/opt/jak arta-tomcat/bin/commons-logging-api.jar -Dcatalina.base=/opt/jakarta-tomcat -Dcatalina.home=/opt/jakarta-tomcat -Djava.io.tmpdir=/opt/jakarta-tomcat/temp org.apache.catalina.startup.Bootstrap start ops 22427 10618 0 14:52 pts/21 00:00:00 grep tomcat Why was shutdown.sh unable to kill the tomcat process? I'm running Tomcat 5.0.28 on SUSE LINUX Enterprise Server 9. Java version: 1.5.0_03. Thank you in advance, Elaine -- /jørgen nørgaard e-mail: [EMAIL PROTECTED] | Phone: +45 2627 3769 http://anneli.dk/~jnp/ |\ _,,,---,,_ /,`.-'`'-. ;-;;,_ |,4- ) )-,_. ,\ ( `'-' '---''(_/--' `-'\_) - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: login page behavior and the 2.4 specification
Quick and dirty solution is to have your login page make a meta refresh every, say, ten minutes pointing to the index page of your protected content. This simple approach works for us. We also catch unexpected errors coming back from the login form submission and re-present the login page. As you say it's not ideal and better to avoid as many instances as possible. HTH, Jon Michael Swierczek wrote: I'm receiving a 408 error, and I do understand why. I just can't figure out an end-user friendly way to avoid it. The application runs on Tomcat 5.0.28 with form-based authentication. It is accessed by some end users from regular PCs, but most connect from kiosk web browsers. When someone initially connects, a new session is generated, they see the login page, they enter their credentials, and login is fine. Then they log out, and the login page sits with no activity for hours, days, or weeks. The next user comes along, enters their credentials, and submits. The request reaches the server with an expired session id and a 408 error is generated. I've read parts of the 2.4 servlet specification, and I realize this is the expected behavior. But obviously this isn't what we want, it is annoying to end users (even if I hide the 408 error and transparently redirect back to the login page). I've never used Ajax, but I imagine it would be possible to transparently retrieve a new session ID from the server as soon as the user starts to type a username or password. Assuming I can do that, it would solve the problem - but I am almost positive other solutions to this existed before the advent of Ajax. I would really appreciate any help, or suggestions as to where to search for more information. Thanks, Mike - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: login page behavior and the 2.4 specification
But you need to cater for the people who hit the login page and then go to lunch. Happens more frequently than you might think ;) David Smith wrote: Don't send people who logout to a protected page, forcing a login page to appear. Better to offer up a public, non-login page and have people click a link to initiate a new request for a protected page. --David Michael Swierczek wrote: I'm receiving a 408 error, and I do understand why. I just can't figure out an end-user friendly way to avoid it. The application runs on Tomcat 5.0.28 with form-based authentication. It is accessed by some end users from regular PCs, but most connect from kiosk web browsers. When someone initially connects, a new session is generated, they see the login page, they enter their credentials, and login is fine. Then they log out, and the login page sits with no activity for hours, days, or weeks. The next user comes along, enters their credentials, and submits. The request reaches the server with an expired session id and a 408 error is generated. I've read parts of the 2.4 servlet specification, and I realize this is the expected behavior. But obviously this isn't what we want, it is annoying to end users (even if I hide the 408 error and transparently redirect back to the login page). I've never used Ajax, but I imagine it would be possible to transparently retrieve a new session ID from the server as soon as the user starts to type a username or password. Assuming I can do that, it would solve the problem - but I am almost positive other solutions to this existed before the advent of Ajax. I would really appreciate any help, or suggestions as to where to search for more information. Thanks, Mike - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a discrepancy in webapp behavior in two environments
Mark, Take a look at the LiveHttpHeaders plug-in for Firefox. It may help you debug this on the client side. Temporarily enabling the RequestDumperValve on the server side will enable you to see if cookies are reaching the server. HTH, Jon Aronszajn, Mark wrote: Thanks for the information. I had checked Firefox in each environment (I think I mentioned this) to be sure that cookies were allowed, but I didn't realize that a firewall might block cookies. I really appreciate the help. Mark -Original Message- From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] Sent: Wed 10/18/2006 5:15 PM To: Tomcat Users List Subject: RE: a discrepancy in webapp behavior in two environments -Original Message- From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] Sent: Wed 10/18/2006 5:15 PM To: Tomcat Users List Subject: RE: a discrepancy in webapp behavior in two environments From: Aronszajn, Mark [mailto:[EMAIL PROTECTED] Subject: RE: a discrepancy in webapp behavior in two environments Could you explain how the configuration of a firewall would have such effect on whether the original HttpSession object gets retained? If you're not appending jsessionid ro the URL, you must be using cookies to allow the server to identify the client. Some smart (?) firewalls (or proxy servers) can be configured to drop cookies. For an example, see this thread: http://marc.theaimsgroup.com/?l=tomcat-userm=107017907404496w=2 Note that it could be a firewall installed on your Windows box, not just an external one. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Listener vs. load-on-startup
The order of events is: Startup: All listeners get called. All filters, load-on-startup servlets get inited. Shutdown: All filters, servlets get destroyed. All listeners get called. So, it is possible for the combination of load-on-startup init + contextDestroyed to do the same job as just using one ServletContextListener. But why do it? IMO load-on-startup was a hack in the early spec versions so that application data could be set up. ServletContextListener was added as the way forward ;) Regards, Jon lizhg wrote: Hi all,I have some problem with Listener and load-on-startup,I serch on google and I find this article below,it do a lot good to me, but I still want to ask , using the init() of a servlet and the contextDestroyed() of a listener are equal to Iusing the contexInitialized() and the contextDestroyed() of a listener? On 9 Nov 2001, Dr. Evil wrote: Date: 9 Nov 2001 07:43:17 - From: Dr. Evil [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: API 2.3: Listener vs. load-on-startup I have a few classes that need to be loaded by Tomcat before it starts to serve any requests. One of these opens a database pool, another opens a logger, etc. The traditional way to do this is with load-on-startup like this: servlet servlet-namestartlogging/servlet-name servlet-classstartlogging/servlet-class load-on-startup1/load-on-startup /servlet which calls the init() method of the class. However, I need to have an object installed into the ServletContext object before any requests can be serviced. The init() method of a servlet seems to have no access to the ServletContext object (is this correct?). You have access to the servlet context via the getServletContext() method of the servlet -- it is pre-initialized to work for you. However, using a listener is the better way to do this in a Servlet 2.3 environment. Because of this, I am thinking of using the new listener declaration to achieve this same goal. I can declare a listener like this: listener listener-classdostartupstuff/listener-class /listener and then in the dostartupstuff class, I declare a method: public void contexInitialized(ServletContextEvent e) { ... } which will be called as soon as the context is created. Is this the right way to do this? Yes. That is exactly what context listeners are designed to do. Why is it better than a servlet init() method? Because the container gives you *no* guarantee that it will keep a servlet loaded for the lifetime of the application (although many of them do), so if you clean up your resources in the destroy() method -- such as closing database connections -- this might happen to you at a bad time. The contextDestroyed() method of your listener will not get called until the application is really being shut down. And is there a way I can control the order in which listeners are called? At startup time, listeners are called in the order they are defined in the deployment descriptor -- at shutdown time, they are called in reverse order. For more info, see the 2.3 spec: http://java.sun.com/products/servlet/download.html Thanks Craig - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hi,problem when shutdown tomcat!
Chuck answered a similar query recently: http://marc.info/?l=tomcat-userm=118113828210257w=2 Your servlets are serving long-running requests (or are in infinite loops, dead-locked etc) when you are trying to shutdown tomcat. The first thing I'd do in this situation is SIGQUIT tomcat to get a stackdump of the running threads. With that you can usually determine the changes you need to do to your servlets, if required. If the stackdump isn't a help I'd attach a profiler to see where your servlets are spending the time. I like the one bundled with netbeans. I'm sure others on the list have their own favourites. Jon Peter wrote: hi all; when i shutdown tomcat, i found following message in the catalina.out; 2007-6-12 18:18:44 org.apache.catalina.core.StandardWrapper unload * Waiting for 6 instance(s) to be deallocated* 2007-6-12 18:18:45 org.apache.catalina.core.StandardWrapper unload *Waiting for 6 instance(s) to be deallocated *2007-6-12 18:18:46 org.apache.catalina.core.StandardWrapper unload *Waiting for 6 instance(s) to be deallocated *2007-6-12 18:18:46 org.apache.catalina.core.StandardWrapper unload *Waiting for 333 instance(s) to be deallocated* 2007-6-12 18:18:47 org.apache.catalina.core.StandardWrapper unload *Waiting for 333 instance(s) to be deallocated* 2007-6-12 18:18:48 org.apache.catalina.core.StandardWrapper unload * Waiting for 333 instance(s) to be deallocated* anyone has a idea about the about messages, does it means that there is dead lock in the program? or some connection are not closed? thank you for ideas! peter - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hi,problem when shutdown tomcat!
Good question. I don't know. The last time I used JBuilder was way back in 2000. The Borland site suggests an OptimizeIt profiler is present in JBuilder for the Developer and Enterprise editions: http://info.borland.com/techpubs/jbuilder/ Jon Peter wrote: thank you for ideas i current using JBuider2006, what profiler can used in JBuider2006? thanks peter On 6/12/07, Jon Wingfield [EMAIL PROTECTED] wrote: Chuck answered a similar query recently: http://marc.info/?l=tomcat-userm=118113828210257w=2 Your servlets are serving long-running requests (or are in infinite loops, dead-locked etc) when you are trying to shutdown tomcat. The first thing I'd do in this situation is SIGQUIT tomcat to get a stackdump of the running threads. With that you can usually determine the changes you need to do to your servlets, if required. If the stackdump isn't a help I'd attach a profiler to see where your servlets are spending the time. I like the one bundled with netbeans. I'm sure others on the list have their own favourites. Jon Peter wrote: hi all; when i shutdown tomcat, i found following message in the catalina.out; 2007-6-12 18:18:44 org.apache.catalina.core.StandardWrapper unload * Waiting for 6 instance(s) to be deallocated* 2007-6-12 18:18:45 org.apache.catalina.core.StandardWrapper unload *Waiting for 6 instance(s) to be deallocated *2007-6-12 18:18:46 org.apache.catalina.core.StandardWrapper unload *Waiting for 6 instance(s) to be deallocated *2007-6-12 18:18:46 org.apache.catalina.core.StandardWrapper unload *Waiting for 333 instance(s) to be deallocated* 2007-6-12 18:18:47 org.apache.catalina.core.StandardWrapper unload *Waiting for 333 instance(s) to be deallocated* 2007-6-12 18:18:48 org.apache.catalina.core.StandardWrapper unload * Waiting for 333 instance(s) to be deallocated* anyone has a idea about the about messages, does it means that there is dead lock in the program? or some connection are not closed? thank you for ideas! peter - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hi,problem when shutdown tomcat!
The trace is probably in the catalina.out log file (at least that's where it goes for us running tc5.0.30) Peter wrote: hi all; I just found out that in linux under the /proc generate a fold 26337 does it the place which the information stores? any idea? thanks On 6/13/07, Peter [EMAIL PROTECTED] wrote: hi all; i try to use SIGQUIT but can not see the stack trace. [EMAIL PROTECTED] root]# ps -ef|grep tomcat root 26337 1 5 09:45 pts/0 00:00:11 /usr/java/jre1.5.0_08/bin/java -Xms256m -Xmx512m - Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager - Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties - Djava.endorsed.dirs=/opt/tomcat/common/endorsed -classpath :/opt/tomcat/bin/bootstrap.ja root 26427 26172 0 09:49 pts/0 00:00:00 grep tomcat [EMAIL PROTECTED] root]# kill -SIGQUIT 26337 [EMAIL PROTECTED] root]# kill -3 26337 [EMAIL PROTECTED] root]# does anyone has idea why? some artical said that if JVM set -Xrs,it will ignore the OS signal like SIGQUIT Does anyone know how can i see the stack trace in this situation? i use Tomcat 5.5.20 in linux , java, 1.5.0_10 thanks On 6/12/07, Jon Wingfield [EMAIL PROTECTED] wrote: Good question. I don't know. The last time I used JBuilder was way back in 2000. The Borland site suggests an OptimizeIt profiler is present in JBuilder for the Developer and Enterprise editions: http://info.borland.com/techpubs/jbuilder/ Jon Peter wrote: thank you for ideas i current using JBuider2006, what profiler can used in JBuider2006? thanks peter On 6/12/07, Jon Wingfield [EMAIL PROTECTED] wrote: Chuck answered a similar query recently: http://marc.info/?l=tomcat-userm=118113828210257w=2 Your servlets are serving long-running requests (or are in infinite loops, dead-locked etc) when you are trying to shutdown tomcat. The first thing I'd do in this situation is SIGQUIT tomcat to get a stackdump of the running threads. With that you can usually determine the changes you need to do to your servlets, if required. If the stackdump isn't a help I'd attach a profiler to see where your servlets are spending the time. I like the one bundled with netbeans. I'm sure others on the list have their own favourites. Jon Peter wrote: hi all; when i shutdown tomcat, i found following message in the catalina.out; 2007-6-12 18:18:44 org.apache.catalina.core.StandardWrapper unload * Waiting for 6 instance(s) to be deallocated* 2007-6-12 18:18:45 org.apache.catalina.core.StandardWrapper unload *Waiting for 6 instance(s) to be deallocated *2007-6-12 18:18:46 org.apache.catalina.core.StandardWrapper unload *Waiting for 6 instance(s) to be deallocated *2007-6-12 18:18:46 org.apache.catalina.core.StandardWrapper unload *Waiting for 333 instance(s) to be deallocated* 2007-6-12 18:18:47 org.apache.catalina.core.StandardWrapper unload *Waiting for 333 instance(s) to be deallocated* 2007-6-12 18:18:48 org.apache.catalina.core.StandardWrapper unload * Waiting for 333 instance(s) to be deallocated* anyone has a idea about the about messages, does it means that there is dead lock in the program? or some connection are not closed? thank you for ideas! peter - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]