opengrok: HTTP Status 404 - /source/s when trying to open .cpp file via an xref

1.6k Views Asked by At

Suppose I'm looking at the .cpp file's source code in the web browser. Now, I want to review the .h file included with #include in this cpp. I'm clicking on the header's file name and instead of browsing its content I'm getting the following error:

HTTP Status 404 - /source/s

type Status report

message /source/s

description The requested resource is not available.

Apache Tomcat/7.0.67

I suspect that this may be related with opengrok's -w command line switch. The help for this switch says: "Context of webapp. Default is /source. If you specify a different name, make sure to rename source.war to that name. Also FULL reindex is needed if this is changed."

Cannot understand what exactly does this mean.

I installed opengrok manually: I unpacked source.war to c:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\myapp and my sources are on drive D:\myapp. My generated grok data file is in C:\opengrok.

What path must I pass with -w switch to make it work?

Thanks.

2

There are 2 best solutions below

1
On

https://github.com/OpenGrok/OpenGrok/issues/1086 use OPENGROK_WEBAPP_CONTEXT hth

0
On

It seems that you want to rename source.war to myapp.war. In the tutorial, -w option could be replaced by OPENGROK_WEBAPP_CONTEXT.

For example, my data source is under /data/project/src and generated opengrok data is under /data/project. What I did in Ubuntu is:

  1. rename source.war to project.war
  2. update WEB-INF/web.xml inside project.war (replace /var/opengrok/etc/configuration.xml with /data/project/etc/configuration.xml)
  3. copy project.war to Tomcat's webapps/project.war
  4. FULL clean reindex is needed for the first time.

    OPENGROK_WEBAPP_CONTEXT=project OPENGROK_INSTANCE_BASE=/data/project /srv/opengrok-0.12.1.5/bin/OpenGrok index`