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 202760 - context path is set to a blank string in Maven web applications
Summary: context path is set to a blank string in Maven web applications
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1
Hardware: PC Mac OS X
: P1 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-27 22:15 UTC by athompson
Modified: 2011-10-10 21:58 UTC (History)
5 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 athompson 2011-09-27 22:15:43 UTC
1. create a new maven web application
2. open the project properties and go to the "Run" page
3. specify a server (I use Tomcat)
4. specify a context path or leave the generated one
5! click OK.  The created "context.xml" looks like this (note the context path is blank instead of what was specified):

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path=""/>

If you go back into project properties and specify the context path a second time it will then be remembered.  This is a P1 because of the potential for data loss (which happened to me).  If you deploy this project to a server, it will overwrite the root context (at least it does on Tomcat).  If you don't have a copy of what was there and you can't build it, you're hosed.
Comment 1 Jiri Skrivanek 2011-09-29 07:37:17 UTC
It is almost a duplicate of bug 202662. But I tried it also with GlassFish and if I set context path the first time after project creation, it is lost. So I expect fixes will be needed both in maven project and tomcat server plugin.
Comment 2 Marian Mirilovic 2011-09-29 12:28:20 UTC
not a stopper for NB 7.1 Beta
Comment 3 athompson 2011-09-29 14:52:19 UTC
Sounds pretty identical to bug #202662
Comment 4 David Konecny 2011-09-29 19:35:22 UTC
*** Bug 202662 has been marked as a duplicate of this bug. ***
Comment 5 David Konecny 2011-09-29 22:02:40 UTC
This is a synchronization issue which has been in the code for a while just constalation was not right for it to get triggered. During debugging this problem never happened. 

Fixed in web-main #edadd265e514.

There were two problems. One was that when WebRunCustomizerPanel is changing server (hackModuleServerChange()) it was done in ProjectManager.mutex().postReadRequest but web context value update was not and therefore occured (sometimes) too early (before server was changed in project lookup). Second change is in POHImpl.obtainServerIds which was too complicated (for some reason) and read two properties from two different places (one is stored in pom.xml and second in auxiliary properties somewhere in userdirectory). And again depending on timing new value of serverID property (from pom.xml) would not be available yet. The thing is that serverID property is actually less important that serverInstanceID property (stored via AuxProperties) so I changed the code to read that one first and everything seems to be working correctly now.
Comment 6 Quality Engineering 2011-09-30 14:40:58 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/edadd265e514
User: David Konecny <dkonecny@netbeans.org>
Log: #202760 - context path is set to a blank string in Maven web applications
Comment 7 athompson 2011-10-10 21:58:28 UTC
yup.