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 226458

Summary: Start NetBeans web app in debug mode seems to be starting twice, debug session is lost
Product: serverplugins Reporter: ecerichter
Component: TomcatAssignee: Petr Hejl <phejl>
Status: VERIFIED FIXED    
Severity: normal CC: dkonecny, mentlicher, mmirilovic, pjiricka
Priority: P1    
Version: 7.4   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log
video of the issue in action!

Description ecerichter 2013-02-21 12:43:07 UTC
Product Version = NetBeans IDE Dev (Build 201302172300)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

Seems that NetBeans is starting the web app in debug mode, then for some unknown reason it is stopping Tomcat and starting again (still in debug mode), but then debugger is not attached.
This is a very strange behavior that started after I upgraded from RC2 to recent DEV.

See attached video for reference (notice that the "white window" that appears near the end of the video is my Chrome window opening - is not any kind of weird effect or interruption of any kind).

Regards.

Edson
Comment 1 ecerichter 2013-02-21 12:43:12 UTC
Created attachment 131669 [details]
IDE log
Comment 2 ecerichter 2013-02-21 13:00:40 UTC
Created attachment 131672 [details]
video of the issue in action!
Comment 3 ecerichter 2013-02-23 16:26:25 UTC
Increasing to P1 as per guidelines:

http://wiki.netbeans.org/BugPriorityGuidelines
Comment 4 Jiri Kovalsky 2013-02-25 11:55:12 UTC
Setting version correctly.
Comment 5 Martin Entlicher 2013-02-25 15:07:51 UTC
This seems to be the same problem as issue #226617.
Comment 6 David Konecny 2013-02-25 20:02:37 UTC
*** Bug 226617 has been marked as a duplicate of this bug. ***
Comment 7 David Konecny 2013-02-25 20:10:22 UTC
I cannot reproduce the problem. This is what I tried:
* create new Web Application project for Tomcat server (7.0.10)
* create a Servlet in the project
* run project -> Tomcat server was started
* add breakpoint to the servlet and debug project --> server was restarted in debug mode and debugging session was started; opening the servlet URL in the browser hits the breakpoint and debugging works
* clean and build project -> project was undeployed first
* debug project again -> application was redeployed to server is still running in debug mode and debugging works

Could you please try the same and let me know what works for you and what not? Or what should I do differently to reproduce your problem. Thanks.
Comment 8 ecerichter 2013-02-25 20:21:55 UTC
Have you seen the video attached to this ticket?

This is repeteable always: whenever I have Tomcat running in Debug mode, then I ask "Project -> Deploy", tomcat is stopped and started again in non debug mode.

I just tried your scenario, and is still happening.

Notice I've external Tomcat configured with no custom scripts.
Port 8080, shutdown port 8005, HTTP Monitor enabled.
Comment 9 David Konecny 2013-02-25 22:08:03 UTC
I did watch the video, but I cannot reproduce the problem locally. Must be some difference between our environments. If you customized your Tomcat instance it could be worth it to try to re-run the testcase I gave on a vanilla Tomcat downloaded from Tomcat website and registered in the IDE without any customizations.

I'm not aware of any recent changes in project infrastructure which could be relevant. In issue 226617 ecerichter says this started happening since dev build 201302172300. Passing to Tomcat support in NB.
Comment 10 ecerichter 2013-02-28 14:08:39 UTC
I can confirm that by creating a new empty Java Web project, this issue does not happen.
Nevertheless, it is impossible to create new Java Web project and recreate all structures that I have in dozens of web projects.

I will need assistance to discover what is going wrong. Which project parameters or dependencies would affect the redeployment?
Comment 11 ecerichter 2013-02-28 14:14:40 UTC
Ok, just after sending the previous message, I made another attempt with one more step in the newly created project:

1) Added PostgreSQL jdbc 4 v1002 driver to the project, and included it in the build of WAR file
2) Created a Resource in context.xml file:

<Context antiJARLocking="true" path="/Teste">
  
  <Resource auth="Container" description="MyDatabase"
            driverClassName="org.postgresql.Driver"
            logAbandoned="true" maxActive="30" maxIdle="2"
            maxWait="-1" name="jdbc/studi" password="123456"
            poolPreparedStatements="true" removeAbandoned="true"
            removeAbandonedTimeout="600" type="javax.sql.DataSource"
            url="jdbc:postgresql://127.0.0.1:5432/mydb?charset=UTF-8&amp;loglevel=1"
            username="dbuser"/>
  
</Context>


After that, when redeploy the newly created test web app, I got the restart.

Seems that the installation of the JDBC driver is causing the Tomcat restart. Would be possible that I've the exactly same version of JDBC driver in $TOMCAT_HOME/lib
Comment 12 ecerichter 2013-02-28 14:18:46 UTC
Ok, there is a workaround: disable the option "Enable JDBC driver deployment" in Server configuration.
Comment 13 David Konecny 2013-02-28 20:48:01 UTC
Great job ecerichter, thanks for narrowing it down. I did notice that IDE log you appended contains exception which looks relevant:

INFO [org.netbeans.modules.tomcat5.TomcatJDBCDriverDeployer]
java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:214)
	at java.util.zip.ZipFile.<init>(ZipFile.java:144)
	at java.util.jar.JarFile.<init>(JarFile.java:153)
	at java.util.jar.JarFile.<init>(JarFile.java:117)
	at org.netbeans.modules.j2ee.common.Util.containsClass(Util.java:551)
[catch] at org.netbeans.modules.tomcat5.TomcatJDBCDriverDeployer$DriverDeploymentProgressObject.jdbcDriversToDeploy(TomcatJDBCDriverDeployer.java:168)
	at org.netbeans.modules.tomcat5.TomcatJDBCDriverDeployer$DriverDeploymentProgressObject.run(TomcatJDBCDriverDeployer.java:126)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)

I will let Petr Hejl to check whether he can reproduce the problem now and fix it in NB Tomcat support.
Comment 14 ecerichter 2013-03-01 11:33:03 UTC
U r welcome.
It is my interest to get as much bugs fixed as possible.
Having real situations here, I know sometimes it is easier to reproduce the problems.

Regarding the PostgreSQL driver, it is standard PostgreSQL driver downloaded from the oficial site:

http://jdbc.postgresql.org/download/postgresql-9.2-1002.jdbc4.jar

I hope this helps.

Regards,

Edson
Comment 15 Petr Hejl 2013-03-06 14:23:20 UTC
I can't reproduce it myself. Looks like either your file is corrupted or there is a problem in JDK compression algorithm. Looks like avoiding of JarFile in our code could help.
Comment 16 Petr Hejl 2013-03-06 14:33:17 UTC
I tried to fix it blindly at web-main 447c9c94aab5. Could you please retest the issue with IDE build from (upcoming) http://bertram2.netbeans.org:8080/job/web-main/10037/ ? Thanks.
Comment 17 Quality Engineering 2013-03-08 02:01:47 UTC
Integrated into 'main-golden', will be available in build *201303072300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/447c9c94aab5
User: Petr Hejl <phejl@netbeans.org>
Log: #226458 - Start NetBeans web app in debug mode seems to be starting twice, debug session is lost
Comment 18 Marian Mirilovic 2013-03-13 17:40:03 UTC
not verified yet, so postponing for NB 7.3.1 (Patch 2)
Comment 19 Petr Hejl 2013-03-29 16:46:40 UTC
ecerichter any feedback on this?
Comment 20 ecerichter 2013-03-29 16:54:02 UTC
(In reply to comment #19)
> ecerichter any feedback on this?

I though it was fixed and closed.
It works for me in DEV 201303272300.

Thanks,

Edson
Comment 21 Jiri Skrivanek 2013-04-16 13:03:40 UTC
Verified by the reporter in trunk.
Comment 22 Quality Engineering 2013-05-07 00:18:13 UTC
Integrated into 'releases', will be available in build *201305062200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/be91360a4968
User: Petr Hejl <phejl@netbeans.org>
Log: #226458 - Start NetBeans web app in debug mode seems to be starting twice, debug session is lost