0

将 sonar.war 直接部署到 /tomcat_sonar/webapps 时,一切运行正常。

但是:在 /tomcat_sonar/conf/Catalina/localhost/ 中定义一个指向战争的 sonar.xml 时,我遇到了错误。

声纳.xml:

<Context path="/sonar"
    docBase="/srv/stage/sonar.war"
    reloadable="true">
</Context>

日志:

2013.05.07 10:38:02 ERROR jruby.rack  Error: application initialization failed
org.jruby.rack.RackInitializationException: No such file to load -- /localhost/sonar/WEB-INF/config/environment.rb
    from file:/srv/tomcat_sonar/work/Catalina/localhost/sonar/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/rails/environment2.rb:23:in `load_environment'
    from file:/srv/tomcat_sonar/work/Catalina/localhost/sonar/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/rails_booter.rb:65:in `load_environment'
    from <script>:1:in `(root)'

    at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:231) ~[jruby-rack-1.1.10.jar:na]
    at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:58) ~[jruby-rack-1.1.10.jar:na]
    at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:33) ~[jruby-rack-1.1.10.jar:na]
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:48) ~[jruby-rack-1.1.10.jar:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765) [catalina.jar:7.0.23]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260) [catalina.jar:7.0.23]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.23]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866) [catalina.jar:7.0.23]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842) [catalina.jar:7.0.23]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) [catalina.jar:7.0.23]
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649) [catalina.jar:7.0.23]
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581) [catalina.jar:7.0.23]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_05]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [na:1.7.0_05]
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) [na:1.7.0_05]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_05]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_05]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_05]
org.jruby.exceptions.RaiseException: (LoadError) No such file to load -- /localhost/sonar/WEB-INF/config/environment.rb
    at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1058) ~[jruby-complete-1.6.7.2.jar:na]
    at Rails2Environment.load_environment(file:/srv/tomcat_sonar/work/Catalina/localhost/sonar/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/rails/environment2.rb:23) ~[na:na]
    at (Anonymous).load_environment(file:/srv/tomcat_sonar/work/Catalina/localhost/sonar/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/rails_booter.rb:65) ~[na:na]
    at (Anonymous).(root)(<script>:1) ~[na:na]
2013.05.07 10:38:02 INFO  org.sonar.INFO  Stop sonar...
2013.05.07 10:38:02 INFO  org.sonar.INFO  Stop sonar done: 1 ms

有人有什么建议吗?

4

1 回答 1

0

已解决(问题仅出现在 Tomcat 7.0.x 上)。只需解压 war-file 并参考这个目录。

<Context path="/sonar"
    docBase="/srv/stage/sonar"
    reloadable="true">
</Context>
于 2013-05-28T16:10:00.177 回答