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 54291 - Disable 'Start Server' when debugger stops at breakpoint
Summary: Disable 'Start Server' when debugger stops at breakpoint
Status: CLOSED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Libor Kotouc
URL:
Keywords:
Depends on: 56714 56926
Blocks:
  Show dependency tree
 
Reported: 2005-02-01 15:37 UTC by Jiri Skrivanek
Modified: 2006-03-24 12:59 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2005-02-01 15:37:08 UTC
When a debugger stops at breakpoint the
application server appears to be stopped. But If
you try to run it it fails. It should not be
possible. To reproduce:

- create a web application
- add breakpoint to index.jsp
- start debugger and wait until it stops at breakpoint
- in Runtime view call menu item 'Start/Stop
Server' on server instance
- Server Status window appears with 'Start Server'
button enabled
- click 'Start Server' button and server tries to
run but it fails with port conflict. Start Server
button should be disabled to prevent the failure.

Note: For application server it displays a warning
window first time you click server node but second
time it opens Server Status window.

Build 20050201-1106, JDK1.5.0_02, WindowsXP.
Comment 1 Martin Grebac 2005-02-23 10:13:33 UTC
Does this happen for Tomcat, too? Could you verify this still happens
after Ludo's fix of 55290 made yesterday? Thanks.
Comment 2 Jiri Skrivanek 2005-03-01 10:23:28 UTC
Yes, it happens primarily for Tomcat. It is still a valid issue in
recent build 20050301-0836.
Comment 3 Martin Grebac 2005-03-07 14:13:41 UTC
 This is fixable by e.g. copy & update isSuspended() method from
TomcatManager, or by adding some api to call plugins and addition of
another 'SUSPENDED' status. 
 I leave decision on j2eeserver owners.
Comment 4 Libor Kotouc 2005-03-23 13:06:49 UTC
Testing of suspended state requires server's debug info for comparing with
session parameters.
Tomcat works well but App server debug info returns null, see issue #56714.
Comment 5 Libor Kotouc 2005-03-23 13:43:08 UTC
Fixed except wrong detection of App server.

Checking in src/org/netbeans/modules/j2ee/deployment/impl/ui/ServerStatusBar.java;
/cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ui/ServerStatusBar.java,v
 <--  ServerStatusBar.java
new revision: 1.15; previous revision: 1.14
done
Checking in src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java;
/cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java,v
 <--  ServerInstance.java
new revision: 1.46; previous revision: 1.45
done
Checking in nbproject/project.xml;
/cvs/j2eeserver/nbproject/project.xml,v  <--  project.xml
new revision: 1.6; previous revision: 1.5
done
Checking in deps.txt;
/cvs/ide/golden/deps.txt,v  <--  deps.txt
new revision: 1.51; previous revision: 1.50
done
Comment 6 _ ludo 2005-03-23 17:17:01 UTC
app server is returning null, only is the server is not running...
In the case the server is suspended, we should retunr the correct debuginfo.

But the AS implementation for testing if the server is suspended is a littel bit
different than tomcat... Do we need a new j2eeserver api?
Comment 7 Libor Kotouc 2005-03-23 17:31:23 UTC
It is a little bit beyond my knowledge of j2eeserver. Maybe Stepan would know...
Comment 8 Nam Nguyen 2005-03-23 18:23:22 UTC
I don't think new API is needed.  ServerInstance could just cache debug info
right after calling startDebugging..., reset the cache when stop is called.  So,
there is no need to call plugin's getDebugInfo when server is known to already
running in debug mode.
Comment 9 Libor Kotouc 2005-03-24 20:22:04 UTC
IMO (if I understand), this solution works only if we resignate of existence of
more than one target.

The correct solution would cache not only ONE ServerDebugInfo for each
ServerInstance but should contain mapping Target->ServerDebugInfo. In this case
we get the old known problem not-having-target-when-app_server-is-suspended,
thus cannot retrieve debug info.
Well, I can implement Nam's or my solution (are hacks in fact), which would
pretend that we have only one target...

The best and now impossible way is the clearing and rewriting of the
corresponding j2eeserver code and maybe some parts of the plugins to ... with
multiple targets.

Because we think that aside of optimal solution the responsibility for server
state detection should be on server itself, we filed API review issue #56926.
Comment 10 Nam Nguyen 2005-03-24 20:56:07 UTC
Targets from an instance are cached, so I don't think we would have the problem
of  not-having-target-when-app_server-is-suspended
J2eeModuleProvider.getServerDebugInfo is called.
Comment 11 Libor Kotouc 2005-03-24 21:46:46 UTC
"targets from instance are cached"....I can see it in ServerInstance. But I
don't know which target to use (because there can theoretically more than one
target).

I am trying to solve following: a user right-clicks on server instance and click
Run/Debug...then ServerStatusBar instance is created and
ServerStatusBar.setCommandControlButtons() is called and this is the place where
ServerInstance.isSuspended() method is called. 

Do you have any idea how to bring correct target to this call? UI does not
support more targets (visible for user), doesn't it? Or did I miss something?
And it is interesting - null target is passed to
ServerInstance.startDebugTarget() which is called when a user clicks
'Start(Debug)' button on ServerStatusBar ;)

Anyway, I still think that it is server responsibility to announce its state...
Comment 12 Nam Nguyen 2005-03-25 04:02:19 UTC
Thanks for clarifying. I agree that in general plugin would be better to report
its own state like running, stopped, or running debug mode.  *But* the case of
suspended state is different.  How would plugin find out about suspended state
without talking with server?  By doing the same thing that j2eeserver would.  So
why not spare plugins yet another required service.

The ServerProgressBar dialog is design for start/stop server instance only. 
(Start/Stop target UI are currently to be provided by plugin).  So, to pick the
right target to check for suspended state in this dialog, use
StartServer.isAlsoTargetServer(target).  I assume, at this point when server is
already running in debug mode, plugin would know how to answer this without
talking to server. 
Comment 13 Libor Kotouc 2005-03-28 18:46:36 UTC
Fixed by workaround proposed by Nam. There is a little bit slide based on target
searching within Target->ServerDebugInfo map instead of current target-name
cache. The reason is unclear (at least to me) and uncommented use of this cache
(and more..it seems that this cache is never used when start debugging is executed).

Checking in ServerInstance.java;
/cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java,v
 <--  ServerInstance.java
new revision: 1.49; previous revision: 1.48
done

Comment 14 Jiri Skrivanek 2005-03-29 11:32:13 UTC
Verified in build 20050319-0955.