Re: How to force Tomcat to use the system clock?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Richard, On 3/6/15 4:29 PM, Salisbury, Richard W DLA CTR INFORMATION OPERATIONS wrote: We have found a need to stop and start Tomcat once in a while to allow Tomcat to connect via HTTPS with some other servers. We think the restart may be synchronizing the time Tomcat uses with the server OS system time, and we are looking for ways to prevent having to stop/start Tomcat. Details: Our instance of Tomcat 6.0.36 runs on HP-UX B11.31 ia64 with JVM Version 1.7.0.08. It hosts a custom servlet which, when invoked, connects with a remote server via HTTPS to retrieve some data. However, after about a month the timestamp Tomcat sends in the SSL handshake appears to drift enough for the remote server's time to start rejecting requests because the timestamp is too far off (according to our partner's remote application logs). I was about to suggest that every six months or so, you have to bounce Tomcat. But you are saying it's roughly a month. Let me tell you why I thought it might be every six months: Your JRE is quite old (if it really is 1.7.0_08), and so its got outdated time zone definitions, especially DST corrections. Oracle created a timezone-update tool because the process was getting to be a royal pain, especially with users paranoid about upgrading the JRE without 18 years of testing. http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html You can see the changelog here: http://www.oracle.com/technetwork/java/javase/tzdata-versions-138805.html You'll notice that there are a whole bunch of updates to the time zones between ~2012 when 1.7.0_08 was released and now. Are you sure that Java's timestamps don't look right? Or are you just finding that SSL handshakes aren't working and blaming the Java system time (whatever definition that might have) for it? I like Jason Pyeron's suggestion that you create a simple JSP that will give you the current time according to Java. I think you'll find that Java's system time tracks your OS's system time exactly. We have servers running for months with no such drift, and we also use NTP (because hardware clock drift is in fact a real problem). We also run on both bare metal and virtualized hardware and have never had such problems. We have confirmed that our server clock is set correctly and synced with NTP, and matches the system clock on the remote server, which also uses NTP. So one thing we thought might be happening is that Tomcat (or the Java that Tomcat runs on) may be keeping an internal clock, perhaps using a separate thread as a way to speed up the retrieval of time so that it does not have to go to the OS system clock every time it needs the current time. And maybe this internal clock is not synced with the server time until Tomcat (or the JVM) is restarted. Tomcat absolutely does not use any internal clock of its own. The JRE almost certainly does not, either. It should all come down the system time. Before I posted, I checked by running this Java program: import java.util.*; import java.io.*; import java.text.SimpleDateFormat; public class CurrentTime { public static void main(String[] args) throws Exception { SimpleDateFormat df = new SimpleDateFormat(-MM-dd HH:mm:ss); while(true) { System.out.println(df.format(new Date())); Thread.currentThread().sleep(1000); } } } This just prints the current time every second, forever. In another terminal, I performed these commands while the above program was running: $ sudo date -s '2015-03-06 17:52:00' Fri Mar 6 17:52:00 EST 2015 (wait a few seconds) $ sudo date -s '2015-03-06 17:50:00' Fri Mar 6 17:50:00 EST 2015 This is the output from the Java program: 2015-03-06 17:49:48 2015-03-06 17:49:49 2015-03-06 17:49:50 2015-03-06 17:49:51 2015-03-06 17:49:52 2015-03-06 17:49:53 2015-03-06 17:49:54 2015-03-06 17:49:55 2015-03-06 17:49:56 2015-03-06 17:52:00 2015-03-06 17:52:01 2015-03-06 17:52:02 2015-03-06 17:52:03 2015-03-06 17:52:04 2015-03-06 17:52:05 2015-03-06 17:52:06 2015-03-06 17:52:07 2015-03-06 17:52:08 2015-03-06 17:52:09 As you can see, the Java process picked-up the clock-adjustment immediately. What's interesting is that the output stalls after I reset the time back to it's correct time (17:50:00). I suspect that Thread.sleep() doesn't just set a timeout in milliseconds, but schedules a wake-up at a particular time in the future. At 17:52:09 (after the clock was pushed-up relative to the proper time), Thread.sleep() schedules a sleep until 17:52:10. At 17:52:09, I changed the time back to 17:50:00, and so it will take 2:10 for the Thread.sleep to return. I ran this again, fiddled-around with the system time and waited. Here's the output: 2015-03-06 17:52:04 2015-03-06 17:52:05 2015-03-06 17:52:06 2015-03-06 17:52:07 2015-03-06 17:52:08 2015-03-06 17:52:09 2015-03-06 17:52:10 2015-03-06 17:52:11 2015-03-06 17:52:12 2015-03-06 17:55:00
Re: How to force Tomcat to use the system clock?
On Fri, Mar 6, 2015 at 3:06 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: Don't be quite so sure about the JRE in this case. This is HP's own JVM, derived from a Sun JVM specifically for HP UX on Itanium hardware. I don't believe it's being actively developed anymore, but I know HP threw in a fair number of tweaks for their platform. Write Once, Debug Everywhere :-) -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan Consulting Availability : Silicon Valley or remote - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Potential IndexOutBounds in AbstractServletInputStream::readLine() ?
I see. Thank you! -- Oswaldo. On Wed, Mar 4, 2015 at 4:21 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Oswaldo Olivo [mailto:ozzy...@gmail.com] Subject: Potential IndexOutBounds in AbstractServletInputStream::readLine() ? I was wondering if there is an unintentional potential index of out bounds exception in AbstractServletInputStream::readLine() ? It's not unintentional. It seems that len is partially sanitized, but the offset parameter 'off' is not. As the spec requires. In particular, 'off' could be allowed to be outside of 'buf', causing an exception while executing the statement b[off++]=(byte)c; Which is an error by the caller, resulting in an exception. One could change the loop condition to something like ((c=readInternal())!= -1 0=off offb.length) For what purpose? The return value of -1 specifically means there is no more data to be read. I believe that the implementation of readLine() in javax.ServletInputStream handles these border cases by returning -1 whenver an access outside of the array is attempted, so it doesn't suffer from this problem. Presumably you meant javax.servlet.ServletInputStream, not what you wrote. The readLine() implementation for that class certainly does not do what you describe, nor should it. Read the servlet spec and JavaDoc. Is this an issue that needs to be changed or is it the intended behavior to leave the responsibility of sanitizing the parameters to the caller ? Nothing in the spec indicates that the current behavior is inappropriate. - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: How to force Tomcat to use the system clock?
From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: How to force Tomcat to use the system clock? Tomcat absolutely does not use any internal clock of its own. The JRE almost certainly does not, either. Don't be quite so sure about the JRE in this case. This is HP's own JVM, derived from a Sun JVM specifically for HPUX on Itanium hardware. I don't believe it's being actively developed anymore, but I know HP threw in a fair number of tweaks for their platform. - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?
Hi Mark, Thanks for your quick response. I'm extending that class and overriding the method openConnection(URL u)as a public method. So I can use it from somewhere else. Thanks Best Regards /Thusitha On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote: On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote: Hi All, I'm working on migrating embedded tomcat 7 project to latest release of *tomcat 8.0.20* When compiling the project, I'm getting compilation errors saying that *org.apache.naming.resources* package can't be found. (I'm using *DirContextURLStreamHandler* which was resided in above package in tomcat 7) I've checked the Tomcat API doc too. It seems that the package doesn't exists there. Is that package removed from tomcat 8? Yes. If so what is/are the alternative(s)? That depends what you are trying to do. I couldn't found any source saying that it is been removed or deprecated. http://tomcat.apache.org/migration-8.html Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina
Tomcat Maven Plugin - Tomcat 8 support?
Hi all, I was wondering what the status of the Tomcat MavenPlugin wasand if the current plan is to have the next release support Tomcat 8? Tim
Re: Tomcats warning message about APR library
2015-03-06 13:41 GMT+03:00 Neven Cvetkovic neven.cvetko...@gmail.com: Hey Emir, On Thu, Mar 5, 2015 at 2:18 PM, Emir Ibrahimbegovic eibrahim@gmail.com wrote: I've got this message when starting a tomcat server : org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib It's exactly what the message says - the APR shared libraries are not found on the java.library.path. Even though I've installed the apr along with some other stuff like this : sudo apt-get install zlib1g-dev build-essential libapr1 libapr1-dev libssl-dev libreadline-dev -y The message is about Tomcat Native library. Tomcat Native library uses APR to perform the work. It *is not* APR. Also, http://tomcat.apache.org/tomcat-8.0-doc/apr.html - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcats warning message about APR library
Thanks Konstantin for the clarification! On Fri, Mar 6, 2015 at 5:41 AM, Neven Cvetkovic neven.cvetko...@gmail.com wrote: It's exactly what the message says - the APR shared libraries are not found on the java.library.path. I stand corrected: the message notifies that (APR-based) Tomcat Native library is not available on the java.library.path. 2) Compile your own native APR library, as the page suggested: http://tomcat.apache.org/native-doc/ I stand corrected: You can compile your own (APR-based) Tomcat Native library, and for that you need APR libraries installed. Cheers!
Re: Tomcats warning message about APR library
Emir, The actual list of steps is at the link you mentioned earlier: http://tomcat.apache.org/native-doc/ On Fri, Mar 6, 2015 at 7:30 AM, Neven Cvetkovic neven.cvetko...@gmail.com wrote: Let us know if you need help compiling the native Tomcat connectors (APR-based). There might be others that want to compile their TCNATIVE (apr-based) connectors, so here's the digested list below (for Ubuntu/Debian based systems): 1) Install required libraries for building TCNATIVE (APR dev, APR, and SSL tools) sudo apt-get zlib1g-dev build-essential libapr1 libapr1-dev libssl-dev 2) Unpack TC-native source, e.g. cd /opt/apache-tomcat-8.0.20 cd bin tar zxvf tomcat-native.tar.gz 3) Change directory to TC-native source code, e.g. cd /opt/tomcat/bin/tomcat-native-1.1.32-src/jni/native/ 4) Prepare makefile for compiling source, e.g. ./configure --with-apr=/usr/bin/apr-config --with-prefix=/opt/tomcat 5) Compile code, e.g. make 6) Install libraries, e.g. make install 7) This will add libraries to: /opt/tomcat/lib You can see the actual things installed: /opt/tomcat/lib/pkgconfig /opt/tomcat/lib/pkgconfig/tcnative-1.pc /opt/tomcat/lib/catalina-storeconfig.jar /opt/tomcat/lib/libtcnative-1.a /opt/tomcat/lib/libtcnative-1.so.0.1.32 /opt/tomcat/lib/libtcnative-1.so.0 /opt/tomcat/lib/libtcnative-1.la /opt/tomcat/lib/libtcnative-1.so 8) Now we need to let Tomcat know about these libraries and add them to the library path. Add a new file, e.g. /opt/tomcat/bin/setenv.sh file: export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CATALINA_HOME}/lib 9) Restart Tomcat,e.g. /opt/tomcat/bin/catalina.sh run 10) Observe the output, you should see something like this in the console log: INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1. INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. NFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1f 6 Jan 2014) INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [http-apr-8080] INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler [ajp-apr-8009] Good luck!
Re: Tomcats warning message about APR library
Hey Emir, I've done a little test on my Ubuntu VM. Read below my additional comments: On Fri, Mar 6, 2015 at 5:41 AM, Neven Cvetkovic neven.cvetko...@gmail.com wrote: You have two choices: 1) Find a specific package that includes the required packages, e.g. apt-get install libapr1 libapr1-dev apt-get install libtcnative-1 (I have not tested these, you need to look through the packages and find out exactly which one you need) If you decide with option (1), you could install libtcnative-1, and that will install the following files for you: $ dpkg --listfiles libtcnative-1 /. /usr /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/libtcnative-1 /usr/share/doc /usr/share/doc/libtcnative-1 /usr/share/doc/libtcnative-1/copyright /usr/share/doc/libtcnative-1/README.Debian /usr/share/doc/libtcnative-1/changelog.Debian.gz /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/pkgconfig /usr/lib/x86_64-linux-gnu/pkgconfig/tcnative-1.pc /usr/lib/x86_64-linux-gnu/libtcnative-1.a /usr/lib/x86_64-linux-gnu/libtcnative-1.so.0.1.29 /usr/lib/x86_64-linux-gnu/libtcnative-1.so.0 /usr/lib/x86_64-linux-gnu/libtcnative-1.so Notice the version number is x.1.29 After adding /usr/lib/x86_64-linux-gnu to your LD_LIBRARY_PATH, your Tomcat will be able to find the libtcnative-1 libraries on the the library path (java.library.path). If you try using this package with the latest Tomcat 8.0.20 - you will run into a problem of incompatible libraries, e.g. SEVERE [main] org.apache.catalina.core.AprLifecycleListener.init An incompatible version 1.1.29 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.32 Notice the latest Tomcat 8.0.20 requires version 1.1.32. So, the (apt-get installed) TCNATIVE shared library was found on the library path, but it was incompatible version, and Tomcat would not start APR-based connectors, but rather revert to default (NIO for Tomcat8, BIO for Tomcat7). Which brings my original point - I prefer to compile my own TCNATIVE (APR-based) libraries to using the vendor packaged libraries (CentOS yum or Ubuntu apt-get). It takes time for vendor to package and distribute a new release of packaged software, so you might be better of recompiling these pieces yourself. How did you install tomcat8? Did you use apt-get package or did you download the standard ZIP/TAR package from Tomcat's page? Good luck! Let us know if you need help compiling the native Tomcat connectors (APR-based). Cheers! Neven
Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?
On 06/03/2015 10:53, Thusitha Thilina Dayaratne wrote: Hi, Is there an alternative method from some other class that I can use instead of removed *protected URLConnection openConnection(URL u) *in Tomcat 8? I'll ask again. What are you trying to do? Read this: http://xyproblem.info/ before you answer. Mark Thanks Regards /Thusitha On Fri, Mar 6, 2015 at 2:57 PM, Thusitha Thilina Dayaratne thusit...@wso2.com wrote: Hi Mark, Thanks for your quick response. I'm extending that class and overriding the method openConnection(URL u)as a public method. So I can use it from somewhere else. Thanks Best Regards /Thusitha On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote: On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote: Hi All, I'm working on migrating embedded tomcat 7 project to latest release of *tomcat 8.0.20* When compiling the project, I'm getting compilation errors saying that *org.apache.naming.resources* package can't be found. (I'm using *DirContextURLStreamHandler* which was resided in above package in tomcat 7) I've checked the Tomcat API doc too. It seems that the package doesn't exists there. Is that package removed from tomcat 8? Yes. If so what is/are the alternative(s)? That depends what you are trying to do. I couldn't found any source saying that it is been removed or deprecated. http://tomcat.apache.org/migration-8.html Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcats warning message about APR library
Hey Emir, On Thu, Mar 5, 2015 at 2:18 PM, Emir Ibrahimbegovic eibrahim@gmail.com wrote: I've got this message when starting a tomcat server : org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib It's exactly what the message says - the APR shared libraries are not found on the java.library.path. Even though I've installed the apr along with some other stuff like this : sudo apt-get install zlib1g-dev build-essential libapr1 libapr1-dev libssl-dev libreadline-dev -y You have two choices: 1) Find a specific package that includes the required packages, e.g. apt-get install libapr1 libapr1-dev apt-get install libtcnative-1 (I have not tested these, you need to look through the packages and find out exactly which one you need) 2) Compile your own native APR library, as the page suggested: http://tomcat.apache.org/native-doc/ Usually, I just compile my own on Linux (*nix, OSX), and for Windows customers - I just use the distribution with the shared DLLs. I prefer this way, as I deal with various Linux flavours (RHEL, CentOS, Ubuntu) and they all have their own packages. It takes time (longer than I want to wait) for the vendor to make these Tomcat packages. You can get your own Tomcat installed and upgraded the very same day a new Tomcat release is out. Also, Tomcat team makes it very convenient for Windows users with the Windows binaries included, and recompiling on Windows requires extra effort setting up the tools. This is where I found the info that I need to install it: http://tomcat.apache.org/native-doc/ What am I missing here? I'm using tomcat 8 btw. How did you install tomcat8? Did you use apt-get package or did you download the standard ZIP/TAR package from Tomcat's page? Good luck! PS. I will try locating the actual package and test it on my Ubuntu VM.
Is org.apache.naming.resources package have been removed in tomcat 8.0.20?
Hi All, I'm working on migrating embedded tomcat 7 project to latest release of *tomcat 8.0.20* When compiling the project, I'm getting compilation errors saying that *org.apache.naming.resources* package can't be found. (I'm using *DirContextURLStreamHandler* which was resided in above package in tomcat 7) I've checked the Tomcat API doc too. It seems that the package doesn't exists there. Is that package removed from tomcat 8? If so what is/are the alternative(s) ? I couldn't found any source saying that it is been removed or deprecated. Thanks Best Regards /Thusitha -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina
Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?
Hi, Is there an alternative method from some other class that I can use instead of removed *protected URLConnection openConnection(URL u) *in Tomcat 8? Thanks Regards /Thusitha On Fri, Mar 6, 2015 at 2:57 PM, Thusitha Thilina Dayaratne thusit...@wso2.com wrote: Hi Mark, Thanks for your quick response. I'm extending that class and overriding the method openConnection(URL u)as a public method. So I can use it from somewhere else. Thanks Best Regards /Thusitha On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote: On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote: Hi All, I'm working on migrating embedded tomcat 7 project to latest release of *tomcat 8.0.20* When compiling the project, I'm getting compilation errors saying that *org.apache.naming.resources* package can't be found. (I'm using *DirContextURLStreamHandler* which was resided in above package in tomcat 7) I've checked the Tomcat API doc too. It seems that the package doesn't exists there. Is that package removed from tomcat 8? Yes. If so what is/are the alternative(s)? That depends what you are trying to do. I couldn't found any source saying that it is been removed or deprecated. http://tomcat.apache.org/migration-8.html Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina
Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?
On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote: Hi All, I'm working on migrating embedded tomcat 7 project to latest release of *tomcat 8.0.20* When compiling the project, I'm getting compilation errors saying that *org.apache.naming.resources* package can't be found. (I'm using *DirContextURLStreamHandler* which was resided in above package in tomcat 7) I've checked the Tomcat API doc too. It seems that the package doesn't exists there. Is that package removed from tomcat 8? Yes. If so what is/are the alternative(s)? That depends what you are trying to do. I couldn't found any source saying that it is been removed or deprecated. http://tomcat.apache.org/migration-8.html Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcats warning message about APR library
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Neven, On 3/6/15 8:13 AM, Neven Cvetkovic wrote: Emir, The actual list of steps is at the link you mentioned earlier: http://tomcat.apache.org/native-doc/ On Fri, Mar 6, 2015 at 7:30 AM, Neven Cvetkovic neven.cvetko...@gmail.com wrote: Let us know if you need help compiling the native Tomcat connectors (APR-based). There might be others that want to compile their TCNATIVE (apr-based) connectors, so here's the digested list below (for Ubuntu/Debian based systems): Your instructions here are entirely unnecessary: the Tomcat Native source package includes a BUILDING.txt file that describes how to compile and link the library. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJU+fFdAAoJEBzwKT+lPKRYNJAP/RNCLRBC/IcImFu8dyY8tmny OXMqkIY/KtgEo5xMUJ1kq9d687L25jGFt3t+bIAis42Bbi1ooTE3jK3U5li8W5SP UeFrBXCZ5HDjo4wQ0yZNebLUvWF2cBc8d/OYzCXn5kD5pu8OaNB2LcWS4XrLldvM yi1Qy7qjs7Skb+1uRpwBZZoBUmSJjnScer9XOWdUktt98Dtj7gzWt1AZwWsNPbeN ZyD0EmD+RMPHHFEgnT+lh1W/AXFbRIQrK5w36Wj1m6gGOSdS6ilmhVwQPH5G0ySM Gmw3pL0BWRGnCCvNxGPCsTeWG6z7FPo+u+ZqoSPQJF306n0KH8bEo/R5WUQRUAV0 KHODvma9btr+my9hGHerhm1ZOR/oSO0dX87DBKbPSUEYPKzvREfna2tqvu45v2ZB SGnEvEehPDNKdPAS+zc6oGYTDN2dMS/eGj9KrmIknaogulWDRXxcDrLzCMu3w7bH ebAfe4REpvcqXKr5GNjacgcicxZwaQHW4J/OjVZ3BVz4rbLbp+ugPbxjHn3pOeag PqLnSZQaz/IX03Phvsh8XXU0oGdCcOiQlTxVGUncFYdzn3L3+Ag4Y273/B8z35hA A+rYxqgAnQBJDJMFgBeCR7g6mJ2tuO7Ls5NLB8j06A21v7SDEqEsgCCMvzfRCRIy Mn2NOA0wZAmCJMJ9/yd8 =KuaZ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcats warning message about APR library
Thanks Neven for your answer and the steps (Hvala puno!). Thanks everyone for your answers. @Christopher Schultz Both their answers were more than helpful, and I learned something new. No offense but your reply was kind of unnecessary, just because I learned nothing new. Thanks again guys! On Fri, Mar 6, 2015 at 1:26 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Neven, On 3/6/15 8:13 AM, Neven Cvetkovic wrote: Emir, The actual list of steps is at the link you mentioned earlier: http://tomcat.apache.org/native-doc/ On Fri, Mar 6, 2015 at 7:30 AM, Neven Cvetkovic neven.cvetko...@gmail.com wrote: Let us know if you need help compiling the native Tomcat connectors (APR-based). There might be others that want to compile their TCNATIVE (apr-based) connectors, so here's the digested list below (for Ubuntu/Debian based systems): Your instructions here are entirely unnecessary: the Tomcat Native source package includes a BUILDING.txt file that describes how to compile and link the library. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJU+fFdAAoJEBzwKT+lPKRYNJAP/RNCLRBC/IcImFu8dyY8tmny OXMqkIY/KtgEo5xMUJ1kq9d687L25jGFt3t+bIAis42Bbi1ooTE3jK3U5li8W5SP UeFrBXCZ5HDjo4wQ0yZNebLUvWF2cBc8d/OYzCXn5kD5pu8OaNB2LcWS4XrLldvM yi1Qy7qjs7Skb+1uRpwBZZoBUmSJjnScer9XOWdUktt98Dtj7gzWt1AZwWsNPbeN ZyD0EmD+RMPHHFEgnT+lh1W/AXFbRIQrK5w36Wj1m6gGOSdS6ilmhVwQPH5G0ySM Gmw3pL0BWRGnCCvNxGPCsTeWG6z7FPo+u+ZqoSPQJF306n0KH8bEo/R5WUQRUAV0 KHODvma9btr+my9hGHerhm1ZOR/oSO0dX87DBKbPSUEYPKzvREfna2tqvu45v2ZB SGnEvEehPDNKdPAS+zc6oGYTDN2dMS/eGj9KrmIknaogulWDRXxcDrLzCMu3w7bH ebAfe4REpvcqXKr5GNjacgcicxZwaQHW4J/OjVZ3BVz4rbLbp+ugPbxjHn3pOeag PqLnSZQaz/IX03Phvsh8XXU0oGdCcOiQlTxVGUncFYdzn3L3+Ag4Y273/B8z35hA A+rYxqgAnQBJDJMFgBeCR7g6mJ2tuO7Ls5NLB8j06A21v7SDEqEsgCCMvzfRCRIy Mn2NOA0wZAmCJMJ9/yd8 =KuaZ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Connection leak Tomcat7 and Oracle
On 02/27/2015 11:59 AM, Christopher Schultz wrote: Red, On 2/27/15 11:04 AM, Red wrote: On 02/27/2015 06:58 AM, Антон Мацюк wrote: 2015-02-27 1:36 GMT+02:00 Mark Thomas ma...@apache.org: On 26/02/2015 22:56, Christopher Schultz wrote: The solution is to put your Resource into your application's s/The solution/The best solution/ context.xml and not into the site-wide defaults. Konstantin may not have spelled-out the solution, but he did give you all the information you needed to come to that conclusion on your own. Another (not so good because your application is no longer self-contained) option is to define a global resource and put a ResourceLink into the global context.xml or the application's context.xml. About not so good because your application is no longer self-contained - this is normal in case when tomcat is an sysadmin headache, and admin is bearing responsibility for both tomcat and pool in it works well. As a programmer - my job is to connect to provided datasource, and use it normally. So best approach in this situation will be use of GlobalNamingResources http://tomcat.apache.org/tomcat-7.0-doc/config/globalresources.html#Environment_Entries to store there my jdbc-pools and just make ResourceLink http://tomcat.apache.org/tomcat-7.0-doc/config/globalresources.html#Resource_Links in application's META_INF/context.xml to get this datasource from global context. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Thank You all; I have come to same conclusions, though they vastly differ from what I have expected. I have found spare Oracle Linux 6.5 machine , downloaded latest tomcat 8.0.20, java is 1.7.0_65. Behaviour is the same, tomcat opens 50 conenctions to database. After moving pool definition from conf/context.xml to webapps/manager/META-INF/context.xml, tomcat opens 10 connections. Reading, then, this is default value of pool initial size (tenth of maxActive, default 100). You have maxActive=10. The default value of initialSize is supposed to be 0. I'm surprised it's opening 10 connections immediately. After explicitly defining initialSize=1, only single connection is opened. Good. Now moving that pool definition back to conf/context.xml, I get five connections to db. There is total 5 apps deployed by default (ROOT. manager, hostmanager, docs and examples). Basically, each app opens every connection pool defined in conf/context.xml to the tune of initialSize. Correct. This is exactly what you have asked Tomcat to do: define a default DataSource for all web applications. Note that it's *not a shared data source between all the web applications*. Instead, it's a DataSource that will be created for *each web application you deploy*. So, if the DataSource opens up 10 connections and you have 10 web applications, you'll get 100 connections to the database. (I'm not exactly sure why they are being opened immediately, but you are in fact getting 10 DataSources.) At my place we have about 25 applications in each dev and prod, with about 10-15 database pools defined. Even with initialSize set to 1, that comes to total over 300 connections, which makes conf/context.xml useless for me. If so, connections pools must be moved to application context.xml. You should be doing this anyway. It's very rare for a whole server full of applications to need the same DataSource configuration(s). Well, this is maintenance nightmare for me, as passwords are changed regularly, and I have to edit every single app context.xml file. Learn to script things. On top of it, we deploy .war files, and context.xml are part of it. If you use a separate deployment descriptor in conf/[engine]/[hostname]/[appname].xml, then the deployment descriptor in the WAR file will be ignored. In dev, I do not care, but for production, .war has to be packed with context.xml in it (with conn info). Does it? As a dba, I refuse to give prod passwords to developers Then don't. So I will have to package/repackage not only on initial deployment, but on every app update. Untrue. See above. Please tell me that I am wrong You are wrong. because as it look now whole purpose of connection pooling is defeated, and that can not be. Hostmanager (for example) does not have any oracle connection defined within itself, so why it should even know those exist, not to mention to actually open them. Agreed. Stop defining DataSources in conf/context.xml. When you deploy an application, your application's META-INF/context.xml and conf/context.xml are merged and treated as /the/ configuration for the application. So stop defining default application configuration if you don't want it to be the default application configuration.
How to force Tomcat to use the system clock?
Greetings, We have found a need to stop and start Tomcat once in a while to allow Tomcat to connect via HTTPS with some other servers. We think the restart may be synchronizing the time Tomcat uses with the server OS system time, and we are looking for ways to prevent having to stop/start Tomcat. Details: Our instance of Tomcat 6.0.36 runs on HP-UX B11.31 ia64 with JVM Version 1.7.0.08. It hosts a custom servlet which, when invoked, connects with a remote server via HTTPS to retrieve some data. However, after about a month the timestamp Tomcat sends in the SSL handshake appears to drift enough for the remote server's time to start rejecting requests because the timestamp is too far off (according to our partner's remote application logs). We have confirmed that our server clock is set correctly and synced with NTP, and matches the system clock on the remote server, which also uses NTP. So one thing we thought might be happening is that Tomcat (or the Java that Tomcat runs on) may be keeping an internal clock, perhaps using a separate thread as a way to speed up the retrieval of time so that it does not have to go to the OS system clock every time it needs the current time. And maybe this internal clock is not synced with the server time until Tomcat (or the JVM) is restarted. If this is the case, would anyone have an idea of how to force Tomcat (or Java) to use the server's system clock every time instead of using its own internal clock? We do not care about the performance hit on this because this is a low-volume application. Or, if we are misunderstanding Tomcat and it actually uses the system clock every time it needs to get the current time, is there something else we should be looking at? We have researched on the web, checked the Apache mail archives, read the Tomcat configuration guide, looked up the Java system options, but have not studied the Tomcat source code yet. We did find that there is a Java Wrapper product out there by Tanuki Software that provides an option to use system time or a background thread, which is what caused us to wonder if Tomcat might be doing something similar. For more information on what the Tanuki wrapper does, here is an excerpt we found on their website http://wrapper.tanukisoftware.com/doc/english/prop-use-system-time.html: As of Wrapper version 3.1.0, a new timer mechanism was added to the Wrapper. This new timer was made the default in Wrapper version 3.2.0. Rather than keeping time by querying the system clock, the Wrapper creates a background thread which enters a light weight loop and increments an internal tick counter. Internally all timekeeping has been modified to be based on these ticks. (If the system time is being used, then the tick count at any particular moment is calculated from the system time rather than from the counter.) Thanks in advance for any ideas that are shared. Richard - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Is org.apache.naming.resources package have been removed in tomcat 8.0.20?
Hi Mark, I'm trying to bundle the tomcat as a OSGI bundle. While doing so, I've extended the DirContextURLStreamHandler class and overriding the method openConnection(URL u)as a public method. Then I'm registering my extended class as a service in the bundle context. Since *org.apache.naming.resource* package have been removed I'm trying to use the *WarStreamURLHandler *class in the *org.apache.catalina.webresource* package and get my work done. Could someone tell me is that a good approach? If not what is the best alternative? Thanks Best Regards /Thusitha On Fri, Mar 6, 2015 at 6:50 PM, Mark Thomas ma...@apache.org wrote: On 06/03/2015 10:53, Thusitha Thilina Dayaratne wrote: Hi, Is there an alternative method from some other class that I can use instead of removed *protected URLConnection openConnection(URL u) *in Tomcat 8? I'll ask again. What are you trying to do? Read this: http://xyproblem.info/ before you answer. Mark Thanks Regards /Thusitha On Fri, Mar 6, 2015 at 2:57 PM, Thusitha Thilina Dayaratne thusit...@wso2.com wrote: Hi Mark, Thanks for your quick response. I'm extending that class and overriding the method openConnection(URL u)as a public method. So I can use it from somewhere else. Thanks Best Regards /Thusitha On Fri, Mar 6, 2015 at 2:53 PM, Mark Thomas ma...@apache.org wrote: On 06/03/2015 09:15, Thusitha Thilina Dayaratne wrote: Hi All, I'm working on migrating embedded tomcat 7 project to latest release of *tomcat 8.0.20* When compiling the project, I'm getting compilation errors saying that *org.apache.naming.resources* package can't be found. (I'm using *DirContextURLStreamHandler* which was resided in above package in tomcat 7) I've checked the Tomcat API doc too. It seems that the package doesn't exists there. Is that package removed from tomcat 8? Yes. If so what is/are the alternative(s)? That depends what you are trying to do. I couldn't found any source saying that it is been removed or deprecated. http://tomcat.apache.org/migration-8.html Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- Thusitha Dayaratne Software Engineer WSO2 Inc. - lean . enterprise . middleware | wso2.com Mobile +94712756809 Blog alokayasoya.blogspot.com Abouthttp://about.me/thusithathilina
Tomcat 8 embedded - ERROR {org.apache.catalina.core.ContainerBase} - A child container failed during start
Hi All, I'm using tomcat embedded and when I try to star the server following error get occurred. I'm using tomcat 8.0.20 and jdk8 ERROR {org.apache.catalina.core.ContainerBase} - A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@178ad6ef] at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4840) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4970) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more Caused by: java.lang.Error: factory already defined at java.net.URL.setURLStreamHandlerFactory(URL.java:1105) at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.init(TomcatURLStreamHandlerFactory.java:122) at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:51) at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:75) at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:677) at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:660) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ... 10 more [2015-03-07 10:24:08,114] ERROR {org.apache.catalina.core.ContainerBase} - A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.wso2.carbon.tomcat.ext.service.ExtendedStandardService.startInternal(ExtendedStandardService.java:49) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:769) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.wso2.carbon.tomcat.internal.CarbonTomcat.start(CarbonTomcat.java:103) at org.wso2.carbon.tomcat.internal.ServerManager$1.run(ServerManager.java:99) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:925) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
RE: [tomcat-users] How to force Tomcat to use the system clock?
-Original Message- From: Salisbury, Richard W DLA CTR INFORMATION OPERATIONS Sent: Friday, March 06, 2015 16:29 Greetings, We have found a need to stop and start Tomcat once in a while to allow How long is a while? Tomcat to connect via HTTPS with some other servers. We think the restart may be synchronizing the time Tomcat uses with the server OS system time, and we are looking for ways to prevent having to stop/start Tomcat. I want to start with, I am very skeptical to your observations. Details: Our instance of Tomcat 6.0.36 runs on HP-UX B11.31 ia64 with JVM Version JVM vendor? 1.7.0.08. It hosts a custom servlet which, when invoked, connects with a remote server via HTTPS to retrieve some data. However, The webapp make an outbound HTTPS connection or a client makes a HTTPS connection to the webapp? after about a month the timestamp Tomcat sends in the SSL handshake appears to drift enough for the remote server's time to start rejecting requests because the timestamp is too far off (according to our partner's remote application logs). How far off? We have confirmed that our server clock is set correctly and synced with NTP, and matches the system clock on the remote server, which also uses NTP. So one thing we thought might be happening is that What are the NTP stats? In otherwords, how stable is the system clock. Tomcat (or the Java that Tomcat runs on) may be keeping an internal clock, perhaps It all boils down to: public static native long currentTimeMillis(); Even new java.util.Date() - public Date() { this(System.currentTimeMillis()); } That means all the time source in Java, and Tomcat come from the OS. using a separate thread as a way to speed up the retrieval of time so that it does not have to go to the OS system clock every time it needs the current time. And maybe this internal clock is not synced with the server time until Tomcat (or the JVM) is restarted. If this is the case, would anyone have an idea of how to force Tomcat (or Java) to use the server's system clock every time instead of using its own internal clock? We do not care about the performance hit on this because this is a low-volume application. Or, if we are misunderstanding Tomcat and it actually uses the system clock every time it needs to get the current time, is there something else we should be looking at? Lets start withm can you add a simple JSP to your web app? %=System.currentTimeMillis()% Then periodically: date date -d @$(curl -s http://127.0.0.1:8080/date.jsp) date We have researched on the web, checked the Apache mail archives, read the Tomcat configuration guide, looked up the Java system options, but have not studied the Tomcat source code yet. We did find that there is a Java Wrapper product out there by Tanuki Software that provides an option to use system time or a background thread, which is what caused us to wonder if Tomcat might be doing something similar. For more information on what the Tanuki wrapper does, here is an excerpt we found on their website http://wrapper.tanukisoftware.com/doc/english/prop-use-system- time.html: As of Wrapper version 3.1.0, a new timer mechanism was added to the Wrapper. This new timer was made the default in Wrapper version 3.2.0. Rather than keeping time by querying the system clock, the Wrapper creates a background thread which enters a light weight loop and increments an internal tick counter. Internally all timekeeping has been modified to be based on these ticks. (If the system time is being used, then the tick count at any particular moment is calculated from the system time rather than from the counter.) Thanks in advance for any ideas that are shared. Richard -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. smime.p7s Description: S/MIME cryptographic signature