cancel
Showing results for 
Search instead for 
Did you mean: 

net.sf.acegisecurity.BadCredentialsException: Bad credentials presented

cperez
Champ in-the-making
Champ in-the-making
Hi all!!

I execute a funcion where I need to read the data content of a NodeRef. This function is executed in a java backend class called from a webscript.
I use the same as is explained in https://wiki.alfresco.com/wiki/NodeRef_cookbook#Reading_the_data_content_of_a_NodeRef_.28plain_text....

My code is similar as solutions explained in https://forums.alfresco.com/forum/developer-discussions/repository-services/how-retrieve-actual-cont... but I can't do this working.

This is the java code:
public void readContent(String docId){…// Create nodeRefNodeRef nodeRef = new NodeRef("workspace://SpacesStore/" + docId);try {   ContentReader contentReader = cService.getReader(nodeRef, ContentModel.PROP_CONTENT);   InputStream is = contentReader.getContentInputStream();} catch (Exception e) {   e.printStackTrace();}…}‍‍‍‍‍‍‍‍‍‍‍‍‍‍


this is the definition bean and bean refs:
    <bean id="webscript.mywebscript.post" class="org.alfresco.module.MyModel.webscripts.DesktopForm" parent="webscript">       <property name="contentService">            <ref bean="ContentService" />        </property>        <property name="nodeService">          <ref bean="NodeService" />        </property>        <property name="gconfigs">          <ref bean="generalConfigService" />        </property>    </bean>‍‍‍‍‍‍‍‍‍‍‍‍‍


But I get the next exception when this command is executed
net.sf.acegisecurity.BadCredentialsException: Bad credentials presented        at net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider.getUserFromBackend(DaoAuthenticationProvider.java:393)        at net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider.authenticate(DaoAuthenticationProvider.java:225)        at net.sf.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:159)        at net.sf.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49)        at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:372)        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)        at org.alfresco.repo.model.ml.MLContentInterceptor.invoke(MLContentInterceptor.java:91)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)        at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:275)        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)        at com.sun.proxy.$Proxy31.getReader(Unknown Source)        at org.alfresco.module.myModule.webscripts.EmConAux.signCert(EmConAux.java:538)        at org.alfresco.module.myModule.webscripts.DesktopSign.executeImpl(DesktopSign.java:79)        at org.alfresco.web.scripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:209)        at org.alfresco.web.scripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:223)        at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:70)        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:305)        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:390)        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:273)        at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:261)        at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)        at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)        at java.lang.Thread.run(Thread.java:662)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Can any one tell me how i can take the actual content of the NodeRef object??.

Thanks a lot in advance.
1 REPLY 1

mitpatoliya
Star Collaborator
Star Collaborator
Two things.
First test your code by hard coding nodeRef.check document details page you will see noderef in url use that noderef in code.

NodeRef nodeRef = new NodeRef(noderef);

Then you need to include your code in runaswork block.check this blog. put your code within that block.
http://blog.arvixe.com/alfresco-execute-code-as-system-user/