cancel
Showing results for 
Search instead for 
Did you mean: 

Exception when paging a CMIS query

fmelia
Champ in-the-making
Champ in-the-making
Hi all,

In Alfresco 4.0d, when i try to execute a simple query all works fine for the first page, but when i want to skipTo a new position and retrieve the second page, an execption is thrown:

"""

[aplicacions@devel01 alfresco-4.0.d]$ 08-jun-2012 14:55:34 org.apache.solr.common.SolrException log
GRAVE: java.lang.ArrayIndexOutOfBoundsException

2012-06-08 14:55:34,135  ERROR [extensions.webscripts.AbstractRuntime] [http-6080-1] Exception from executeScript - redirecting to status template error: 05080010 Wrapped Exception (with status template): 05080048 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05080047
org.springframework.extensions.webscripts.WebScriptException: 05080010 Wrapped Exception (with status template): 05080048 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05080047
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   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.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   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:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.scripts.ScriptException: 05080048 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05080047
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:195)
   at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1193)
   at org.alfresco.repo.cmis.rest.CMISWebScript.executeScript(CMISWebScript.java:46)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   … 25 more
Caused by: org.alfresco.repo.search.impl.lucene.LuceneQueryParserException: 05080047
   at org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:368)
   at org.alfresco.repo.search.impl.solr.SolrQueryLanguage.executeQuery(SolrQueryLanguage.java:49)
   at org.alfresco.repo.search.impl.solr.SolrCMISQueryServiceImpl.query(SolrCMISQueryServiceImpl.java:93)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invoke(SubsystemProxyFactory.java:65)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy137.query(Unknown Source)
   at org.alfresco.repo.cmis.rest.CMISScript.query(CMISScript.java:683)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
   at org.mozilla.javascript.gen.c1._c0(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js:67)
   at org.mozilla.javascript.gen.c1.call(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c1.call(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.mozilla.javascript.gen.c1.exec(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
   … 31 more
Caused by: org.json.JSONException: Expected a ',' or ']' at character 730682
   at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
   at org.json.JSONArray.<init>(JSONArray.java:143)
   at org.json.JSONTokener.nextValue(JSONTokener.java:351)
   at org.json.JSONObject.<init>(JSONObject.java:206)
   at org.json.JSONTokener.nextValue(JSONTokener.java:347)
   at org.json.JSONObject.<init>(JSONObject.java:206)
   at org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:338)
   … 57 more
14:55:34,135 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 05080010 Wrapped Exception (with status template): 05080048 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05080047
org.springframework.extensions.webscripts.WebScriptException: 05080010 Wrapped Exception (with status template): 05080048 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05080047
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   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.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   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:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.scripts.ScriptException: 05080048 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05080047
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:195)
   at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1193)
   at org.alfresco.repo.cmis.rest.CMISWebScript.executeScript(CMISWebScript.java:46)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   … 25 more
Caused by: org.alfresco.repo.search.impl.lucene.LuceneQueryParserException: 05080047
   at org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:368)
   at org.alfresco.repo.search.impl.solr.SolrQueryLanguage.executeQuery(SolrQueryLanguage.java:49)
   at org.alfresco.repo.search.impl.solr.SolrCMISQueryServiceImpl.query(SolrCMISQueryServiceImpl.java:93)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invoke(SubsystemProxyFactory.java:65)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy137.query(Unknown Source)
   at org.alfresco.repo.cmis.rest.CMISScript.query(CMISScript.java:683)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
   at org.mozilla.javascript.gen.c1._c0(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js:67)
   at org.mozilla.javascript.gen.c1.call(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c1.call(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.mozilla.javascript.gen.c1.exec(file:/mnt/data/aplicacions/server/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
   … 31 more
Caused by: org.json.JSONException: Expected a ',' or ']' at character 730682
   at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
   at org.json.JSONArray.<init>(JSONArray.java:143)
   at org.json.JSONTokener.nextValue(JSONTokener.java:351)
   at org.json.JSONObject.<init>(JSONObject.java:206)
   at org.json.JSONTokener.nextValue(JSONTokener.java:347)
   at org.json.JSONObject.<init>(JSONObject.java:206)
   at org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:338)
   … 57 more
"""

My test query is:

SELECT * FROM cmis:document

The code executed using Apache Chemistry 0.7.0 is:

ItemIterable<QueryResult> queryResult = session.query(searchQuery, false);
return queryResult.skipTo(start).getPage();

There's something extrange here, because this never happends in Alfresco 3.4 Smiley Sad

Best regards,
  Paco
3 REPLIES 3

borillo
Champ in-the-making
Champ in-the-making
Hi Paco,

I have the same problem here!!
Anybody using queries and pagination in CMIS???

I'm sure we are doing something wrong because this seems a quite basic feature …


Best regards,
  Ricardo

jpotts
World-Class Innovator
World-Class Innovator
You appear to be using the deprecated, web script-based CMIS URL (/alfresco/s/api/cmis). In 4.0 the CMIS endpoint changed to /alfresco/cmisatom for the AtomPub binding.

Are you seeing the same problem with the Alfresco 4 CMIS URL?

Does it make a difference if you use Lucene versus Solr?

Pagination works fine for me using OpenCMIS 0.7.0 against 4.0.d using either the deprecated URL or the new URL, but I am running against a standalone install of 4.0.d that uses Lucene, not Solr.

Jeff

goebel
Champ on-the-rise
Champ on-the-rise
Hi

Today it ran into the same Problem. After losing lot of time in debugging an googling, I managed to get it working but I still do not know if it's the right way (or solution)

How do you create you session ? Do you use an url like "http://alfrescoServer:8080/alfresco/s/cmis" ? I had exactly the same problem you had when I was using the URL '/alfresco/s/cmis' to create my session. After changing it to "http://alfrescoServer:8080/alfresco/cmisatom", the same code worked for me. (Which is according to alfresco help the 'alfresco open cmis extension')
In all the cmis documention on alfresco wiki and examples, I only found the alfresco/s/cmis url. So I am still a little confused if I should use the cmisatom URL because it is not often referenced in the documentations

Let me hear if that fixed your problem too.

Georges Goebel