3

我已将具有正确数据库配置的声纳 3.3 战争文件部署到我的 MacOS 服务器上的工作 Tomcat 6:

System Version: Mac OS X 10.7.5 (11G63)
Kernel Version: Darwin 11.4.2

当它试图部署战争时,我得到了这个:

[pool-2-thread-1] ERROR jruby.rack - Error: application initialization failed
org.jruby.rack.RackInitializationException: java.lang.NullPointerException: null
    from org/sonar/server/ui/JRubyFacade.java:447:in `getServerHome'
    from /usr/local/tomcat/temp/0-sonar/WEB-INF/config/environment.rb:52:in `(root)'
    from /usr/local/tomcat/temp/0-sonar/WEB-INF/gems/gems/rails-2.3.14/lib/initializer.rb:111:in `run'
    from /usr/local/tomcat/temp/0-sonar/WEB-INF/config/environment.rb:32:in `(root)'
    from org/jruby/RubyKernel.java:1058:in `load'
    from /usr/local/tomcat/temp/0-sonar/WEB-INF/config/environment.rb:23:in `load_environment'
    from /usr/local/java/apache-tomcat-7.0.23/work/Catalina/localhost/sonar/loader/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.deployWAR(HostConfig.java:958) [catalina.jar:7.0.23]
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599) [catalina.jar:7.0.23]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_35]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_35]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_35]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_35]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_35]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_35]
org.jruby.exceptions.RaiseException: Native Exception: 'class java.lang.NullPointerException'; Message: null; StackTrace: java.lang.NullPointerException
    at org.sonar.server.ui.JRubyFacade.get(JRubyFacade.java:84)
    at org.sonar.server.ui.JRubyFacade.getServerHome(JRubyFacade.java:447)

    at org.sonar.server.ui.JRubyFacade.get(JRubyFacade.java:84) ~[JRubyFacade.class:na]
    at org.sonar.server.ui.JRubyFacade.getServerHome(JRubyFacade.java:447) ~[JRubyFacade.class:na]
 Caused by: java.lang.NullPointerException: null
    ... 2 common frames omitted

我不知道出了什么问题,这是我第一次使用 OS X。在 Windows 7 上部署了相同的 WAR,没有任何问题。有任何想法吗?

4

1 回答 1

5

在这里找到了解决方案

您需要将 SONAR_HOME 环境变量指向您解压缩并构建声纳战争的目录

例子:

下载声纳分布

wget "http://dist.sonar.codehaus.org/sonar-3.2.zip"

构建 sonar.war,注意:sonar.war 将绑定到它有 bean build 的目录

unzip sonar-3.2.zip -d ~/temp/sonar
mkdir /home/ubuntu/.sonar
mv ~/temp/sonar/sonar-3.2/* ~/.sonar
cd ~/.sonar/war/
./build-war.sh
cd ~

将声纳部署到 tomcat mv ~/.sonar/war/sonar.war ~/java/servers/sonar-tomcat-6.0.35/webapps/sonar.war

清理 - 但不要删除 ~/.sonar/ 原因是 sonar_home

mv sonar-3.2.zip ~/java/utils/zip/
rm -rf ~/temp/sonar

配置 tomcat 以运行声纳见 mkyong

printf 'CATALINA_OPTS="-Xmx1024m -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -XX:MaxPermSize=256m"\n' | tee ~/java/servers/sonar-tomcat-6.0.35/bin/setenv.sh
printf 'SONAR_HOME="~/.sonar"\n' | tee ~/java/servers/sonar-tomcat-6.0.35/bin/setenv.sh
于 2013-02-12T08:28:40.123 回答