This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 211474 - Programmatically created dynamic Web project has null context root
Summary: Programmatically created dynamic Web project has null context root
Status: CLOSED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.common (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact: Konstantin Komissarchik CLA
URL:
Whiteboard:
Keywords:
: 211896 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-29 12:30 EST by Kathy Chan CLA
Modified: 2007-12-07 15:02 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kathy Chan CLA 2007-11-29 12:30:59 EST
Driver:  WTP 3.0 11/29 driver.

I created 2 dynamic Web projects (a1 and a1Client) and published to Tomcat 5.5.  Then I created 2 other dynamic Web projects (a2a and a2aClient) and tried to publish them to Tomcat 5.5.  The Web project "a2a" published OK but when I tried to publish "a2aClient", I got:

Could not publish server configuration for Tomcat v5.5 Server at localhost.
  Multiple Contexts have a path of "".

I checked the server view and all 4 Web projects have been added to Tomcat properly.  Server state is "Restart & republish".  I tried to republish manually and restarting server and it still failed with the same error.  I had to remove "a2aClient" and then the server would restart OK.  Once I tried adding back "a2aClient", it would fail again.

I have the workspace where this problem happens.
Comment 1 Larry Isaacs CLA 2007-11-29 14:28:23 EST
Kathy,

Could you provide what the Context Root setting is for each of these projects as indicated on the Web Project Settings page of project properties?  Thanks.

Larry
Comment 2 Kathy Chan CLA 2007-11-29 15:50:35 EST
I isolated the problem a bit more and it's actually a problem with programmatically created dynamic Web project having context root set to "".

In the Web services wizard, we create a project using:

ProjectFacetsManager.create()

and then add the jst.web and the jst.java facets to the project using:

Set actions = getInstallActions(projectFacetVersions);
fproject.modify(actions, shellMonitor);

Starting with WTP 3.0 M3, the dynamic Web project that's created by the Web service project programmatically all have context root set to "".  This is the cause of the problem when trying to publish to Tomcat.

I re-tried the same scenario in WTP 2.0.2.  The context root of dynamic Web project created programmatically is properly set to the name of the dynamic Web project.
Comment 3 Larry Isaacs CLA 2007-11-30 08:26:48 EST
Since we do some similar project creation at SAS, I took a look at this last night.  It appears that the fix for Bug 209268 changed the wst.common.modulecore plugin.xml in a way that broke org.eclipse.wst.common.project.facet.core.internal.FacetedProject.  In FacetedProject.modifyInternal(), it attempts to adapt the config object to an org.eclipse.wst.common.project.facet.core.IActionConfig, which due to the plugin.xml change, now returns null.  This prevents the project name property from being set on the model, and since that is used as the backup value for the "context-root" property, the "context-root" property returns "".
Comment 4 Konstantin Komissarchik CLA 2007-11-30 11:49:11 EST
Larry,

Thanks for looking into this. I think I know what might be root of the problem here. Once I have a fix, what's the easiest way to see if it works?
Comment 5 Larry Isaacs CLA 2007-11-30 12:18:57 EST
I have a development environment in which I can try out changes, either as patches or modified jars.  You can attach to this bug or e-mail me directly.  Thanks.

Larry
Comment 6 Kathy Chan CLA 2007-11-30 13:23:15 EST
Konstantin,

You can easily try it out with a WTP 3.0 driver as well.  In a new workspace,

1. Install a Tomcat runtime.
2. Select Web services -> Web service client.  
3. In the Web service client wizard, select a WSDL file using in the workspace using Browse or paste the following URL in the service definition field:

http://developerdays.com/cgi-bin/tempconverter.exe/wsdl/ITempConverter

4. Click Finish.

It would generate a new dynamic Web projecdt named "WebServiceProject".  Just check the context root of that project.

If you have other Web project in the workspace, just click the Client project link to type in a name for a non-existing Web project.  The wizard will create it for you.
Comment 7 Konstantin Komissarchik CLA 2007-12-04 12:40:38 EST
I have a fix that passes Kathy's test in Comment #6 and will release it shortly.
Comment 8 Kathy Chan CLA 2007-12-04 13:35:20 EST
*** Bug 211896 has been marked as a duplicate of this bug. ***
Comment 9 Konstantin Komissarchik CLA 2007-12-04 18:18:26 EST
Fix released into the 3.0 code stream.
Comment 10 Larry Isaacs CLA 2007-12-06 09:01:11 EST
Thanks Kathy.  I was being dense about how to test.

I was using a web project with a bean and creating a web service and client from that bean.  Using the I20071205140343 WTP build, I have verified that the client project is created with the proper context-root.  I'll leave official verification to Kathy.
Comment 11 Kathy Chan CLA 2007-12-07 10:24:29 EST
Verified on 1206 WTP 3.0 driver.
Comment 12 Kathy Chan CLA 2007-12-07 15:02:13 EST
Closing bug.  Thanks Konstantin.