Velir / akamai-ccu-rest-api-connector

15 stars 12 forks source link

Error thrown - Unauthorized #10

Closed ajaygates closed 6 years ago

ajaygates commented 6 years ago

Hi, I get below error in the AEM error.log, however akamai.log does not show any error , its just shows akmaiFlushitemjob got triggered. Is this due to Akmai credentials or something else?


error.log
02.05.2018 10:14:07.017 *ERROR* [sling-threadpool-fb65b105-8ab0-4cc9-8ea3-0d3b4b4e7a81-(apache-sling-job-thread-pool)-83-Akamai Job Queue(com/velir/aem/akamai/ccu/impl/FlushAkamaiItemsJob)] org.apache.sling.event.impl.jobs.queues.JobQueueImpl.Akamai Job Queue Unhandled error occured in job processor groovyx.net.http.HttpResponseException: Unauthorized while processing job Sling Job [topic=com/velir/aem/akamai/ccu/impl/FlushAkamaiItemsJob, id=2018/5/2/10/14/25f69561-fd65-46fd-8c44-447927a7c3f9_14, properties=slingevent:application=25f69561-fd65-46fd-8c44-447927a7c3f9,jcr:created=java.util.GregorianCalendar(Wed May 02 10:14:05 CDT 2018),slingevent:created=java.util.GregorianCalendar(Wed May 02 10:14:05 CDT 2018),event.job.queuename=Akamai Job Queue,event.job.queued.time=java.util.GregorianCalendar(Wed May 02 10:14:05 CDT 2018),jcr:createdBy=sling-event,sling:resourceType=slingevent:Job,event.job.application=25f69561-fd65-46fd-8c44-447927a7c3f9,event.job.retries=3,event.job.started.time=java.util.GregorianCalendar(Wed May 02 10:14:05 CDT 2018),paths=[/content/dam/test/Jellyfish.jpg],jcr:primaryType=slingevent:Job,event.job.retrycount=0,:sling:jobs:asynchandler=org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper$1@5b6d19]
java.util.concurrent.ExecutionException: groovyx.net.http.HttpResponseException: Unauthorized
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at java_util_concurrent_Future$get.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
    at com.velir.aem.akamai.ccu.impl.CcuManagerImpl.fastPurge(CcuManagerImpl.groovy:191)
    at com.velir.aem.akamai.ccu.CcuManager$fastPurge$0.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:190)
    at com.velir.aem.akamai.ccu.impl.CcuManagerImpl.fastPurge(CcuManagerImpl.groovy:179)
    at com.velir.aem.akamai.ccu.CcuManager$fastPurge.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at com.velir.aem.akamai.ccu.impl.FlushAkamaiItemsJob.purge(FlushAkamaiItemsJob.groovy:59)
    at com.velir.aem.akamai.ccu.impl.FlushAkamaiItemsJob.this$2$purge(FlushAkamaiItemsJob.groovy)
    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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
    at com.velir.aem.akamai.ccu.impl.FlushAkamaiItemsJob.process(FlushAkamaiItemsJob.groovy:52)
    at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)
    at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)
    at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)
    at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: groovyx.net.http.HttpResponseException: Unauthorized
kairas commented 6 years ago

Have you configured the CCU Manager?

Configuration Each of these classes can be configured to fit you need and your Akamai credentials. In your JCR repository under /apps/your_app/config.author/ you can add the following configuration files:

CcuManagerImpl: com.velir.aem.akamai.ccu.impl.CcuManagerImpl.xml <?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="sling:OsgiConfig" rootCcuUrl="https://api.ccu.akamai.com" clientToken="your_clientSecret" clientSecret="your_clientSecret" accessToken="your_accessToken" defaultPurgeAction="remove" defaultPurgeDomain="production" threadPoolSize="5"/> For more info on credentials see https://developer.akamai.com/introduction/Prov_Creds.html

ajaygates commented 6 years ago

Yes , I have configured the required info & I can see the akmai log with job triggered. But this error is there in the error log

ajaygates commented 6 years ago

I got this issue resolved. Akamai credentials were causing this. Its working fine after using a new set of credentials. Thank you kairas.