Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Uploading an attachment using Plain Java API does not work with Jazz version 7.0.2

Hello everyone,


I am trying to upload an attachment to a work item in Jazz via Plain Java API.

For Jazz version 7.0 this works just fine. Recently the server was upgraded to version 7.0.2 and the same code that worked before now is throwing an error (see below). I've tested also the code for downloading the attachments and it seems to be working for both versions.

Do you have any information about this issue?

Thank you,
Ana


Error message:
[Test worker] ERROR com.ibm.team.process.common - CRJAZ2675I A client action caused the server exception that is listed below. The identifier for the error is 4f5c183a-9b72-407c-86a5-56c8c51d7f54.
java.lang.IllegalArgumentException: Item id and State id must not be null
CRJAZ2796E Details about the error were written to the server log file. To find this data, search the log file for this identifier: E56CBD90FF0545D32B01B3AD554CF84CA523212C.
at com.ibm.team.repository.common.internal.marshal.util.MarshallerUtil.decodeExceptions(MarshallerUtil.java:377)
at com.ibm.team.repository.common.internal.marshal.util.MarshallerUtil.decodeExceptions(MarshallerUtil.java:347)
at com.ibm.team.repository.common.internal.marshal.util.MarshallerUtil.decodeFault(MarshallerUtil.java:312)
at com.ibm.team.repository.transport.client.RemoteTeamService.constructExceptionFromFault(RemoteTeamService.java:716)
at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:559)
at com.ibm.team.repository.transport.client.RemoteTeamService.invoke(RemoteTeamService.java:202)
at com.ibm.team.repository.transport.client.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:43)
at com.sun.proxy.$Proxy68.save(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:254)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:110)
at com.sun.proxy.$Proxy68.save(Unknown Source)
at com.ibm.team.workitem.client.internal.WorkItemSaveTransport$1.run(WorkItemSaveTransport.java:33)
at com.ibm.team.repository.client.internal.TeamRepository$3.run(TeamRepository.java:1355)
at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:79)
at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1350)
at com.ibm.team.workitem.client.internal.WorkItemSaveTransport.call(WorkItemSaveTransport.java:30)
at com.ibm.team.workitem.client.internal.WorkItemSaveRunnable.run(WorkItemSaveRunnable.java:37)
at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.runRunnable(OperationAdviceManager.java:1504)
at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.execute(OperationAdviceManager.java:209)
at com.ibm.team.process.internal.client.ProcessClientService.execute(ProcessClientService.java:774)
at com.ibm.team.workitem.client.internal.WorkItemClient.save(WorkItemClient.java:577)
at com.ibm.team.workitem.client.internal.WorkItemClient.save(WorkItemClient.java:565)
at com.ibm.team.workitem.common.internal.WorkItemCommon.internalSaveAuditables(WorkItemCommon.java:1348)
at com.ibm.team.workitem.common.internal.WorkItemCommon.internalSaveAuditables(WorkItemCommon.java:1333)
at com.ibm.team.workitem.common.internal.WorkItemCommon.saveAuditables(WorkItemCommon.java:1325)
at com.ibm.team.workitem.common.internal.WorkItemCommon.saveAuditable(WorkItemCommon.java:1315)
at com.ibm.team.workitem.common.internal.WorkItemCommon.saveAttachment(WorkItemCommon.java:1058)
at com.ibm.team.workitem.client.internal.WorkItemClient.createAttachment(WorkItemClient.java:534)

0 votes


Accepted answer

Permanent link
I had this exact same bug a few weeks ago.

I bet you have an earlier version of the Plain Java Client libraries - make sure you are using the 7.0.2 release and the issue will go away

It's a problem with n-1 compatibility between 7.0.1 clients and 7.0.2 servers - in my case it caused errors while using the Eclipse import wizard when importing Bugzilla items that had attachments
Ralph Schoon selected this answer as the correct answer

1 vote


3 other answers

Permanent link
I used the old code that went up into the blog you refer to with Java 8, the Plain Java Client Libraries for 7.0.2, and it works without a problem.

Code base on that went into WCL. You could try that as well.https://github.com/jazz-community/work-item-command-line

I used this code with the ModifyWorkItemUploadAttachmentOperation:
        WorkItemUploadAttachmentModification operation = new WorkItemUploadAttachmentModification(
                "TestAttachment.txt", IContent.CONTENT_TYPE_TEXT,
                IContent.ENCODING_UTF_8);
        operation.run(workItem, null);

        WorkItemUploadAttachmentModification operation1 = new WorkItemUploadAttachmentModification(
                "Test.pdf", IContent.CONTENT_TYPE_UNKNOWN,
                IContent.ENCODING_UTF_8);
        operation1.run(workItem, null);


0 votes

Comments

Hello Ralph,


Thanks for your quick response.

If it works for you, then most probably I'm missing an dependency. I will investigate more.
For the Java Client Libraries do you use the jars in the libs folder or the dependencies in build.gradle? Because if you use the dependencies, it might be easier for me to see which one is missing.

Thanks,
Ana

I use dependencies to the Plain Java Client Libraries. I download these from Jazz.net and add them to the classpath. I do not use Gradle and in my case, the code was run from within an Eclipse client.


I doubt you have an issue with dependencies however. You get an java.lang.IllegalArgumentException: Item id and State id must not be null .

Maybe somehow the information about the work item gets lost? I do not know, sorry. I would suggest to test against a test system if you have one, against a different project area etc. I am not sure how to approach this and where the issue may be. I can only say, that my code works for me.


Permanent link

The client-side exception as posted doesn't have enough information to tell what went wrong on the server. It does say: "Details about the error were written to the server log file. To find this data, search the log file for this identifier: E56CBD90FF0545D32B01B3AD554CF84CA523212C.".
Go to the server log and paste the server exception here, then I'm sure we can help out further.

0 votes


Permanent link

@Davyd Norris is right. We upgraded ELM from 7.0.1 to 7.0.3. After upgrade, uploading attachments with Plain Java API Client stopped working with 'java.lang.IllegalArgumentException: Item id and State id must not be null'. Using Plain Java API 7.0.3 instead of 7.0.1 helps.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 411
× 169

Question asked: May 26 '21, 8:48 a.m.

Question was seen: 2,644 times

Last updated: Apr 25, 2:48 a.m.

Confirmation Cancel Confirm