保存新故事时的ConnectionException

时间:2015-03-25 19:41:45

标签: java sdk versionone

我正在使用VersionOne Java SDK。当我尝试保存新故事时,我得到一个connectionException。知道我做错了吗?

Oid projectId = Oid.fromToken("Scope:2004", _metaModel);
    IAssetType storyType = _metaModel.getAssetType("Story");
    Asset newStory = _services.createNew(storyType, projectId);
    IAttributeDefinition nameAttribute = storyType.getAttributeDefinition("Name");
    IAttributeDefinition ownerNameAttribute = storyType.getAttributeDefinition("Owners");
   newStory.setAttributeValue(nameAttribute, story.getName());        
    _services.save(newStory);

我们得到的例外是:

com.versionone.apiclient.ConnectionException: Error writing to output stream
at com.versionone.apiclient.V1APIConnector.sendData(V1APIConnector.java:235)
at com.versionone.apiclient.Services.save(Services.java:229)
at com.versionone.apiclient.Services.save(Services.java:192)
at com.disney.versionOne.service.VersionOneRepository.add(VersionOneRepository.java:101)
at com.disney.serviceNow.versionOneIntegration.App.integration_test(App.java:142)
at com.disney.serviceNow.versionOneIntegration.App.main(App.java:81)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://fldcvdswa5890/VersionOneRAD/rest-1.v1/Data/Story
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.versionone.apiclient.V1APIConnector.sendData(V1APIConnector.java:226)
... 5 more

1 个答案:

答案 0 :(得分:0)

原来问题是我用来创建故事的项目不再活跃。一旦我使用了正确的项目ID,错误就消失了。