cancel
Showing results for 
Search instead for 
Did you mean: 

Web Script randomly throws acegisecurity exception

a_band
Champ in-the-making
Champ in-the-making
This is an odd bug that I've come across. I've been using a web script to browse a store and its nodes. The odd thing is that it randomly throws this exception:

net.sf.acegisecurity.AuthenticationCredentialsNotFoundException - A valid SecureContext was not provided in the RequestContext

Sometimes it works, sometimes it doesn't. I found a JIRA ticket that seemed related at: http://issues.alfresco.com/browse/AR-706 but there was no resolution to the ticket so I'm at a loss. Has anyone else ran into this problem before? Is this something that I'm doing wrong?

Here's the error w/ statcktrace and the Web Script definition file. Thanks!

The definition:

<webscript>
  <shortname>Article Browse Sample</shortname>
  <description>Sample demonstrating the listing of the article folder contents</description>
  <url>/articles/findByCategory?category={category}</url>
  <format default="json">any</format>
  <authentication>none</authentication>
  <transaction>none</transaction>

</webscript>




500 Description:    An error inside the HTTP server which prevented it from fulfilling the request.

Message:   Error during processing of the template 'get(children) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.

Exception:   net.sf.acegisecurity.AuthenticationCredentialsNotFoundException - A valid SecureContext was not provided in the RequestContext
   
   net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:477)
   net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:355)
   net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
   org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
   org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   $Proxy2.getChildAssocs(Unknown Source)
   org.alfresco.repo.template.BaseContentNode.getChildren(BaseContentNode.java:286)
   sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
   freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:272)
   freemarker.ext.beans.BeanModel.get(BeanModel.java:183)
   freemarker.core.Dot._getAsTemplateModel(Dot.java:76)
   freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
   freemarker.core.IteratorBlock.accept(IteratorBlock.java:87)
   freemarker.core.Environment.visit(Environment.java:196)
   freemarker.core.MixedContent.accept(MixedContent.java:92)
   freemarker.core.Environment.visit(Environment.java:196)
   freemarker.core.Environment.process(Environment.java:176)
   freemarker.template.Template.process(Template.java:232)
   org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:200)
   org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:392)
   org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:257)
   org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:163)
   org.alfresco.web.scripts.WebScriptRuntime.wrappedExecute(WebScriptRuntime.java:348)
   org.alfresco.web.scripts.WebScriptRuntime.authenticatedExecute(WebScriptRuntime.java:280)
   org.alfresco.web.scripts.WebScriptRuntime.executeScript(WebScriptRuntime.java:151)
   org.alfresco.web.scripts.WebScriptServlet.service(WebScriptServlet.java:106)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
   org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
   org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
   org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
   java.lang.Thread.run(Thread.java:619)
   
Exception:   java.lang.reflect.InvocationTargetException
   
   sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
   
Exception:   freemarker.template.TemplateModelException - get(children) failed on instance of org.alfresco.repo.template.TemplateNode
   
   freemarker.ext.beans.BeanModel.get(BeanModel.java:223)
   
Exception:   org.alfresco.service.cmr.repository.TemplateException - Error during processing of the template 'get(children) failed on instance of org.alfresco.repo.template.TemplateNode'. Please contact your system administrator.
   
   org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:204)
   
Server:   Alfresco Enterprise Network v2.1.0 (112) schema 73
Time:   Oct 30, 2007 10:45:39 AM


2 REPLIES 2

davidc
Star Contributor
Star Contributor
I suspect it's not randomly throwing that exception, but on every request.

The issue is that you've specified <authentication>none</authentication> in your web script definition, but then proceed to attempt to access data in the repository.

To access the repo, you must be authenticated.  So, change none to guest, user or admin.

If you're invoking the Web Script via HTTP and a URL that starts with /alfresco/service, you'll be asked to login.  You can force guest access by adding guest=true as a URL argument.

a_band
Champ in-the-making
Champ in-the-making
thanks, davidc! It was actually happening randomly for some reason but I changed my webscript to authenticate and it worked great.