This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I'm running a free-form web application using the bundled Tomcat 5.5.7 with NetBeans 4.1 RC2. I manually start the server from the runtime tab. Once started, I cannot shut it down from the runtime tab - the server status window progresses to about 1/5th of the way and then just hangs. I have to kill the java.exe task from the task manager. I have been using the tomcat deploy tasks to deploy the application using the sample build.xml in the tomcat distribution. The deploy works and I can run my application, it's just shutting down tomcat that's the problem.
Can't reproduce it. It is probably a local configuration problem. Marking as WORKSFORME. Isn't there any other Tomcat instance running on your system? If there is some and if it uses the same port as the Bundled Tomcat does, NetBeans can't find out whether it's really the Bundled Tomcat what is running and therefor NetBeans may fail to shut it down. Look in the Tomcat output whether there are any error messages after starting the Tomcat. Try to clear the Tomcat output window before hitting the "Stop Server" button, then press the button and see if any messages appear in the output window. If you are using firewall, it is possible that it blocks the shutdown command to be send to Tomcat to its "admin" port - 8025 for the bundled Tomcat by default. You can also attach the <NB_USER_DIR>/var/log/message.log so that we can see if there is anything suspicious in it.
I had the same problems. I find that using jdk 1.4.2-08 it wasnt adequate to stop tomcat inside IDE, installed jdk-1.5 update 3 and now works. (besides nb is more fast)
I've tested stopping tomcat under JDK 1.4.2 (no updates), and it can't be done. I've retested on the same machine running under JDK 1.5.0_03 and the stop process does work. It seems to be related to the JDK. The IDE log doesn't show anything when I can't stop tomcat, and there is no output in the output pane. The server window just hangs. On the same machine running JDK 1.4.2 + NetBeans 3.6 (with bundled tomcat 5.0.19), it stops tomcat no problems. Can this be looked at? Is this a bug with tomcat or the IDE? I'd suggest that NB 4.1 can't be labelled as JDK 1.4.2 compatible if you can't stop the server.
We are not able reproduce your problem on Win2K with JDK 1.4.2_08, sorry. Could you please try this scenario with clean userdir: 1) Run IDE with clean userdir (backup your current userdir if you need) 2) Do not open/create any project, do not deploy 3) Start bundled Tomcat (Runtime window | Servers | Bundled Tomcat | Start) 4) Stop bundled Tomcat (Runtime window | Servers | Bundled Tomcat | Stop) 5) Does it work?
I followed all of those steps, and still no luck. Here's the tomcat log on startup: Using CATALINA_BASE: C:\DATA\Profiles\ernagaj\.netbeans\4.1rc\jakarta-tomcat-5.5.7_base Using CATALINA_HOME: C:\Program Files\netbeans-4.1rc2\enterprise1\jakarta-tomcat-5.5.7 Using CATALINA_TMPDIR: C:\DATA\Profiles\ernagaj\.netbeans\4.1rc\jakarta-tomcat-5.5.7_base\temp Using JAVA_HOME: C:\apps\j2sdk1.4.2 Created MBeanServer with ID: 1f934ad:103c5d6e8ac:-8000:pc7901:1 10/05/2005 17:02:07 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8084 10/05/2005 17:02:07 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1485 ms 10/05/2005 17:02:07 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 10/05/2005 17:02:07 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 10/05/2005 17:02:07 org.apache.catalina.core.StandardHost start INFO: XML validation disabled 10/05/2005 17:02:13 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8084 10/05/2005 17:02:14 org.apache.jk.common.ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009 10/05/2005 17:02:14 org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/78 config=null 10/05/2005 17:02:14 org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource 10/05/2005 17:02:14 org.apache.catalina.startup.Catalina start INFO: Server startup in 7328 ms Now trying to stop it and the server status window hangs, about 1/4 of the way across. If I leave it for a while, it displays the message 'stop server bundled tomcat (5.5.7) timeout or interrupted'. There's no further tomcat output in the log.
Created attachment 22062 [details] NB41RC2 Messages Log
One more question: you wrote that you use JDK 1.4.2_08, but there is "1.4.2-b28" in your message.log which is the number of 1.4.2 FCS (without minor update _08). Could you please try to use 1.4.2_08 for running NetBeans? (use -jdkhome JDK_PATH command line switch of netbeans.exe)
Aren't you using firewall? Try to turn it off.
The comment regarding it not working under JDK 1.4.2_08 was from user 'gamont', not me - so someone else has the same problem with the latest 1.4.2 under Win2000. I'll try 1.4.2_08 anyway. We have a corporate firewall at my work on the servers, not on the PC's. I'll check with the technicians at my work to see what they've installed, in case there's a local firewall of some sort. Maybe there's some network monitor I can run to see what's happening. Remember, it works fine for me under JDK 1.5.0_03, so I don't think it's related to any firewall. Maybe 'gamont' can let us know his PC config to see if there's something in common with mine. At my work, we are using NetWare for our networking instead of Windows networking, so it's not a standard Win2000 install. Maybe this has some compatibility issue with part of either the JDK or NetBeans. If we have no luck, I'll be happy to try monitoring / debugging this for you if there's some sort of debugging I can enable (is there a runtime switch or do I need to download the source code?). I'll also try stopping tomcat from the command line - that will tell us if it's tomcat or NetBeans.
Today I tried shutting down the bundled tomcat from the command line after starting it up from NetBeans, and it worked under JDK 1.4.2. I set JAVA_HOME, CATALINA_HOME, CATALINA_BASE, and CATALINA_TMPDIR to the same values as the IDE when it fires up tomcat. I ran the shutdown.bat command from the bin directory and it shut down tomcat immediately. If the server window is still up in NetBeans, it closes because it detects that the shutdown has happened. I'll follow up the firewall question, but I'm pretty sure our PC's at work don't run any local firewall. I did run a network monitor and it seems to be pretty similar between JDK 1.4.2 and 1.5.0_03 - there aren't any errors for JDK 1.4.2. Any other ideas?
I just tried a test using JDK 1.4.2_08 and it doesn't work either. Seems that only JDK 1.5.0_03 works for me at the moment.
It seems that the Tomcat bundled version needs a compatibility package to be installed to works with jdk 1.4 "...If using a J2SE 1.4 JRE, the compatibility package must be downloaded and expanded inside the folder where Tomcat was installed."
TO rnagajek: Can you also try to stop it by calling "catalina.bat stop" instead of using shutdown.bat? (this is what NetBeans do). TO gamont: The compatibility pack is already included in the bundled Tomcat, so this is not the problem.
I too have observed this issue -- first in 4.1RC2 now in 4.1 release. When I try to shut down from inside the IDE it waits a loong time then shows a red msg on the start/stop dialog "Stop server Bundled Tomcat (5.5.7) timeout or interrupted" When I try catalina stop I get: C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\bin>catalina stop Using CATALINA_BASE: C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7 Using CATALINA_HOME: C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7 Using CATALINA_TMPDIR: C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7\temp Using JAVA_HOME: C:\j2sdk1.4.2_04 Created MBeanServer with ID: 1f934ad:103ce8ed45e:-8000:donald-0544d03d:1 May 11, 2005 9:39:58 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Catalina.stop: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.<init>(Socket.java:309) at java.net.Socket.<init>(Socket.java:124) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:394) 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:324) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:320) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:411)
You are getting the connection refused error because you haven't set the CATALINA_BASE directory to what NetBeans set it to. If you do this, catalina stop does work. I've tested this under JDK 1.4.2, and catalina stop works fine. NetBeans 4.1 final release still doesn't work for stopping tomcat under JDK 1.4.2, though. This are three people with the same problem now, I'm interested in what's common in the configs if others can't reproduce this.
Can someone point me to the code that is issuing the tomcat command? I've downloaded the latest source snapshot of NB42. Or, is there some extra debugging I can enable for the IDE which might help?
The code is in this class: tomcatint/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java you can also browse it from here: http://www.netbeans.org/source/browse/tomcatint/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java I don't think there are any useful debug messages that could help in this case. It would be really great if you could debug it to see what's the problem. Btw, the way how the start and the stop commands are launched is the same, so if starting works stopping should work too. It's strange that it does not work for you and I'm really curious what is the reason for it. The only one that still comes to my mind is the firewall:( I hope that you will find out something more.
You could also add some debug info to your catalina.bat to see if it's called or not. You should redirected to some file since you won't see the stdout when the stop command is launched from the IDE.
Following suggestion from rnagajek Thu May 12 02:19:28 +0000 2005 I noted the setting of CATALINA_BASE in the IDE output window. When I set that as an environment variable and run from command line I can verify that Tomcat does stop. IDE does not notice this -- still says it is running until I reopen the start/stop window at which point the status changes to stop. I will happily provide whatever configuration info is requested if you think it will help answer the question. If changing to a newer SDK can solve my problem I will do that but I would prefer not to have to move to 1.5 due to compatibility issues with 3rd party vendor who insists 1.5 is not acceptable. Following suggestion from sherold Thu May 12 15:41:30 +0000 2005 I added some echo >> catout.txt lines to catalina.bat and verified that the IDE uses "CATALINA run" and Tomat starts. IDE issues "CATALINA stop" and Tomcat does not stop. Nothing is visible in IDE output window.
I've added logging from catalina.bat to see what's going on. When the start runs, it executes the batch file with 'catalina run' (start catalina in a separate window). When the stop runs, it executes 'catalina stop', and the batch file starts running but hangs when executing the Java. A new java.exe appears in the task manager and hangs, as well as an extra CMD.EXE. Maybe there's a bug in Runtime.exec() in JDK 1.4.2?
Thanks for your information: could you please add environment variables logging to the file before Tomcat is executed? (in catalina.bat add line 'set >> catenv.txt') Please attach logs for Tomcat stopped from NetBeans and stopped from command to see the difference in env-variables like classpath etc. - some classpath conflict could be probably the reason of your problem. Thanks.
OK I'm attaching the logs for tomcat run, tomcat stop (netbeans), and tomcat stop (command prompt).
Created attachment 22111 [details] catalina.bat log - catalina run
Created attachment 22112 [details] catalina.bat log - catalina stop (from NetBeans)
Created attachment 22114 [details] catalina.bat log - catalina stop (from command prompt)
BTW did you logged (using "command >> log.log") also lines starting with %_EXECJAVA% %JAVA_OPTS% in catalina.bat? Also trying to redirect stderr to a log file could help us (I think it's something like "command 2>> log.log)
Three things I noticed which may be irrelevant: 1) 4.1 RC1 did not display this problem but RC2 did. 2) When I start the embedded TC from startup.bat or catalina.bat run it starts up using port 8080 and Admin port 8005. When run from IDE it uses 8084/8025. 3) An external tomcat50-jwsdp as an additional server starts and stops from IDE without problems.
TO: rnagajek > 1) 4.1 RC1 did not display this problem but RC2 did. Rnagajek, can you confirm this? TO: dga12 > 2) When I start the embedded TC from startup.bat or catalina.bat run it starts > up using port 8080 and Admin port 8005. When run from IDE it uses 8084/8025. This seems like you didn't set the CATALINA_BASE directory, did you?
I'm pretty sure that it didn't work under RC1. I did a new test. I tested it on my home pc (previous was work), which is WinXP SP2. I have been running NB41 / JDK 1.5.0_03 at home, and it all works fine. For this test, I installed JDK 1.4.2_08 and pointed NB41 to it. The first time I tried a test, it started tomcat ok (as under Win2K). When I went to stop tomcat, it shut down WinXP immediately. (i.e. as if the reset button was pressed on the pc.) That's a pretty severe result. After reboot, I couldn't run NB41 under JDK 1.4.2_08 any more - it just wouldn't startup. I could run it under JDK 1.5.0_03, though. I uninstalled JDK 1.4.2_08 and reinstalled it and did the test again. This time around, tomcat started but could not be stopped. My home config is a standard WinXP SP2 install with sygate firewall running. The firewall shows no java.exe blocks. This looks like a JDK problem - has anyone else seen the same thing under WinXP? Read on ... I did logging from catalina.bat at home, I'll attach the files. Note: The 'catalina.bat stop' command didn't output anything at all to the log - maybe the first catalina run process had a lock on the log file? As a test, to get the stop command logging, I started tomcat from nb41, then I modified catalina.bat to output to a different log file, then issued the stop from tomcat and it works! It seems to work every time under WinXP - I'll try tomorrow under Win2K. Maybe the output from the catalina run command is conflicting with the catalina stop command?
Created attachment 22144 [details] catalina.bat log for run command under WinXP SP2
Created attachment 22145 [details] catalina.bat log for stop command under WinXP SP2
Progress made! I've tested this at my work under Win2K / NB41 / JDK 1.4.2. I set the output of catalina.bat to catalina-run.log first, then start it from NB. Then, I modify catalina.bat to output to catalina-stop.log, and then do the stop from NB, and it shuts down fine. It looks like the problem is the piping of the output to the IDE. The start server pipes the output to the IDE, and the stop server hangs trying to write to the same destination.
This is really weird. NB read the catalina.bat process stdout when starting the server but does not even touch it when stopping it. If you are right it seems to me like a jvm issue and it will be quite hard to come up with a workaround since I can't reproduce it. It would be worthy to test it with some other vender's 1.4.2 jvm, IBM's for instance. I've modified the Tomcat module so that the stdout of the "catalina.bat stop" process is copied in the output window. Can you try it out? Just copy the attached org-netbeans-modules-tomcat5.jar file over the one in the ${netbeans_install_dir}/enterprise1/modules directory and try to start & stop the server. Lets see what will appear in the output window.
Created attachment 22160 [details] Modified org-netbeans-modules-tomcat5.jar
I just was getting that same problem and I was looking in to the isuuezilla if there is a bug already opened for the same. However I when downloaded the bellow attached jar file I have an interesting problem. The stop works just fine the IDE then can figure that the tomcat is stopped and the complete thing goes just fine but when I look at the task manager the java.exe is still running and I have to kill that manually in the task manager. Hence the stop just hangs the tomcat after releasing the ports and the process is still alive. My environment is Java : 1.4.2_07 OS : Windows 2000 Pro SP4 IDE : Netbeans 4.1
I gave the new JAR a try on Win2K SP3 / JDK 1.4.2 and it worked fine. It removes the java.exe process and the cmd.exe processes go away as well. namanpatel: Did you modify your catalina.bat in any way to do logging? Make sure you set it back to the original one. This looks like it's fixed the problem for my setup, can users gamont and dga12 give this a test?
Rnagajek, it's good to hear that the workaround works for you. I've now removed redirection of the "catalina.bat stop" process to the output window and replaced it by just getting the inputstream of the standard and error output without actual reading from it. Can you please try out whether it works as well? The jar is attached below. Gamont, Dga12 can you please test it too? Namanpatel, can you please state whether you did or did not modify the catalina.bat script? Does it work with jdk 1.5? Thanks
Created attachment 22174 [details] Modified org-netbeans-modules-tomcat5.jar #2
I tried it out and it didn't work - it hung like before. That's under Win2K SP3 / JDK 1.4.2.
OK, pity. Can you please test this one? I want to come up with as simple workaround as possible. I really appreciate your help and patience, thank you.
Created attachment 22180 [details] Modified org-netbeans-modules-tomcat5.jar #3
I tested the first attachment with -jdkhome jdk1.4 and it worked ! the second and third didnt.
Just to add, the first attchm stops tomcat and it remains just one java.exe (IDE)
I tested the third JAR on Win2K and it doesn't work. I retested the first JAR on Win2K and can confirm that it does work properly and cleans up all processes (tomcat java.exe disappears).
Ok, thanks. Can you please try out this one - hopefully it is the last one. This time the stdout and stderr of the startup process is still being read and displayed in the output window while the output of the "catalina.bat stop" process is being read in the background.
Created attachment 22196 [details] Modified org-netbeans-modules-tomcat5.jar #4
that fourth jar close the tomcat instance, but if you have an Output window minimized it dont pops up the windows as does the first jar (and the original using jdk 5)
Actually, the minimized output window should pop up only when the server is started not when stop action is called. This is also how it should work in the non modified jar and it does so for me. Are you really sure it poped up with the original jar? The reason why the first modified jar causes the output window to pop up is because the output window is cleared and a new input stream is attached to it. Rnagajek, can you please check whether the jar #4 works for you too? Thank you
Yep it works on Netbeans 4.1 JDK 1.4.2_07
Just a note. JAR #1 did seem to clean up the tomcat java.exe process - sometimes. I noticed at work that when I deployed a Struts web app and ran it, then when I ran the stop it seemed to work properly (nb41 seemed to think that tomcat had stopped), but the java.exe task was still running. Tomcat didn't shut down. If I tried to restart tomcat, it wouldn't work because the port was in use. I had to kill the process.
Just to add to that, the initial testing I did was to just start and stop tomcat. It's when I was running a web app it didn't seem to shut down.
Rnagajek, since NB think that Tomcat is not running anymore it means that the Tomcat HTTP connecter (8084) is not responding anymore. This looks like some other issue since the stopping procedure was evidently initialized successfully. Does this works when you stop Tomcat from the command line? Btw, you are referring specifically to jar #1. Does that mean that the original and #4 jars behave differently?
I tested jar #4 at home under WinXP SP2 / NB41 / JDK 1.4.2_08 and it worked for starting and stopping tomcat. I'll try at work under Win2K tomorrow.
Tested under Win2K SP3 / JDK 1.4.2 today. The start and stop works fine. I've had a separate issue where sometimes the tomcat process is left running as a java.exe. Even though the web applications list shows no deployed web apps, there is a directory in the tomcat webapps and work dirs where an application has been deployed. I'm not sure how this should be logged. Stopping from catalina.bat directly makes no difference.
> Stopping from catalina.bat directly makes no difference. OK, this looks like a Tomcat issue then. Can you please file it in Tomcat bugzilla: http://issues.apache.org/bugzilla/enter_bug.cgi? Fixed in trunk. Thank you all for helping out with this issue. Commit log: Checking in src/org/netbeans/modules/tomcat5/ide/StartTomcat.java; /cvs/tomcatint/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java,v <-- StartTomcat.java new revision: 1.69; previous revision: 1.68 done
You guys are good. I go away for a week and when I get back, you have resolved it and provided a solution. My hat is off to you all.
Verified. BTW: it is candidate for 4.1 HotFix.
It is staged as 4.1 hotfix on Update Center for NetBeans 4.1.
I wouldn't say it is completely fixed. If there is a context that does not load at startup then a complete shutdown does not occur and the jvm hangs around.
pcgoober, could you please file a new issue with steps to reproduce? Thanks! Let's leave this one as fixed since it really fixed most of the problems.