I'm upgrading from 3.0 to 3.2r and the only thing not working is a a Java backed webscript.My webscript class Bloghunter extends PageableWebScript which in turn extends DeclarativeWebscriptHere is an extract from Bloghunter.getResults
SearchParameters sp = new SearchParameters();
sp.addStore(new StoreRef(StoreRef.PROTOCOL_AVM, "someco"));
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("@\\{http\\://www.alfresco.org/alfresco/blog\\}");
sp.setLimit(250);
sp.setLimitBy(LimitBy.FINAL_SIZE);
sp.addSort("@{http://www.alfresco.org/alfresco/blog}created", false);
ResultSet results = null;
List<NodeRef> nodes = null;
try
{
results = serviceRegistry.getSearchService().query(sp);
nodes = results.getNodeRefs();
}
finally
{
if(results != null)
{
results.close();
}
}
logger.info("return nodes()");
return nodes == null ? null : nodes;
The problem seems to be with the sort parameter sp.addSort("@{http://www.alfresco.org/alfresco/blog}created", false);I've tried setSort("created", false, sp);this returned results, but sorted by last modified date and not by the created dateThis used to work in 3.0, I can see that DeclarativeWebscript has changed from 3.0 to 3.2r and wondered would these changes affect my webscript's sort parameter?Extract from my logs
15:55:10,253 User:admin DEBUG [web.scripts.RepositoryContainer] Authentication: authenticated as admin
15:55:10,253 User:admin DEBUG [web.scripts.RepositoryContainer] Begin retry transaction block: required,readwrite
15:55:10,253 User:admin DEBUG [web.scripts.RepositoryContainer] Creating Transactional Response for ReadWrite transaction; buffersize=4096
15:55:10,253 User:admin DEBUG [lucene.index.IndexInfo] Got /var/alfresco32/alf_data/lucene-indexes/avm/someco org.alfresco.repo.search.impl.lucene.index.IndexInfo@68d2d88 for /var/alfresco32/alf_data/lucene-indexes/avm/someco
15:55:10,253 User:admin DEBUG [lucene.index.IndexInfo] Waiting for READ lock - http-8080-1
15:55:10,253 User:admin DEBUG [lucene.index.IndexInfo] …GOT READ LOCK - http-8080-1 - in 1.374E-4 ms
15:55:10,253 User:admin DEBUG [lucene.index.ReferenceCountingReadOnlyIndexReaderFactory$ReferenceCountingReadOnlyIndexReader] http-8080-1: Reader MainReader - increment - ref count is 1 … org.alfresco.repo.search.impl.lucene.index.ReferenceCountingReadOnlyIndexReaderFactory$ReferenceCountingReadOnlyIndexReader@49f11e6c
15:55:10,253 User:admin DEBUG [lucene.index.IndexInfo] Main index reader references = 1
15:55:10,253 User:admin DEBUG [lucene.index.IndexInfo] RELEASED READ LOCK - http-8080-1
15:55:10,259 User:admin DEBUG [web.scripts.DeclarativeWebScript] Caught exception; decorating with appropriate status template : java.lang.NullPointerException
at org.alfresco.repo.search.impl.lucene.ADMLuceneSearcherImpl.query(ADMLuceneSearcherImpl.java:330)
at org.alfresco.repo.search.SearcherComponent.query(SearcherComponent.java:84)
at sun.reflect.GeneratedMethodAccessor437.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy24.query(Unknown Source)
at com.someco.webscript.content.Bloghunter.getResults(Bloghunter.java:52)
at com.someco.webscript.PageableWebScript.executeImpl(PageableWebScript.java:25)
at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:70)
at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:372)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:422)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:439)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:303)
at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:306)
at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:183)
at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
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:619)
15:55:10,260 User:admin DEBUG [web.scripts.RepositoryContainer] Transaction exception: required: 04260001 Wrapped Exception (with status template): null
15:55:10,261 User:admin DEBUG [web.scripts.RepositoryContainer] Transaction status: 1
15:55:10,261 User:admin DEBUG [web.scripts.RepositoryContainer] End retry transaction block: required,readwrite
15:55:10,262 DEBUG [web.scripts.RepositoryContainer] Authentication reset: unauthenticated
15:55:10,262 DEBUG [web.scripts.AbstractRuntime] Web Script com/someco/content/bloghunter.get executed in 14.612255ms
15:55:10,264 ERROR [web.scripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 04260001 Wrapped Exception (with status template): null
org.alfresco.web.scripts.WebScriptException: 04260001 Wrapped Exception (with status template): null
at org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)
at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:165)
at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:372)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:422)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:439)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:303)
at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:306)
at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:183)
at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
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:619)
Caused by: java.lang.NullPointerException
at org.alfresco.repo.search.impl.lucene.ADMLuceneSearcherImpl.query(ADMLuceneSearcherImpl.java:330)
at org.alfresco.repo.search.SearcherComponent.query(SearcherComponent.java:84)
at sun.reflect.GeneratedMethodAccessor437.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy24.query(Unknown Source)
at com.someco.webscript.content.Bloghunter.getResults(Bloghunter.java:52)
at com.someco.webscript.PageableWebScript.executeImpl(PageableWebScript.java:25)
at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:70)
… 21 more
15:55:10,264 DEBUG [scripts.servlet.WebScriptServletRequest] Content Type: null