Re: tomcat 5 and the JVM
thanks - removed On Mon, 2009-02-02 at 14:46 +0100, Felix Schumacher wrote: Hi Ray, On Mon, February 2, 2009 1:59 pm, Ray Holme wrote: I run tomcat 6 on Linux and have multiple applications in development mode. From my testing I have discovered that a Java bean shared by all applications and with ALL methods as static SEEMS to have a separate instance for each appliction - i.e. look at http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html cool, but it means that each application must do a System.gc() If you have to do a System.gc() by yourself, you (most) probably did something wrong with your Bean. And be careful with that call. First the jvm is free to ignore it. Second it can be a major performance hit. We once found an application to call System.gc() with every get|post call. We disabled the System.gc() functionality by starting the jvm with -XX:+DisableExplicitGC. Bye Felix - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat 5 and the JVM
thanks - makes sense. removed the GC call as someone else put it there a long time ago also removed System.runFinalization() - assume this is not something to do in my garbage sweep where I check for other things. :=] On Mon, 2009-02-02 at 14:45 +0100, Kees de Kooter wrote: Hi Ray, It is one JVM, but separate classloaders so applications do not see classes of other apps. Oh and please be extremely careful with using System.gc(). Using it can lead to severe and unexpected performance issues. If you need gc() you almost always have a flaw in your code. Cheers, Kees de Kooter http://www.boplicity.net On Mon, Feb 2, 2009 at 13:59, Ray Holme rho...@roadrunner.com wrote: I run tomcat 6 on Linux and have multiple applications in development mode. From my testing I have discovered that a Java bean shared by all applications and with ALL methods as static SEEMS to have a separate instance for each appliction - i.e. getDebugLevel() returns 0 from the 2nd application even if the first has set it to 100 This is useful but contrary to what I would expect. I would expect one JVM for all applications. If there is one per application, that too is cool, but it means that each application must do a System.gc() occasionally and that this routine cannot be done once for all. So, does someone know for sure - one JVM per Tomcat OR one JVM per app?? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat 5 and the JVM
Hi Ray, On Mon, February 2, 2009 1:59 pm, Ray Holme wrote: I run tomcat 6 on Linux and have multiple applications in development mode. From my testing I have discovered that a Java bean shared by all applications and with ALL methods as static SEEMS to have a separate instance for each appliction - i.e. look at http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html cool, but it means that each application must do a System.gc() If you have to do a System.gc() by yourself, you (most) probably did something wrong with your Bean. And be careful with that call. First the jvm is free to ignore it. Second it can be a major performance hit. We once found an application to call System.gc() with every get|post call. We disabled the System.gc() functionality by starting the jvm with -XX:+DisableExplicitGC. Bye Felix - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
tomcat 5 and the JVM
I run tomcat 6 on Linux and have multiple applications in development mode. From my testing I have discovered that a Java bean shared by all applications and with ALL methods as static SEEMS to have a separate instance for each appliction - i.e. getDebugLevel() returns 0 from the 2nd application even if the first has set it to 100 This is useful but contrary to what I would expect. I would expect one JVM for all applications. If there is one per application, that too is cool, but it means that each application must do a System.gc() occasionally and that this routine cannot be done once for all. So, does someone know for sure - one JVM per Tomcat OR one JVM per app?? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat 5 and the JVM
Hi Ray, It is one JVM, but separate classloaders so applications do not see classes of other apps. Oh and please be extremely careful with using System.gc(). Using it can lead to severe and unexpected performance issues. If you need gc() you almost always have a flaw in your code. Cheers, Kees de Kooter http://www.boplicity.net On Mon, Feb 2, 2009 at 13:59, Ray Holme rho...@roadrunner.com wrote: I run tomcat 6 on Linux and have multiple applications in development mode. From my testing I have discovered that a Java bean shared by all applications and with ALL methods as static SEEMS to have a separate instance for each appliction - i.e. getDebugLevel() returns 0 from the 2nd application even if the first has set it to 100 This is useful but contrary to what I would expect. I would expect one JVM for all applications. If there is one per application, that too is cool, but it means that each application must do a System.gc() occasionally and that this routine cannot be done once for all. So, does someone know for sure - one JVM per Tomcat OR one JVM per app?? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, Dr. Warnier: How I learned to stop worrying and love VMWare
Michael Ludwig wrote: [...] But maybe your case is a different one. Yes indeed, several different ones (almost one per customer). In this particular case (Cisco VPN Client), the settings you describe are not accessible (or not modifiable). I believe it is a protection for the VPN you are connecting to. After all, I guess you do not want someone connecting through VPN to your internal network, and this way opening the network to all kinds of external nasties to which the client itself is open. The main issue is that each of these VPN systems installs its own modules client-side, which all one way or another install themselves either as services or as intermediate modules or drivers somewhere in the TCP/IP protocol stack. And these modules, from different sources, are rarely made so that they cooperate nicely with one another. Each one tends to believe it is the only one on the machine, to install itself as automatic start at boot etc... Add to this the general obscurity of how Windows manages these network connections and you're in for a mystical experience. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, Dr. Warnier: How I learned to stop worrying and love VMWare
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, André Warnier wrote: It's a whole process to connect to that server, and when I am connected I lose my other connections (email e.g.). Aah, you use a VPN that fubar's your other connections? That's too bad. If you often connect to this machine, you might want to consider running a host-guest VM like VMWare Player. You can go to many sites that will pre-package blank VMs for you (like gimmie a 10GB MS Windows XP VM and it will give you a config file and a blank VM). Fire it up in VMWare Player with your XP install CD in your drive and then install XP onto the VM. Or, just download one of the very fine pre-packaged Linux VMs right from VMWare's site. Run your VPN from within the VM and your real machine's connections should stay right as rain. It may be a bit of a production just to open up an SSH connection, but at least you will be able to connect to your production box AND do other work at the same time. Just a thought. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklZOREACgkQ9CaO5/Lv0PAFrgCgsMYEJJbXGNodDCnO5KokB9VN t+UAoINUYKFhoZ+Ymc+zcXXOCoCVymSu =6Oyv -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, Dr. Warnier: How I learned to stop worrying and love VMWare
Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, André Warnier wrote: It's a whole process to connect to that server, and when I am connected I lose my other connections (email e.g.). Aah, you use a VPN that fubar's your other connections? That's too bad. Not me, them customers of ours. If you often connect to this machine, you might want to consider running a host-guest VM like VMWare Player. You can go to many sites that will pre-package blank VMs for you (like gimmie a 10GB MS Windows XP VM and it will give you a config file and a blank VM). Fire it up in VMWare Player with your XP install CD in your drive and then install XP onto the VM. Or, just download one of the very fine pre-packaged Linux VMs right from VMWare's site. Run your VPN from within the VM and your real machine's connections should stay right as rain. It may be a bit of a production just to open up an SSH connection, but at least you will be able to connect to your production box AND do other work at the same time. Just a thought. That's more than a thought, it's plenty of thoughts. Why didn't we think of that ourselves before ? That stuff with different customers, each of them having different VPN setups often incompatible between them (in terms of clients on our workstations) has been bothering us for ages. And as it happens, we are just in the process of setting up a VMWare server locally as a test machine. Me thinks we're gonna do something based on that above stuff. Great idea ! Thanks. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, Dr. Warnier: How I learned to stop worrying and love VMWare
Christopher Schultz schrieb am 29.12.2008 um 15:54:41 (-0500): André Warnier wrote: It's a whole process to connect to that server, and when I am connected I lose my other connections (email e.g.). Aah, you use a VPN that fubar's your other connections? That's too bad. Maybe you just haven't told your Windows OS to *not* use your VPN connection as the default gateway for non-local connections? Open the VPN connection properties. Dort auf Netzwerk Internetprotokoll Eigenschaften Erweitert. Das Häkchen bei Standardgateway für das Remotenetzwerk verwenden entfernen. Or the equivalent steps in English. But maybe your case is a different one. Michael Ludwig - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to compile a servlet for Tomcat 5 on IBM JVM
Hi. I just knew it wouldn't be that simple... Kind of as a follow-up to earliers posts on Hello World servlets and IBM JDK 1.5, here is the issue : I have created (ok, copied from Chuck would be more exact) a tiny weeny little servlet. It's about 15 lines including comments. On my Windows PC, where I have a Sun JDK 1.6 and Tomcat 5.5 installed, the servlet compiles fine, with the following command : javac -classpath %CLASSPATH%;C:\java6jdk\lib\tools.jar;C:\java6jdk\jre\lib\jsse.jar;C:\Tomcat5.5\common\lib\servlet-api.jar;C:\Tomcat5.5\common\lib\commons-el.jar %1 Then I move the resulting servlet class to the server where it is supposed to run, which has a Tomcat 5.0.x running under an IDM JDK 1.5. When I call this servlet, I get an error in the tomcat logfile, saying essentially that it cannot load this servlet, because the major version doesn't match (I guess it means Java's). No problema ! Piece o'cake ! I'll just move the source of my servlet to the target machine and compile it there with the IBM javac and the Tomcat5 libraries, says me. Well, that gives these errors when compiling : DumpUser.java:6: package javax.servlet does not exist import javax.servlet.ServletException; ^ DumpUser.java:7: package javax.servlet.http does not exist import javax.servlet.http.HttpServlet; ^ DumpUser.java:8: package javax.servlet.http does not exist import javax.servlet.http.HttpServletRequest; etc... (about 8 of them above-like messages). I am not familiar with this kind of exercise, and I have no idea if and where IBM or Suse hide the packages and classes needed. And anyone who has seen the link soup on a SEL 10 system with Tomcat 5 and IBM Java, throw me the first stone. And in my naiveté, I thought Java apps were portable ! I looked on the IBM website, to see if I could download an IBM JDK 1.5 and compile the servlet with it on my PC. Well, it seems that for that one needs to register and whatnot beforehand, and then you get something for Eclipse (which I don't need nor have). So now, what's the recommendation, apart from in that order - nuking the Tomcat 5.0 - nuking the IBM Java 1.5 - nuking the server (*) - throwing my laptop out the window (**) and re-installing everything from scratch, using a nice clean Sun Java 1.6 JDK, and a true and official Tomcat 5.5 (at least) from the official and approved Tomcat site ? Or just forget about Tomcat and Java altogether, and rewrite this application in Pure Perl ? The re-install-clean-versions above option is at the moment not my preferred one, because I have to do it on 4 servers then, and afterward take responsibility for maintaining these Tomcats. While right now the quadruplets are in someone else's care. So, for instance, if I were to re-install a Sun Java 1.5 JDK on my laptop, and re-compile with it, would that solve the above issue(z) ? (*) it's ok, its in another country and the wind blows the other way (**) it's ok too, it's a very low window and my laptop is supposed to be shock-proof; so that would be mainly for the show effect on my co-workers. TIA for any helpful hints. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to compile a servlet for Tomcat 5 on IBM JVM
Hi André, On 21.12.2008 23:28, André Warnier wrote: I have created (ok, copied from Chuck would be more exact) a tiny weeny little servlet. It's about 15 lines including comments. On my Windows PC, where I have a Sun JDK 1.6 and Tomcat 5.5 installed, the servlet compiles fine, with the following command : javac -classpath %CLASSPATH%;C:\java6jdk\lib\tools.jar;C:\java6jdk\jre\lib\jsse.jar;C:\Tomcat5.5\common\lib\servlet-api.jar;C:\Tomcat5.5\common\lib\commons-el.jar %1 Side remark: You shouldn't need tools.jar. Then I move the resulting servlet class to the server where it is supposed to run, which has a Tomcat 5.0.x running under an IDM JDK 1.5. When I call this servlet, I get an error in the tomcat logfile, saying essentially that it cannot load this servlet, because the major version doesn't match (I guess it means Java's). You compiled with Java 6 and try to run under Java 5. That won't work, unless you add -target 1.5 to your javac arguments. No problema ! Piece o'cake ! I'll just move the source of my servlet to the target machine and compile it there with the IBM javac and the Tomcat5 libraries, says me. Well, that gives these errors when compiling : Unfortunately you didn't tell us, how you called javac on the IBM system. I think it is recommendation number 6. ;) DumpUser.java:6: package javax.servlet does not exist import javax.servlet.ServletException; ^ DumpUser.java:7: package javax.servlet.http does not exist import javax.servlet.http.HttpServlet; ^ DumpUser.java:8: package javax.servlet.http does not exist import javax.servlet.http.HttpServletRequest; etc... (about 8 of them above-like messages). Looks like servlet-api.jar is not on your build classpath. Look inside the jar, you can find all the missing classes there. So now, what's the recommendation, apart from in that order - nuking the Tomcat 5.0 - nuking the IBM Java 1.5 - nuking the server (*) - throwing my laptop out the window (**) I would recommend a couple of those, but if you only want to solve the actual problem, then either use -target 1.5 on your PC or check your javac commandline on the system with the IBM JDK. Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: How to compile a servlet for Tomcat 5 on IBM JVM
Rainer Jung wrote: [...] Thanks Rainer. You gave me more than hope. The tip below already does it. You just saved my laptop, and Warszaw. [...] You compiled with Java 6 and try to run under Java 5. That won't work, unless you add -target 1.5 to your javac arguments. I did, and it works. The servlet compiled that way on my laptop runs fine on the server, and it even does what I wanted. It is really a ridiculous little servlet, but considering it is going to save installing and running Samba and winbind on 4 servers, it's worth its weight in diamonds. Unfortunately you didn't tell us, how you called javac on the IBM system. I think it is recommendation number 6. ;) I didn't because I know you guys love to guess, and I didn't want to spoil the fun. It's a whole process to connect to that server, and when I am connected I lose my other connections (email e.g.). Unfortunately I didn't think of copying the javac line before disconnecting to write the post, and I was too lazy to reconnect. But now I did, because even if the tip above works, I wanted to understand why the compilation didn't before. It was of course a stupid error in the script, which I copied from my laptop and modified for that Linux server, but not quite well enough. This is the shell script I originally used to try to compile the servlet on that server : JAVA_HOME=/usr/lib/jvm/java-1.5.0-ibm/ TOMCAT_HOME=/usr/share/tomcat5 $JAVA_HOME/bin/javac -classpath $JAVA_HOME/lib/tools.jar;$TOMCAT_HOME/common/lib/servlet-api.jar;$TOMCAT_HOME/common/lib/commons-el.jar $1 And the stupid error was : on Unix, contrary to Windows, one has to use : to separate classpath components, instead of ; As per your recommendation # 1 I also removed the tools.jar, so the final script which works is : JAVA_HOME=/usr/lib/jvm/java-1.5.0-ibm/ TOMCAT_HOME=/usr/share/tomcat5 $JAVA_HOME/bin/javac -classpath $TOMCAT_HOME/common/lib/servlet-api.jar:$TOMCAT_HOME/common/lib/commons-el.jar $1 (javac is one single line) Looks like servlet-api.jar is not on your build classpath. Look inside the jar, you can find all the missing classes there. That was due to the semicolons. So, you see, if I had copied the javac line in the first post, you guys would have spotted that error right away, and I would never have known about the -target 1.5 switch. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org