oracle / opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
http://oracle.github.io/opengrok/
Other
4.37k stars 750 forks source link

The source root specified in your configuration does not point to a valid directory #1983

Closed danielburrell closed 6 years ago

danielburrell commented 6 years ago

OS: CentOS Linux 7 (3.10.0-693.el7.x86_64) Tomcat 8 Java 8

Running with or without security manager.

In the case of running with I added these lines to the catalina.policy. But this doesn't matter because I ran it without a security manager too.

grant codeBase "file:/opt/tomcat/webapps/source/-" {
        permission java.security.AllPermission;
};

grant codeBase "file:/opt/tomcat/webapps/source/WEB-INF/lib/-" {
        permission java.security.AllPermission;
};
OpenGrok deploy

followed by 

JAVA_OPTS=-Xmx8000m OPENGROK_INSTANCE_BASE='/var/opengrok' OPENGROK_DATA_ROOT='/var/opengrok/data' OPENGROK_SRC_ROOT='/var/opengrok/src' /usr/opengrok-1.1-rc18/bin/OpenGrok index 

Produces the error below. Yet the directory exists and is populated with source code. To make things funnier, after the indexing process it even lists the projects available in the dropdown, presumably it must have only known of these projects after accessing the directory.


There was an error!

The source root specified in your configuration does not point to a valid directory! Please configure your webapp.

Source root path "/var/opengrok/src" does not exist

java.io.FileNotFoundException: Source root path "/var/opengrok/src" does not exist
    at org.opensolaris.opengrok.web.PageConfig.checkSourceRootExistence(PageConfig.java:1590)
    at org.apache.jsp.search_jsp._jspService(search_jsp.java:200)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.opensolaris.opengrok.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:41)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.opensolaris.opengrok.web.StatisticsFilter.doFilter(StatisticsFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.opensolaris.opengrok.web.AuthorizationFilter.doFilter(AuthorizationFilter.java:86)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:189)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
    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:748)

<!--
Before submitting an issue, please check off these boxes:

- [ ] I have done a search of the existing issues to make sure I'm not sending in a duplicate

Please include information about the expected behavior, actual behavior, and ideally reproducible test case. Pointers into offending code regions are also very welcome.

If you provide the exact version of OpenGrok, JDK used, OS(and its version) used and Tomcat(or your webapp server) used it can help figuring out an environment issue.
For performance problem OS and JDK tunables might be needed. For SCM problems also version of SCM is helpfull (e.g. some mercurial versions have issues, some not).
-->
idodeclare commented 6 years ago

Hello. Try checking permissions on /var/opengrok/ and below w.r.t. the web server account. E.g., I allow my server account to read /var/opengrok/ and below and to write /var/opengrok/data (no subdirs) for statistics.json.

Those first two commands you mention — OpenGrok deploy and OpenGrok index — are run as an account different from the web container. The UI gets its project list from /var/opengrok/etc/configuration.xml written by OpenGrok index (the UI also receives the contents of that XML file via messaging during indexing).

tulinkry commented 6 years ago

To make things funnier, after the indexing process it even lists the projects available in the dropdown, presumably it must have only known of these projects after accessing the directory.

Like @idodeclare mentioned, this is not true for all cases as the UI receives partial updates of configuration during the indexer run and has a copy of the configuration stored in memory.

danielburrell commented 6 years ago

For completeness, I have abandoned trying to install it directly on centos, and instead opted to modify a docker image with a shared volume. Seems to work fine. An attempt to adjust permissions was made but it made no difference. No attempt to modify permissions was made with the docker image and it worked fine.