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.

Bug 245146 - Apache tomcat 6.0.32 fails to start second time in both debug and run mode
Summary: Apache tomcat 6.0.32 fails to start second time in both debug and run mode
Status: RESOLVED INVALID
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-19 19:35 UTC by aaditi30
Modified: 2014-08-15 22:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
console output log (13.52 KB, text/plain)
2014-06-19 19:35 UTC, aaditi30
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aaditi30 2014-06-19 19:35:47 UTC
Created attachment 147725 [details]
console output log

Using:
1)Tomcat 6.0.32
2)jdk 1.6
I have added tomcat server in run configuration under properties in project.
Steps to reproduce:
1)delete existing tomcat folder and extract a new one.
2)start netbeans.
3)Debug project.
4)server will start properly and work properly will let you attach debuggers on other ports also.
5)stop server.(observation: server is stopped from netbeans but but java service is still running under processes in windows.
6)try to restart server from netbeans in either run or debug mode.
7)output console displayes:
starting tomcat
then tomcat startup fails
netbeans builds and generates new war resolves all dependencies(observation:takes a lot of time sometimes and i can see a java process in windows even though tomcat startup failed if i kill that process war generation starts if it was waiting for long time but in the end again tomcat startup fails)
tries to start tomcat once again
after a long time gives error port being used is occupied
(observation: i can see java process running under windows processes even though tomcat startup fails)
Comment 1 aaditi30 2014-06-19 19:46:33 UTC
After reproducing the issue if i keep killing the java process and try starting the server again it doesn't work.
The solution i am using right now for this problem is 
close netbeans
delete existing tomcat folder
extract tomcat again from zip 
start netbeans and run server in debug mode.
now server will start perfectly for the first time but if i try to stop or restart it is will produce the same issue i have explained in description.
Comment 2 Petr Hejl 2014-06-20 10:05:13 UTC
This works for me nicely:
Windows 7
JDK 1.6.0_45
Tomcat 6.0.32
Latest NetBeans 8

1) start NetBeans
2) register Tomcat, change properties to be using JDK 6
3) create web project
4) debug the project
5) server starts ok
6) stop the server
7) server stopped ok
8) start server again in run mode
9) started ok

This has to be something in your setup and/or project otherwise I believe we would have much more issues reported on this.

Perhaps the project is preventing tomcat to properly exit? Or it might be firewall/security software problem.
Comment 3 venkatramakkineni 2014-08-14 18:37:26 UTC
I have a similar problem. Could really use some clarity on what could be causing this.
Comment 4 venkatramakkineni 2014-08-14 18:43:47 UTC
I can't edit the previous comment, but I have the exact same problem. Was seriously hoping I can use Netbeans this time. But if I have to unzip the tomcat everytime, that is a deal killer. For some reason, Eclipse seems to start and stop tomcat just fine. If it was environment related issue, shouldn't I see it on Eclipse too ?

Are there ant tests that you'd suggest me to run ? The logs don't have any information about what is going on.
Comment 5 venkatramakkineni 2014-08-14 18:50:03 UTC
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

Windows 7
Tomcat 6.0.41
Netbeans 8.0 ( Build 201403101706 )
Comment 6 venkatramakkineni 2014-08-14 22:13:11 UTC
I think this is related to the project I am working on. I have tested the application on 7.4 and the same behavior. Unfortunately I don't even know where to begin with debugging !!
Comment 7 aaditi30 2014-08-14 22:29:05 UTC
Yes it is related to your project. For me also the issue was related to my project but i was never really able to figure it out. What worked for me is following steps
1)kill the java process
2)deleting work and logs folder from tomcat and localhost folder from catalina inside tomcat.
3)Now build the project again.(build will create  new war and put it inside deploy folder)
4)now start tomcat again in debug mode.
Comment 8 venkatramakkineni 2014-08-15 21:47:25 UTC
@aaditi30 

Thanks for the tip, it really helped. I seem to have found my issue. It is the Log4j's FileWatchdog thread that refuses to shutdown. There are quite a few blog posts on this.  

Issue:
------

https://issues.apache.org/bugzilla/show_bug.cgi?id=4913


Because Log4J is so ubiquitous, I am posting this here as a reference to anyone who might land on this page.

Temporary Workaround:
--------------------

http://mmartinsoftware.blogspot.com/2013/09/log4j-and-web-application-thread-leaks.html
http://mmartinsoftware.blogspot.com/2013/09/log4j-2-fixes-auto-reconfigure-thread.html


Permanent Fix: Ditch Log4j and use Log4j 2 or Logback.
Comment 9 aaditi30 2014-08-15 22:17:23 UTC
@venkatramakkineni

Thanks for the info may be my issue might be related to same thread I'll check if that is the case.