有人在Jetty 7上成功部署过Sonar吗?

时间:2009-06-04 12:35:45

标签: java jetty sonarqube

我正在尝试在Jetty 7 servlet容器上部署Sonar(自动代码监视工具)。

我想首先使用默认配置(嵌入式Derby DB)作为POC,然后转换到生产等级DB。

到目前为止,我已经尝试了各种方法来完成这项工作(todo:记录失败的尝试)但没有任何运气......

有没有人设法解决这个问题?

这是我通过在jetty / webapps中部署并使用

启动的例外
  

java -DOPTIONS = Server,deploy,jsp -jar start.jar etc / jetty.xml

org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.core.database.JndiDatabaseConnector.start()', instance 'org.sonar.core.database.JndiDatabaseConnector@1f1a3a8, java.lang.RuntimeException: wrapper
        at org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFailed(NullComponentMonitor.java:76)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:129)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:115)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
        at org.picocontainer.injectors.AbstractInjector.start(AbstractInjector.java:131)
        at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:173)
        at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:134)
        at org.picocontainer.behaviors.Stored.start(Stored.java:111)
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:882)
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:630)
        at org.sonar.core.Application.start(Application.java:57)
        at org.sonar.web.listeners.ApplicationListener.contextInitialized(ApplicationListener.java:42)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:627)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:189)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1200)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:585)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:334)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:164)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:164)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
        at org.eclipse.jetty.server.Server.doStart(Server.java:221)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:979)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:248)
        at org.eclipse.jetty.start.Main.start(Main.java:637)
        at org.eclipse.jetty.start.Main.main(Main.java:138)
Caused by: java.lang.RuntimeException: wrapper
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:127)
        ... 32 more
Caused by: org.sonar.commons.database.JndiException: Can not bind JDBC datasource to JNDI
        at org.sonar.core.database.JndiDatabaseConnector.createAndBindDatasource(JndiDatabaseConnector.java:124)
        at org.sonar.core.database.JndiDatabaseConnector.start(JndiDatabaseConnector.java:69)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
        ... 31 more
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at org.sonar.core.database.JndiDatabaseConnector.createJNDISubContexts(JndiDatabaseConnector.java:177)
        at org.sonar.core.database.JndiDatabaseConnector.createAndBindDatasource(JndiDatabaseConnector.java:118)
        ... 37 more

这是我通过在webappls-plus中部署并使用以下方式启动而获得的:

  

java -DOPTIONS = Server,deploy,jsp -jar start.jar etc / jetty.xml etc / jetty-plus.xml

java.lang.ClassNotFoundException: org.eclipse.jetty.plus.webapp.EnvConfiguration
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.eclipse.jetty.util.Loader.loadClass(Loader.java:90)
        at org.eclipse.jetty.util.Loader.loadClass(Loader.java:70)
        at org.eclipse.jetty.webapp.WebAppContext.loadConfigurations(WebAppContext.java:796)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:297)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:164)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:164)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
        at org.eclipse.jetty.server.Server.doStart(Server.java:221)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:979)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:248)
        at org.eclipse.jetty.start.Main.start(Main.java:637)
        at org.eclipse.jetty.start.Main.main(Main.java:138)

1 个答案:

答案 0 :(得分:4)

Sonar尝试将其JDBC数据源绑定到JNDI。但似乎Jetty 7需要一些额外的配置来实现这一点。有关详细信息,请参阅此thread

我希望它有所帮助。