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 64797 - [50cat] [j2ee] Tomcat's port already in use forces restarting the IDE
Summary: [50cat] [j2ee] Tomcat's port already in use forces restarting the IDE
Status: RESOLVED WORKSFORME
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker with 3 votes (vote)
Assignee: Sherold Dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-21 10:00 UTC by llturro
Modified: 2006-06-13 13:48 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Tomcat port already in use, Tomcat stopped (250.13 KB, image/jpeg)
2005-09-21 15:11 UTC, llturro
Details
Tomcat 3.2 running at localhost:8084 (38.51 KB, image/png)
2005-09-26 23:46 UTC, William Leonard
Details
Log file (134.15 KB, text/plain)
2005-10-25 15:44 UTC, llturro
Details
Catalina log (10.80 KB, text/plain)
2005-10-25 15:46 UTC, llturro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description llturro 2005-09-21 10:00:36 UTC
[ BUILD # : 200509151455 ]
[ JDK VERSION : 1.5.0_04 ]

On previous versions, when IDE stopped detecting 
Tomcat (which often happens when you do a lot of 
typing while integrated Tomcat is running and click 
Run to execute the changes), it gave an error of 
port already in use, but continued deploying the 
application. Currently stops, you can't force the 
IDE detecting Tomcat, not even refreshing, and the 
only solution is to restart the IDE.
Comment 1 zikmund 2005-09-21 10:10:26 UTC
Lluis, do you have some steps to reproduce? I don't understand in which
ciurcumstances IDE stops detecting Tomcat instance.
Comment 2 llturro 2005-09-21 10:22:00 UTC
The times occurred to me I did:

1) Run a web application with integrated Tomcat
2) Do a lot of typing in the IDE or
   Create images for the web or
   Lunch time 
   (with this I mean IDE+Tomcat were running, Tomcat always on the background)
3) Run the application again.

In 4.1 I could see the symptoms on the Runtime window, where Tomcat showed as
stopped. In 5.0 I see it on the contextual menu, with 'stop server' greyed.

Anyway, what's more tedious now is restarting the IDE just because 'port already
in use'
Comment 3 Sherold Dev 2005-09-21 12:41:29 UTC
I don't quite understand the description, marking as INCOMPLETE temporarily.

Does it mean that NB successfully start Tomcat in the step #1 and then after a
while of something else doing (step #2) Tomcat shuts itself down, but does not
release its network sockets?
Comment 4 llturro 2005-09-21 13:45:36 UTC
Oh no, Tomcat continues working, but the IDE doesn't reflect it.

In 4.1, atfer it happened, I could see in the browser the application changes.
But in current release the IDE doesn't deploy the application once founds the error.
Comment 5 zikmund 2005-09-21 13:55:43 UTC
Lluis, not depoying is not as bug. The primary bug is that IDE looses Tomcat and
detects it as stopped. We haven't seen it before. Could you please give us steps
to reproduce such behavior?
Comment 6 llturro 2005-09-21 14:25:16 UTC
I reproduced the steps on my second post. It happens often to me, maybe once a
day. I said nothing before because 4.1 continued despite the error.

I think the ingredients are: NB + Tomcat + A Memory consuming application. 

I thought NB 4.1 was giving some time for Tomcat to respond before guessing
whether it was up or down and because memory swap, this time was over-passed.
Comment 7 llturro 2005-09-21 15:09:48 UTC
I just get it now. I took a screenshot from the error. In order to get current
Tomcat its status I pressed the Refresh button. If I didn't do that, the buttons
Stop and Restart still were enabled. The IDE status bar shows project(run) and
Deploying project as current tasks, but it freezes.

Tomcat is running, and when I do refresh I get:

---------------------------------------------------------------------------
HTTP Status 503 - This application is not currently available

type Status report

message This application is not currently available

description The requested service (This application is not currently available)
is not currently available.
Apache Tomcat/5.5.7
---------------------------------------------------------------------------
Comment 8 llturro 2005-09-21 15:11:27 UTC
Created attachment 25034 [details]
Tomcat port already in use, Tomcat stopped
Comment 9 zikmund 2005-09-21 15:15:53 UTC
HTTP Status 503 appears in browser? If yes then it is definitelly Tomcat
problem, not NetBeans problem.
Comment 10 llturro 2005-09-21 15:22:54 UTC
Oh, I start doubting my English is good enough, take patience.

Yes, it appears in the browser: after an attempt to start Tomcat when Tomcat was
already started. Next come the web application not responding. Notice that the
application was running before the attempt and will run perfectly after restarting.

Also, if I did not stop working on NB it wouldn't happen. 
Comment 11 Sherold Dev 2005-09-22 14:10:58 UTC
The status code 503 - Service Unavailable indicates a serious problem with the
webserver.

It looks like this issues is caused by a weird state of your Tomcat installation
and not by a bug in NetBeans. It could be caused by server configuration or by
some of the deployed applications.

Can you try your reproduction step with a clean user dir and a new web project
(the simple one the new web application wizard generates for you)?
Comment 12 llturro 2005-09-22 14:25:46 UTC
Ok, I'll try. But notice I filled the issue thinking about a change on IDE's
behavior. NB4.1 also failed from time to time checking Tomcat's status, but
continued deploying the application.

I tried on NetCAT list for other people having this problem, maybe someone would
help.
Comment 13 llturro 2005-09-22 14:53:03 UTC
Just now, I started an image editor (creating new skins for the webapp) and when
I returned to NB, made some changes and ran the application. It gave me the
error, but this time Tomcat continued running the web application. :-/

I'll try with a very simple web-app, as you suggested.
Comment 14 llturro 2005-09-22 14:55:28 UTC
Opps! I stopped the IDE (confirmed by the task admin on W-XPP) and Tomcat
continued running!
Comment 15 Sherold Dev 2005-09-22 15:13:11 UTC
Can you try to access with the browser some non-existing page on your Tomcat
when NB is failing to detect the running state of your Tomcat, lets say
http://localhost:8084/response_test for example. 

Is the response "instant" - is there a visible delay? If yes, this could be 
probably the reason why NB detect incorrectly the server state.




Comment 16 William Leonard 2005-09-26 23:45:42 UTC
I'm experiencing the same problem, address already in use: JVM_Bind:8084.  When
I try to browse to http://localhost:8084, I get a page indicating Tomcat Web
Server v3.2 is running (see attached). However, this page only appears after I
try to start Tomcat 5.5.7 from w/in NetBeans. That is, if I try to browse to
localhost:8084 before trying to start Tomcat 5.5.7, I get the connection refused
dialog, as expected.

As far as I know, Tomcat 3.3.2 is not installed on my workstation (WinXP). But
somehow, NetBeans is starting it before starting 5.5.7, causing the bind exception.
Comment 17 William Leonard 2005-09-26 23:46:42 UTC
Created attachment 25207 [details]
Tomcat 3.2 running at localhost:8084
Comment 18 Jaroslav Pospisil 2005-09-27 15:54:50 UTC
Could you both please specify hardware configuration of your workstations?
Processor and RAM will be fine,thanks.
Comment 19 Jaroslav Pospisil 2005-09-27 16:03:20 UTC
Cannot reproduce in 200509251930,so decrease priority to P3.  
Comment 20 William Leonard 2005-09-27 16:06:35 UTC
Intel Pentium M 1.80 GHz w/ 2 GM RAM. I will test again on the beta.

/Brian
Comment 21 llturro 2005-09-27 18:21:51 UTC
XPP, Pentium III, 384 Mb. On my Linux box I never had this problem. I'm running
more memory, 512Mb.

Definitely bleonard problem isn't the same problem. FYI, sherold, there is a
delay when this problem occurs. The computer seems to freeze when returning to
NB. I'm 90% sure the problem is this delay. I'll look further this week.
Comment 22 llturro 2005-09-29 17:39:33 UTC
PP, Pentium III, 384 Mb. NB 5.0 Beta.

I got the same error and the application was undeployed (or whatever state it
has when incremental deploy fails)

Stopping/Restarting Tomcat from within the IDE had no effect, same error.

I stopped the IDE and Tomcat kept running. I tried because I noticed the
'Waiting for Tomcat...' screen didn't appear.

I started the IDE again and this time NB checked Tomcat as 'Running'!? But
couldn't deploy the application.

I moved to my Linux box, where I have more memory and never get those errors. To
me, this happens only with short memory and large programs (compiler, j2ee
server, imaging)
Comment 23 William Leonard 2005-09-30 15:17:17 UTC
Unfortunately, the Beta did not solve my problem. Since my problem is slightly
different, I'm going to open a new bug. 
Comment 24 xaxim 2005-09-30 16:44:08 UTC
I have the same problem

At home I have Tomcat 5.5.9
port 8080
shutdown port 8025
JDK 1.5.0_05
I tried to change the shutdown port on blundled tomcat 5.5.7 to 8030 to see if 
it solves the problem, but it only allowed me to have both tomcats online at 
the same time, but netbeans was still missing the blundled status.
BTW, it says it is stopped when it is running.
Try to access Http://localhost:8084 to see if it is running or not
On IE you must change the Internet Options to verify the page for each visit, 
else it shows the tomcat welcome page even if tomcat is not running.
On Firefox it checks if the page is new by default.
i dont know why netbeans misses the tomcat status, at work, i have no other 
tomcat, and it works fine

At work, i installed brand new NB50Beta, using JDK1.4.2_07.
tomcat runs
application runs
application debugs
tomcat stops
everything works just fine.

RAM at home: 768 MB
RAM at work: 256 MB
Both Windows XP SP 2
Comment 25 Jaroslav Pospisil 2005-10-24 12:01:20 UTC
We aren't still able to reproduce this test case.Could you please find some
simplier reproducible test case or attach messages.log,Tomcat and web app
output,after this occured? 
Comment 26 llturro 2005-10-25 15:37:30 UTC
I thought I'll never see this on my Linux box, but there is. Port already in use
exception, NetBeans down and internal Tomcat running the web application as if
nothing happened.

I'll attach NB and Tomcat logs.
Comment 27 llturro 2005-10-25 15:44:00 UTC
Created attachment 26320 [details]
Log file
Comment 28 llturro 2005-10-25 15:46:30 UTC
Created attachment 26321 [details]
Catalina log
Comment 29 llturro 2005-10-25 15:48:57 UTC
As in previous occasions, I had several applications running at the same time.
Comment 30 Sherold Dev 2005-12-09 16:57:03 UTC
It looks like the problem is caused by slow Tomcat response. You can try to
increase the timeout NB uses for checking the Tomcat state.

1. Shutdown NB
2. Go to your NB user dir
3. Open the config/.nbattrs file and add the following line

<attr name="J2EE\InstalledServers\Tomcat_instance\runningCheckTimeout"
stringvalue="5000"/>

4. start NB and check if it helps
Comment 31 Sherold Dev 2006-01-06 09:52:24 UTC
Closing as invalid since there in no more input from the user.
Comment 32 llturro 2006-01-07 12:10:04 UTC
sherold, I reopened the issue not because I have more information, but because
didn't occur anymore. Anyway, the fact remains. When NB fails detecting Tomcat
the whole thing behaves wrong. NB stops deploying applications and Tomcat runs
its own way. That's the point, not increasing timeout, but making the engine to
work even after Tomcat detection failure.

Excuse me if I'm going to far, but I would suggest:

1) Decrease timeout to a sure-will-fail value.
2) See how NB + Tomcat behave.
3) Try to solve it.

Since NB requirements say RAM amount of 384Mb suffice, and really doubt this for
web application development, I think this issue is quite important. The only
workaround I know is restarting the IDE and stopping Tomcat separately. Ufff!
Comment 33 Sherold Dev 2006-06-13 13:48:45 UTC
Closing as worksforme, since it is not possible to reproduce this issue, which
is likely caused by some local setup.