I am trying to automate ClearCase, so I can do automatic building. The first step is to update a view by script. I am trying this with the following Java code:
StpProvider provider = (StpProvider) ProviderFactory.createProvider(
CcProvider.NETWORK_PROVIDER_CLASS, callback);
provider.setServerUrl("https://...");
CcProvider m_provider = provider.ccProvider();
m_provider.registerTrustManagerCallback(callback);
File viewRoot = new File("D:\\Views\\...");
StpLocation viewLocation = provider.filePathLocation(StpProvider.Domain.CLEAR_CASE, viewRoot);
//Get instance of CcView that represents the CCRC view.
CcView view = m_provider.ccView(viewLocation);
//Options while updating view
CcFile.RefreshFlag[] refreshFlags = new CcFile.RefreshFlag[1];
refreshFlags[0] = CcFile.RefreshFlag.KEEP_HIJACKS;
PropertyRequestItem.PropertyRequest properties = new PropertyRequestItem.PropertyRequest(CcView.DISPLAY_NAME, CcView.CONFIG_SPEC);
view.doRefresh(refreshFlags, properties);
MyCallback is just a simple Implementation of Callback and CcTrustManagerCallback, with no extra logic to it. I get the following error:
Exception in thread "main" CcException: CRMAP7009: Der Befehl "Update" ist fehlgeschlagen:
CCRC WAN Server: Error: Unable to get view handle.
Fehler: "java.io.IOException: Status(1001:hasNonOkMsg):
CCRC WAN Server: Error: Unable to get view handle.
"
reason: conflict
resource: view: cc.file:D:/Views/...
at com.ibm.rational.stp.client.internal.cc.Util.ccrcCmdStatusToWvcmException(Util.java:296)
at com.ibm.rational.stp.client.internal.cc.Util.runCommandAndCheckResults(Util.java:160)
at com.ibm.rational.stp.client.internal.cc.WebViewRefresh.run(WebViewRefresh.java:233)
at com.ibm.rational.stp.client.internal.cc.CcFileImpl.doCcRefresh(CcFileImpl.java:392)
at com.ibm.rational.stp.client.internal.cc.CcFileImpl.doRefresh(CcFileImpl.java:381)
at cc.UpdateView.main(UpdateView.java:45)
Does anyone know how to resolve this conflict ? ClearTeam Explorer is working, I am manually updating via the Eclipse plugin. ClearCase Version 9.0.1.4 and ClearTeam Explorer Version Version: 9.0.1.08. Using Java 8.
Finally solved the problem, thank you @Abra for your responses. But the problem was only that I had to set the PRIMARY_GROUP to the correct group.
If you have an error like this, first check out if CC operations with ClearTeamExplorer or normal ClearCase work and then check out how it is configured and make sure to have the same settings for the CLI.