It's all about the answers!

Ask a question

How to add a file in a workspace on a serverside extension


Marco Gianfico (1048) | asked Sep 16 '14, 10:57 a.m.
When I try

ICommitParameter parm = ICommitParameter.FACTORY
                                        .create(newTempChangeSet);
                                parm.addItemToSave(modifiedFile);
                                this.getScmService().batchCommit(
                                        newTempWorkspace,
                                        new ICommitParameter[] { parm }, null,
                                        null, null);

I get a permission denied in runtime
CRRTC5039E: User TestJazzAdmin1 is not allowed to access content ufHTZpnvOvKZ4jXDqElY7bHCt_f4Qdf2L4EeV_ESMks

It's possible to grant myself the permission or is there another possibility to check in the file on the workspace?

Thanks in advance

Comments
Remy Suen commented Sep 16 '14, 11:06 a.m.

What's the full stacktrace of your error?


Marco Gianfico commented Sep 16 '14, 11:42 a.m.

no stacktrace. simply he does not complete the commit, infact if I try to print something in the console it just not appear.
Just on the rtc client, that have configured the follow up actions, appears

Problem
Permission denied during "newplugin".

CRRTC5039E: User TestJazzAdmin1 is not allowed to access content IyPRg4lYKg8uNO9Rv6B3OVAAg6ofLs4rkg6HrQveW6g


Marco Gianfico commented Sep 16 '14, 11:46 a.m. | edited Sep 16 '14, 11:46 a.m.

and the save operation is not completed


Remy Suen commented Sep 16 '14, 11:47 a.m.
  1. How are you testing? Are you launching Jetty manually from Eclipse?

  2. What's in your ccm.log file?

Marco Gianfico commented Sep 16 '14, 11:51 a.m.

yes I'm using jetty, where i can find my ccm log file?


Remy Suen commented Sep 16 '14, 11:53 a.m.

If you're launching Jetty then why don't you just put a breakpoint in VersionedContentService's two checkPermissions(*) methods and wait for it to get hit and debug that way?


Marco Gianfico commented Sep 16 '14, 12:06 p.m.

i will do it, i'll let you know, thanks


Marco Gianfico commented Sep 17 '14, 6:46 a.m.

I found that the problem is in OperationAdviceManager.runParticipant(...)
he catch the exception after this try

try {
            monitor.subTask(NLS.bind(Messages.getCommonString("OperationAdviceManager.40"), participantReport.getName())); //$NON-NLS-1$
            participant.run(operation, participantConfig, problemCollector, monitor);
        } catch (PermissionDeniedException e) {
appendError(participantReport, Messages.getCommonString("OperationAdviceManager.41"), NLS.bind(Messages.getCommonString("OperationAdviceManager.42"), participantReport.getName(), getExceptionMessage(e)), null, IParticipantInfoCollector.ID_EXCEPTION_PROBLEM, e); //$NON-NLS-1$ //$NON-NLS-2$
        }

But unfortunately this behavior give me no clue about how to solve the problem.
Do you have any idea?



Remy Suen commented Sep 17 '14, 7:51 a.m.

Did you climb backwards up the stack trace to see where the exception is coming from? I thought you were going to put breakpoints in the two checkPermissions(*) methods in VersionedContentService?


Marco Gianfico commented Sep 17 '14, 8:31 a.m.

There isn't any stacktrace shown in the eclipse console. I've put the breakpoints in the checkpermission methods but the debugger run through the checkpermission step by step without finding any problem. Now i've put a breakpoint in the PermissionDeniedException class to access the stacktrace through the class variable but the stacktrace is null.


Pheraps something happens in the participant.run(...), i will try to get a spot there.


Remy Suen commented Sep 17 '14, 8:37 a.m.

Put a breakpoint where the 'catch' block is and when the exception is caught force the stack trace to be printed then.

Alternatively, put breakpoints in PermissionDeniedException's constructors as you seem to have done already and see when and how it is created. You could just walk up the thread stack that way.

Also, how did you store the content?


Marco Gianfico commented Sep 17 '14, 8:57 a.m.

 i store the content using ServerVersionedContentService.storeContentNoProperties.
Then I create The file content through FilesystemFactory and use it set methods to set hash, size, encoding and delimiter.
then i get a workingcopy of the file that i want to modify and do
modifiedFile.setContent(myContent)


Marco Gianfico commented Sep 17 '14, 11:32 a.m.

Reading around on the internet i'm beginning to believe that the problem is that the content is unclaimed for a too long time. But i'm wondering, when a content is claimed? It isn't when I do fileitem.setcontent(filecontent)?


Remy Suen commented Sep 17 '14, 1:55 p.m.

I think you should continue trying to figure out the complete stack trace. We will not know for sure that we are looking at the right things until we have a stack trace that shows the source of the PermissionDeniedException.

I would have expected the content to be claimed when it was uploaded. There should be an entry in the SCM.CONTENT_CLAIMER (the exact name may differ on your system) for your hash.

showing 5 of 14 show 9 more comments

One answer



permanent link
Marco Gianfico (1048) | answered Sep 18 '14, 12:10 p.m.
com.ibm.team.repository.common.PermissionDeniedException: CRRTC5039E: User TestJazzAdmin1 is not allowed to access content T2NdHO3CICH6F9Y6x4y-VG5QAGwMifH1Yn3JX9Lxnzc
    at com.ibm.team.scm.service.internal.content.VersionedContentService.validateUploadedContentBatch(VersionedContentService.java:3961)
    at com.ibm.team.scm.service.internal.content.VersionedContentService.validateNewlyUploadedContent(VersionedContentService.java:3901)
    at com.ibm.team.scm.service.internal.content.VersionedContentService.checkAndFinalizeContentReferences(VersionedContentService.java:3855)
    at com.ibm.team.scm.service.internal.ScmServiceInternal.internalSaveVersionables(ScmServiceInternal.java:1695)
    at com.ibm.team.scm.service.internal.operations.commit.CommitOperation.saveVersionables(CommitOperation.java:556)
    at com.ibm.team.scm.service.internal.operations.commit.CommitOperation.initializeSaves(CommitOperation.java:1520)
    at com.ibm.team.scm.service.internal.operations.commit.CommitOperation.initialize(CommitOperation.java:617)
    at com.ibm.team.scm.service.internal.operations.commit.CommitOperation.run(CommitOperation.java:295)
    at com.ibm.team.scm.service.internal.ScmService$22.run(ScmService.java:1206)
    at com.ibm.team.scm.service.internal.AbstractScmService$3.run(AbstractScmService.java:596)
    at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:347)
    at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:271)
    at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:96)
    at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
    at com.sun.proxy.$Proxy126.runInTransaction(Unknown Source)
    at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:45)
    at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
    at com.sun.proxy.$Proxy380.runInTransaction(Unknown Source)
    at com.ibm.team.scm.service.internal.AbstractScmService.runInTransaction(AbstractScmService.java:346)
    at com.ibm.team.scm.service.internal.AbstractScmService.runInTransaction(AbstractScmService.java:587)
    at com.ibm.team.scm.service.internal.ScmService.batchCommit(ScmService.java:1128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347)
    at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
    at com.sun.proxy.$Proxy768.batchCommit(Unknown Source)
    at net.jazz.rtcext.workitem.extensions.service.MyPlugin.deliverVersionedSqlScriptOnWorkItemSave(MyPlugin.java:415)
    at net.jazz.rtcext.workitem.extensions.service.MyPlugin.run(MyPlugin.java:157)


Comments
Marco Gianfico commented Sep 18 '14, 12:11 p.m.

this is the stack trace catched manually. i'm trying to wonder why there is an error in the file content but seems to me to be stored well in the working copy of the old file.


Marco Gianfico commented Sep 19 '14, 9:47 a.m.

following the stack trace with the debug, i've understand that the error begin in VersionedContentService class at line 3919 because the rs variabile has no next and so exit from the while and the hashmap is not cleaned. So at the line 3960 is throwed the permissione denied exception.

So I think that the query ps.executeQuery() (3918) don't give the expected result. But why?

Your answer


Register or to post your answer.