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.
1. Create a web application against GF v3, set the context path to empty string. sun-web.xml is generated correctly with empty context root element: <context-root/> 2. Deploy the application Application will be deployed with context path corresponding to the application directory name, not with empty context path.
please look at this to see if there is an obvious fix.
I'm pretty sure this is a bug. What is unclear is if it is a NB V3 plugin bug or a GlassFish bug. When the context-root field is present and empty (e.g. <context-root/>) in sun-web.xml, GlassFish does *not* deploy the application at the root context. It is deployed at the default context (e.g. the name of the application). I will ask the GF team is this intended behavior. Since sun-web.xml is a proprietary descriptor, it is not a spec violation to do this. I was able to deploy a web application at root context by specifying "context-root=<blank>" with the deploy command and this may be the intended way to make this work in which case, this is a bug in the V3 plugin. In fact, I think I will update the V3 plugin to do this automatically regardless.
Sorry Nitya... Petr had emailed the list and I'd already said I'd look at it. You're welcome to fix it if you like. I haven't changed anything yet.
Pinged the server team regarding this, the v3 server behavior is: - If you specify an empty element in deployment descriptor, that element is skipped and as if there is no context root was provided and the application is deployed to the default context (e.g. the name of the application). To deploy to root context, the deploy command will need to specify context-root="" or context-root="/"
Confirmed, I am able to deploy to empty context path by manually changing context-root in sun-web.xml to: <context-root>/</context-root>
That's right. But the 'Context Path' field in the project properties -> Run dialog does not accept '/' as a valid value. So an empty Context Path field causes an empty context root (<context-root/>) in sun-web.xml Like Peter suggested, I think the best option would be to update the plugin deploy command to pass the value of the context root when empty as context-root="", so v3 will deploy the webapp at the root context.
Fix in web-main repo. Waiting on build. http://hg.netbeans.org/web-main/rev/90d0d3d8570e
Mark as fixed. See above for changeset
I can still reproduce in build web-main 1678 + GF build 65, using the original steps. If I understand correctly, are you saying that there is no way to specify in sun-web.xml that the path should be empty? That sounds like a server bug to me: if I specify a non-empty path in sun-web.xml and then deploy the app using asadmin without the --contextroot parameter, then the value in sun-web.xml is honored. So it should be honored also when path in sun-web.xml is empty.
There is a way to specify the root context... <context-root>/</context-root> The IDE does not let us enter '/' in the text field that would become that value... regarding... > if I specify a non-empty path in sun-web.xml and then deploy the app using asadmin > without the --contextroot parameter, then the value in sun-web.xml is honored. So > it should be honored also when path in sun-web.xml is empty. Difference in perspective... the server team assumes that if you do not specify the context-root the app should be deployed in a way which will produce success not failure.... For example: take two apps that you 'found' on the internet, without a sun-web.xml file in them and you want to try them out. So, you deploy them... asadmin deploy a.war asadmin deploy b.war By assigning the two war files to a default context root, instead of '/', both will deploy. If the server assigned 'undefined' apps to '/', the second app would not deploy.
> There is a way to specify the root context... > <context-root>/</context-root> That's good to hear, although it did not work well for me today in b65. > The IDE does not let us enter '/' in the text field that would become that value... Which is consistent with the "context path" description in section 3.5 of the servlet 3.0 spec. The project properties dialog uses the convention set forth by the spec. sun-web.xml uses a different convention, which is fine - but there should be some mechanism which translates between the two ways. I would suggest that upon receiving "" from the project, the plugin should just write "/" to sun-web.xml. Analogously for returning the value - when the project asks for context root value, and sun-web.xml contains "/", the plugin should return "". (Currently it returns "/", which is then displayed in project properties - which is a bug.) Would this work?
thanks for the clarification on the 'meaning' of the field in the property dialog. I know I never made that connection while working in that area of the plugin.
> I would suggest that upon receiving "" from the project, the plugin should just write "/" to sun-web.xml. > Analogously for returning the value - when the project asks for contextroot value, and sun-web.xml contains "/" > the plugin should return "". This would work but may cause some confusion. Since generally for non-null values, the sun-web.xml context-root reflects that provided in the project properties. Also, in this scenario, wouldn't the user need to be explicitly prevented from entering empty context root in the sun-web.xml editor? I have corrected the original fix wherein the deploy command handles passing in "/" so v3 will deploy the webapp at root context.
Integrated into 'main-golden', will be available in build *200909251401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/90d0d3d8570e User: nityad@netbeans.org Log: #170248 : Fix for webapp with empty context path to deploy to root context
Integrated into 'main-golden', will be available in build *200909270201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/079099229773 User: nityad@netbeans.org Log: #170248 : Handle webapp with empty context path
Fixed, tested nightly 0927 Created webapp with empty context path. sun-web.xml has empty context root element <context-root/> On deploy, webapp is now deployed to root context
Thanks, works fine for me now. Though I still think the behavior is not ideal - I filed a new issue 173356 (P3) and issue 173359 (P4).