It's all about the answers!

Ask a question

Problem with webUi when Attach a file in a work item


Andrea Ianni (1611916) | asked Nov 19 '10, 12:07 p.m.
Hi all,
when I try to attach a file in an existing work item, I found this error in log file:

ERROR com.ibm.team.process.common                         - com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem

java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem
at com.ibm.rational.rtc.docreview.OpenDocDefect.run(OpenDocDefect.java:54)
at sun.reflect.GeneratedMethodAccessor373.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy355.run(Unknown Source)
at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.runParticipant(OperationAdviceManager.java:1048)
at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.runParticipants(OperationAdviceManager.java:907)
at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.advise(OperationAdviceManager.java:290)
at com.ibm.team.process.internal.common.util.AbstractProcess.doAdvise(AbstractProcess.java:181)
at com.ibm.team.process.internal.service.ServerProcess.access$1(ServerProcess.java:1)
at com.ibm.team.process.internal.service.ServerProcess$2.run(ServerProcess.java:132)
at com.ibm.team.repository.service.internal.TransactionService$1.run(TransactionService.java:104)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:320)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:244)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:79)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:68)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy72.runInTransaction(Unknown Source)
at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:3361)
at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:3368)
at com.ibm.team.process.internal.service.ServerProcess.adviseAndExecute(ServerProcess.java:130)
at com.ibm.team.workitem.service.internal.AuditableServerProcess.adviseAndExecute(AuditableServerProcess.java:82)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.processSave(WorkItemRepositoryService.java:419)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.save(WorkItemRepositoryService.java:383)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.save(WorkItemRepositoryService.java:351)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.access$3(WorkItemRepositoryService.java:347)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService$1.run(WorkItemRepositoryService.java:230)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService$1.run(WorkItemRepositoryService.java:1)
at com.ibm.team.repository.service.internal.TransactionService$1.run(TransactionService.java:104)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:466)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$1.run(RepositoryDatabase.java:292)
at com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentConnection(ConnectionPoolService.java:331)
at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy30.withCurrentConnection(Unknown Source)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:286)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:244)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:79)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:68)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy72.runInTransaction(Unknown Source)
at com.ibm.team.repository.service.AbstractService.runInTransaction(AbstractService.java:772)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.saveTransaction(WorkItemRepositoryService.java:250)
at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.save(WorkItemRepositoryService.java:177)
at sun.reflect.GeneratedMethodAccessor321.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy252.save(Unknown Source)
at com.ibm.team.workitem.service.internal.WorkItemServer.save(WorkItemServer.java:229)
at com.ibm.team.workitem.common.internal.WorkItemCommon.internalSaveAuditables(WorkItemCommon.java:1129)
at com.ibm.team.workitem.common.internal.WorkItemCommon.saveAttachment(WorkItemCommon.java:900)
at com.ibm.team.workitem.service.internal.rest.AttachmentRestService.saveAttachment(AttachmentRestService.java:759)
at com.ibm.team.workitem.service.internal.rest.AttachmentRestService.uploadPart(AttachmentRestService.java:452)
at com.ibm.team.workitem.service.internal.rest.AttachmentRestService.perform_POST(AttachmentRestService.java:301)
at com.ibm.team.repository.service.TeamRawService.service(TeamRawService.java:90)
at sun.reflect.GeneratedMethodAccessor461.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy250.service(Unknown Source)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.doRestService(AbstractTeamServerServlet.java:879)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest2(AbstractTeamServerServlet.java:1749)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest(AbstractTeamServerServlet.java:1623)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.service(AbstractTeamServerServlet.java:1536)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:121)
at com.ibm.team.repository.server.servletbridge.JazzServlet.service(JazzServlet.java:54)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)


OpenDocDefect is a my custom follow-up action that automatically create a new defect when a custom attribute is selected.

I found this error only when I try to attaching a file via WebUI into work item but when I attach a file via RTC Client in the same work item it's all ok.

Any suggestions?

Thanks

Accepted answer


permanent link
Andrea Ianni (1611916) | answered Nov 26 '10, 12:18 p.m.
now works fine. I reworked my follow-up action.

Thanks
Ralph Schoon selected this answer as the correct answer

Comments
Jérôme RAULINE commented Jun 22 '11, 9:31 a.m. | edited Mar 31 '16, 5:56 a.m.

Hi, I've got the same problem with some IBM related class :

java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem

at com.ibm.team.pct.extension.service.BuildOnStateChangeParticipant.run(BuildOnStateChangeParticipant.java:168)

Can you explain what you mean by "reworked" the follow-up action ?


Ralph Schoon commented Mar 31 '16, 6:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Apparently you are using the wrong class/interface in your code. I am unsure why you try to cast an Attachment into a work item (or the other way around). You have to debug your code and find out where that happens and fix it.

See  https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ for how to set up for debugging.

See
https://rsjazz.wordpress.com/2012/08/01/uploading-attachments-to-work-items/
https://rsjazz.wordpress.com/2012/09/21/downloading-attachments-from-work-items/

for the attachment API.

One other answer



permanent link
Stefan Oblinger (185213) | answered Jan 16 '17, 1:20 p.m.

In my opinion this is a Defect of the Web UI, because no "Save Work Item" follow-up action should be invoked before a Work Item is actually getting saved. However this is the case when Work Items are associated to a Team Area.

How to reproduce? (Tested with RTC 6.0.2)

  1. Set up the "RTC Extensions Workshop" according to the documentation.
  2. Import "Build On State Change" Plugin projects from Lab2Code.zip.
  3. Startup the Jetty Server, logon to Web UI as TestJazzAdmin1.
  4. Create a Project Area from "Scrum Template".
  5. Add TestJazzAdmin1 as Project Area member with "Project Owner" role.
  6. Create a Team Area named "Team".
  7. Create two Categories:
    "Cat1" associated to the Project Area
    "Cat2" associated with "Team"
  8. Add "Build on State Change" follow-up action to "Save Work Item" operation of "Everyone (default)".
  9. Explore Project and create a Task WI for "Cat2" category. Save the task.
  10. In the Web UI switch to the "Links" tab and try to add an attachment to the task.
    => UI shows error message: "'Save Work Item' failed".
    => Console contains following error message:
    17:35:08,343 [655632148@qtp-979581539-17 @@ 17:34 TestJazzAdmin1 <Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0; Firefox 45.6.0 - 11712-1502020039-1.33@0:0:0:0:0:0:0:1> /jazz/service/com.ibm.team.workitem.service.internal.rest.IAttachmentRestService/] ERROR com.ibm.team.process.common                         - com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem
            
    java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem
            
    at net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant.run(BuildOnStateChangeParticipant.java:114
            
  11. Change category of the task to "Cat1". Save the task.
  12. Try to add an attachment to the task via Web UI.
    => Adding of attachment succeeds (since "Save Work Item" follow-up action is not getting invoked).

A work around can be implemented in the Participant code. For the "Build On State Change" example of the Extension Workshop this would mean to validate the class returned by saveParameter.getNewState() in line 114 of BuildOnStateChangeParticipant.java.


Comments
Ralph Schoon commented Jan 17 '17, 2:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I tend to agree, please file a defect here: https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWelcome


This means you currently have to protect any cast from the save parameter data.


Ralph Schoon commented Feb 17 '17, 3:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Consider using the fix explained here: https://jazz.net/forum/questions/109930/urgent-problem-attaching-a-file-in-a-workitem-web-page


Here a work around:


if (data instanceof ISaveParameter) {
saveParameter = (ISaveParameter) data;
// Fix avoid web ui attachment upload bug
if (saveParameter.getNewState() instanceof IAttachment) {
return; 
}



Your answer


Register or 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.