[opencms-dev] Zero search results in image gallery when not accessed over site server (Workaround)

Jan Michael Greiner jan0michael at yahoo.com
Mon Mar 20 10:02:36 CET 2017


Hello all,



(in my last e-mail I meant to write 'It is my fault not to _look_ in the webserver log'.)


I found out, that the problem disappears, if I make sure, that the OpenCms webapp for the server opencms_workplace is loaded before the webapp is loaded for the servers opencms_my-site and opencms_default.

Is this a Tomcat 9 specific problem?

As a very first and ugly workaround I'll try to put a line like the following in my /etc/init.d/tomcat9 in the "start)" section, before Tomcat ist started (I have the webapps deployed with configuration descriptors in $CATALINA_BASE/conf/Catalina/):

(mv $CATALINA_BASE/conf/Catalina/opencms_default $CATALINA_BASE/conf/Catalina_delayed_startup/; mv $CATALINA_BASE/conf/Catalina/opencms_my-site $CATALINA_BASE/conf/Catalina_delayed_startup; sleep 180; mv 
$CATALINA_BASE/conf/Catalina_delayed_startup/opencms_* $CATALINA_BASE/conf/Catalina/) &


I hope this helps someone.


Best regards


Jan Michael Greiner


________________________________
From: Jan Michael Greiner <jan0michael at yahoo.com>
To: "opencms-dev at opencms.org" <opencms-dev at opencms.org> 
Sent: Saturday, March 18, 2017 9:30 AM
Subject: Re: Zero search results in image gallery when not accessed over site server



Hello again,


while debugging I got aware, that an exception is logged to the webserver (Tomcat) log, and not to opencms.log... It is my fault not to log in the webserver log. But I reported this as issue anyway:

https://github.com/alkacon/opencms-core/issues/490



Can anybody help me, what the exception means?


org.opencms.search.CmsSearchException: Execution of query "q=*:*&fl=*,score&qt=edismax&rows=200&fq=expired:[NOW TO *]&fq=released:[* TO NOW]&fq=created:[* TO *]&fq=lastmodified:[* TO *]&fq=parent-folders:("/sites/default/" OR "/shared/")&fq=con_locales:en&start=0&sort=lastmodified desc" failed.
at org.opencms.search.solr.CmsSolrIndex.search(CmsSolrIndex.java:858)
at org.opencms.search.solr.CmsSolrIndex.gallerySearch(CmsSolrIndex.java:276)
at org.opencms.ade.galleries.CmsGalleryService.search(CmsGalleryService.java:2910)
at org.opencms.ade.galleries.CmsGalleryService.getSearch(CmsGalleryService.java:953)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:587)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.opencms.gwt.CmsGwtService.service(CmsGwtService.java:194)
at org.opencms.main.OpenCmsCore.invokeGwtService(OpenCmsCore.java:1722)
at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:158)
at org.opencms.main.OpenCmsServlet.doPost(OpenCmsServlet.java:177)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.opencms.jsp.jsonpart.CmsJsonPartFilter.doFilter(CmsJsonPartFilter.java:281)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:715)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:460)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:385)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at org.opencms.main.OpenCmsUrlServletFilter.doFilter(OpenCmsUrlServletFilter.java:127)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:745)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at org.opencms.search.solr.CmsSolrIndex.search(CmsSolrIndex.java:625)
... 52 more



CmsSolrIndex.java:625 reads:
QueryResponse queryResponse = m_solr.query(query);

That means m_solr is null?
How can that be?


Best regards and thanks

Jan Michael Greiner



________________________________

From: Jan Michael Greiner <jan0michael at yahoo.com>
To: "opencms-dev at opencms.org" <opencms-dev at opencms.org> 
Sent: Saturday, March 18, 2017 7:33 AM
Subject: Re: Zero search results in image gallery when not accessed over site server



Hello all,



I attached a debugger (Eclipse) to the remote Tomcat.

I set a breakpoint in org.opencms.ade.galleries.CmsGalleryService in the method public CmsGallerySearchBean getSearch(CmsGalleryDataBean data).

A difference I see between access to the image gallery over https://opencms_default:8443 and https://opencms_workplace:8443 in source code line 931, String gallery = data.getStartGallery();:


For https://opencms_workplace:8443 start gallery is null, for https://opencms_default:8443 it is set to /.galleries/office/.
Can this be the reason why the image gallery is empty, if I access it over https://opencms_workplace:8443?


Update: No, it seems the start gallery is just the gallery selected by default...



I will debug further, and I will keep you up to date with my findings :-)


Help is still appreciated... The source code is fine, well structured and so on. But it is really hard to dive into such a large project...



Best regards

Jan Michael Greiner


________________________________

From: Jan Michael Greiner <jan0michael at yahoo.com>
To: The OpenCms Mailing List <opencms-dev at opencms.org> 
Sent: Monday, March 13, 2017 1:55 PM
Subject: Zero search results in image gallery when not accessed over site server


Dear all,


in my installation there is a problem with the image gallery, and I didn't find a similar case in the list archive.

I have three sites in opencms-system.xml

<sites>
   <workplace-server>https://opencms_workplace:8443</workplace-server>
   <default-uri>/sites/default/</default-uri>
   <shared-folder>/shared/</shared-folder>
   <site server="https://opencms_my-site:8443" uri="/sites/de.mysite/" title="My Site" position="50.0" webserver="false"/>
   <site server="https://opencms_default:8443" uri="/sites/default/" title="Demo Site" position="10.0" webserver="false">
      <parameters>
         <param name="locale.main">en</param>
         <param name="locale.secondary">de</param>
      </parameters>
   </site>
</sites>

The sites are accessed through a reverse proxy on another virtual machine. There is no difference with the image gallery, if I access the sites directly or through the reverse proxy.



In https://opencms_default:8443 the image gallery works as expected.But I get the message described in 

http://lists.opencms.org/pipermail/opencms-dev/2016q2/041124.html

"Accessing workplace or ADE through a server which has not been configured.
Your site configuration is probably incorrect."


In https://opencms_my-site:8443 I don't have a login yet, so I can not test the image gallery.


In https://opencms_workplace:8443 the image gallery has always 0 search results.



I don't think there is a problem with the search index, because the image gallery would not work in opencms_default in that case.
Anyway I rebuilt the search index several times, to be sure.

When restarting Tomcat there is an exception logged with SolrIndexWriter (two times, because there are online and offline search index?):


13 Mar 2017 12:09:14,665  INFO [  org.opencms.main.OpenCmsCore:2832] . Runlevel change      : Switchi
ng from 2 to 4
13 Mar 2017 12:09:14,865 ERROR [he.solr.update.SolrIndexWriter: 182] SolrIndexWriter was not closed p
rior to finalize(), indicates a bug -- POSSIBLE RESOURCE LEAK!!!
13 Mar 2017 12:09:14,867 ERROR [he.solr.update.SolrIndexWriter: 135] Error closing IndexWriter
java.lang.NullPointerException
at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3119)
at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3087)
at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1080)
at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1125)
at org.apache.solr.update.SolrIndexWriter.close(SolrIndexWriter.java:130)
at org.apache.solr.update.SolrIndexWriter.finalize(SolrIndexWriter.java:183)
at java.lang.System$2.invokeFinalize(System.java:1270)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)
13 Mar 2017 12:09:14,868 ERROR [he.solr.update.SolrIndexWriter: 182] SolrIndexWriter was not closed prior to finalize(), indicates a bug -- POSSIBLE RESOURCE LEAK!!!
13 Mar 2017 12:09:14,868 ERROR [he.solr.update.SolrIndexWriter: 135] Error closing IndexWriter
java.lang.NullPointerException
at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3119)
at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3087)
at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1080)
at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1125)
at org.apache.solr.update.SolrIndexWriter.close(SolrIndexWriter.java:130)
at org.apache.solr.update.SolrIndexWriter.finalize(SolrIndexWriter.java:183)
at java.lang.System$2.invokeFinalize(System.java:1270)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)
13 Mar 2017 12:09:14,957 ERROR [ache.juli.logging.DirectJDKLog: 181] Exception loading sessions from persistent storage


Can anybody help me with this?


Best regards



More information about the opencms-dev mailing list