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

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

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

0 votes

Comments

What's the full stacktrace of your error?

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

and the save operation is not completed

  1. How are you testing? Are you launching Jetty manually from Eclipse?

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

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

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?

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

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?


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?

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.

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?

 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)

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)?

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


4 answers

Permanent link
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)

0 votes

Comments

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.

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?


Permanent link

How did the problem got solved i am facing same issue


0 votes


Permanent link

Please ask your own question and do not answer a 10 year old question.

You would either give the user that runs the code the permission to do what is needed, or you need to runAsAdmin. I think it is com.ibm.team.repository.service.internal.TeamServiceContext.runAsAdmin(ITransactionRunnable<IItemsResponse>) but I could be wrong.

0 votes

Comments

is there any other way to commit a file using Server API by using runAsAdmin it is making userID as ADMIN it is giving me license problem but my user id is TestJazzAdmin1 which has licenses. 

Is this problem specially related to jetty?


Permanent link

is there any other way to commit a file using Server API by using runAsAdmin it is making userID as ADMIN it is giving me license problem but my user id is TestJazzAdmin1 which has licenses. 


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
× 10,938

Question asked: Sep 16 '14, 10:57 a.m.

Question was seen: 3,978 times

Last updated: Nov 04, 5:22 a.m.

Confirmation Cancel Confirm