Bug 234871 - Workbench has not been created yet error in cmdline Ant
Summary: Workbench has not been created yet error in cmdline Ant
Status: CLOSED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.0 RC4   Edit
Assignee: Andrew Mak CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard: PMC_approved
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-05-30 11:17 EDT by Andrew Mak CLA
Modified: 2008-06-11 17:50 EDT (History)
4 users (show)

See Also:
david_williams: pmc_approved+
raghunathan.srinivasan: pmc_approved+
kathy: pmc_approved? (naci.dai)
kathy: pmc_approved? (deboer)
neil.hauge: pmc_approved+
kathy: pmc_approved? (kaloyan)


Attachments
patch (2.07 KB, patch)
2008-05-30 15:04 EDT, Andrew Mak CLA
makandre: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Mak CLA 2008-05-30 11:17:25 EDT
I'm using cmdline ant task to create a Web service client.  It fails with the message "Workbench has not been created yet."  After a lot of poking around, it turns out the problem is that my server runtime ID has a typo in it.  The message is way off on what the actual problem is making it very difficult for users to debug this sort of simple typo problems.
Comment 1 Kathy Chan CLA 2008-05-30 11:23:24 EDT
Andrew, please investigate what it takes to fix this problem.  Tentatively keeping in WTP 3.0.
Comment 2 Andrew Mak CLA 2008-05-30 15:04:59 EDT
Created attachment 102936 [details]
patch

The util method WebServiceRuntimeExtensionUtils2.getServerLabelById() is called in the flow of the ant task, however, this method goes thru ServerUICore to retrieve a label for the server, and fails if the workbench is not running.

I suspect that this error has been around for some time, but previously it simply fails as "An unexpected error has occurred".  Recently we improved the error reporting in the ant generation which is why this error message shows up now.

My fix will add a check for PlatformUI.isWorkbenchRunning() to guard against calling ServerUICore when in the ant case.
Comment 3 Andrew Mak CLA 2008-05-30 16:15:04 EDT
Just to summarize, before this patch, if the users makes a typo in the server ID in the ant properties file, the error they will get when running ant task generation is:

    [wsgen] IWAB0014E Unexpected exception occurred.

BUILD FAILED
D:\WTP\workspaces\workspace\Ant\ant\axis_tdjava.xml:10: Workbench has not been created yet.

This message does not give the user any indication what the real problem is.  The error in .log does not help either.


With this patch, the correct message will be displayed.  It has clear instructions to the user on how to fix the problem:

    [wsgen] Tomcat v5.0 Server is not installed. Go to Window > Preferences. Select Server > Runtime Environments and configure a server runtime.

BUILD FAILED
D:\WTP\workspaces\workspace\Ant\ant\axis_tdjava.xml:10: Tomcat v5.0 Server is not installed. Go to Window > Preferences. Select Server > Runtime Environments and configure a server runtime.


I've tested ant on command line with and without the server ID typo, and tested ant in GUI as well.  Also tested some basic Web service wizard generation scenarios to make sure nothing has regressed.
Comment 4 Kathy Chan CLA 2008-05-30 16:25:47 EDT
Patch reviewed.  

PMC, please approve for WTP 3.0 RC4.  It's a simple fix and solves a usability problem with Web services Ant command.
Comment 5 David Williams CLA 2008-06-01 21:46:23 EDT
This doesn't seem 'major' to me, but I'll approve as long as you confirm this doesn't change dependencies ... I'd guess not, just find it odd that ant-oriented tasks have a dependency on UI components. 

Comment 6 Kathy Chan CLA 2008-06-04 10:33:00 EDT
No, the patch does not change any dependency.  The Ant task is reusing some commands and utilities used by the rest of the wizard.  That's where dependency to ServerUICore has incorrectly sneeked in.  This patch checks to make sure that the workbench is running before calling ServerUICore functions.
Comment 7 Kathy Chan CLA 2008-06-04 22:23:18 EDT
Patch committed and released to WTP 3.0 as v200806050222.
Comment 8 Andrew Mak CLA 2008-06-11 17:50:40 EDT
Verified on wtp-S-3.0RC4-20080611064752.