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 223035 - Debugging in Tomcat causes WAR to be launched twice
Summary: Debugging in Tomcat causes WAR to be launched twice
Status: RESOLVED INCOMPLETE
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 7.2.1
Hardware: PC Other
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-30 09:28 UTC by almson
Modified: 2013-12-05 05:47 UTC (History)
4 users (show)

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 almson 2012-11-30 09:28:12 UTC
Netbeans does this:
   1. Launch tomcat pointing to my WAR file
   2. Attach to tomcat for debugging/control
   3. Un-load my WAR file
   3. Re-load my WAR file

What it should do:
   1. Launch tomcat empty
   2. Attach to tomcat
   3. Load my WAR file

This takes twice as long because my WAR file has a relatively long initialization while it loads Spring and Hibernate. Also, my WAR file starts a background thread that looks for work, and this thread doesn't particularly like being started for two seconds and then closed.
Comment 1 almson 2012-11-30 09:31:29 UTC
I am using Maven
Comment 2 Martin Entlicher 2012-11-30 10:31:19 UTC
I do not think this has anything to do with debugger, specifically.
It looks like this is more about the build/run script.
Comment 3 Martin Janicek 2013-08-19 08:34:53 UTC
Does not sound like a Maven issue --> reassigning to Tomcat for evaluation
Comment 4 Petr Hejl 2013-08-23 08:57:24 UTC
(In reply to almson from comment #0)
> Netbeans does this:
>    1. Launch tomcat pointing to my WAR file
>    2. Attach to tomcat for debugging/control
>    3. Un-load my WAR file
>    3. Re-load my WAR file
> 
> What it should do:
>    1. Launch tomcat empty
>    2. Attach to tomcat
>    3. Load my WAR file
> 
> This takes twice as long because my WAR file has a relatively long
> initialization while it loads Spring and Hibernate. Also, my WAR file starts
> a background thread that looks for work, and this thread doesn't
> particularly like being started for two seconds and then closed.

Please provide exact steps to reproduce and expected results. These are too brief and fuzzy. The first scenario make sense if the app has been deployed previously. Otherwise I do not know what this means: Launch tomcat pointing to my WAR file
Comment 5 almson 2013-08-23 15:45:11 UTC
I meant that Tomcat is configured (via xml file, I believe) to load the application as soon it is started. After it starts and loads the application, however, it is intructed to unload and reload it.

Of you need a sample project, I will provide it. But this behavior should be the same for all projects.
Comment 6 bdpdx 2013-12-05 00:23:47 UTC
I've noticed this behavior happens when my webapp loads before the manager.  Then once the manager loads my app is undeployed and redeployed (which makes sense).

As a workaround I make sure the manager loads first by renaming the manager.xml deployment descriptor such that it sorts alphabetically before my webapp:

cd ${CATALINA_BASE}/conf/Catalina/localhost
mv manager.xml +manager.xml

It might be worth making this change (renaming the manager.xml file to +manager.xml) in the NetBeans distribution.
Comment 7 bdpdx 2013-12-05 05:47:19 UTC
It seems I spoke too soon with my previous comment.  Changing manager.xml to +manager.xml does properly control the load order but because of the fact that Tomcat assigns the context path from the deployment descriptor filename the manager then lives at /+manager/ which breaks debugging.  The Context path attribute is unfortunately ignored in a deployment descriptor.  Maybe I should file a bug on that, using the filename to both name the webapp *and* control the load order as Tomcat does currently is really asking too much.  The filename should be allowed to control load order while the Context path should still be assignable by an administrator.

The thing I'll try next is to rename all my webapps to something alphabetically behind "manager".  Not the best solution.