In Spring-MVC you have the ability to remove the Jackson library as a dependency and replace it with your own using this method:
protected void configureMessageConverters(List<HttpMessageConverter<?>> converters)
I am trying to do the same thing for Spring-Websocket so I have overridden both of these methods:
#Bean public CompositeMessageConverter brokerMessageConverter()
protected boolean configureMessageConverters(List<MessageConverter> messageConverters)
However there is still a dependency on Jackson somewhere and I can't figure out where.
EDIT
Here is a stack trace:
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException
at org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService.getDefaultTransportHandlers(DefaultSockJsService.java:81)
at org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService.<init>(DefaultSockJsService.java:74)
at org.springframework.web.socket.config.annotation.SockJsServiceRegistration.createSockJsService(SockJsServiceRegistration.java:231)
at org.springframework.web.socket.config.annotation.SockJsServiceRegistration.getSockJsService(SockJsServiceRegistration.java:198)
at org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration$StompSockJsServiceRegistration.getSockJsService(WebMvcStompWebSocketEndpointRegistration.java:113)
at org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration.getMappings(WebMvcStompWebSocketEndpointRegistration.java:87)
at org.springframework.web.socket.config.annotation.WebMvcStompEndpointRegistry.getHandlerMapping(WebMvcStompEndpointRegistry.java:122)
at org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.stompWebSocketHandlerMapping(WebSocketMessageBrokerConfigurationSupport.java:60)
at com.test.wsb.config.WebsocketConfig$$EnhancerBySpringCGLIB$$b414d315.CGLIB$stompWebSocketHandlerMapping$4(<generated>)
at com.test.wsb.config.WebsocketConfig$$EnhancerBySpringCGLIB$$b414d315$$FastClassBySpringCGLIB$$f17bc7ca.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
at com.test.wsb.config.WebsocketConfig$$EnhancerBySpringCGLIB$$b414d315.stompWebSocketHandlerMapping(<generated>)
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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
SPR-11963 has been created following this question, and is now resolved.
This has landed in Spring Framework 4.0.6.
Related
I'm doing an application and I recently add a splashscreen with LauncherImpl.launchApplication (as a preloader for my app). Before that I was able to run the program in command line and in eclipse. Now eclipse works fine but no more command line. Here is my problem : Why can ide work but not cmd line ?
I get these errors :
java.lang.reflect.InvocationTargetException
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 com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
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 sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Preloader init method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:896)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at view.MainPreloader.init(MainPreloader.java:22)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:767)
... 2 more
Exception running application view.MainApp
Moreover eclipse says for LauncherImpl.launchApplication :
Discouraged access: The method 'LauncherImpl.launchApplication(Class, Class, String[])' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\jfxrt.jar')
I have never seen such an error before, I found this on internet : Access restriction: The type 'Application' is not API (restriction on required library rt.jar)
But in this example I'm not sure they are using an executable jar. However I have to use one. And with an executable jar, even if I change rules as explained it doesn't work.
Help would be appreciate.
Thank you.
I wrote a program in java and now I want to run it using groovy. I did this as an exercise, so don't question why I haven't programmed in groovy in the first place. ;)
I used many libraries in java, so I copied them to the %GROOVY_HOME%\lib directory. After I did this, I wasn't able to run groovyConsole.exe anymore, so ran groovyConsole.bat (using cmd) to get the error, which is following:
C:\Program Files (x86)\Groovy\Groovy-2.4.11\bin>groovyConsole.bat
java.lang.reflect.InvocationTargetException
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.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
Caused by: javax.xml.parsers.FactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.crimson.jaxp.SAXParserFactoryImpl
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:116)
at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160)
at org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150)
at org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:417)
at org.apache.ivy.core.settings.IvySettings$load.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at groovy.grape.GrapeIvy.<init>(GrapeIvy.groovy:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at groovy.grape.Grape.getInstance(Grape.java:121)
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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1850)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3758)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
at groovy.ui.ConsoleIvyPlugin.addListener(ConsoleIvyPlugin.groovy:44)
at groovy.ui.ConsoleIvyPlugin$addListener.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at groovy.ui.Console.<init>(Console.groovy:242)
at groovy.ui.Console.<init>(Console.groovy:224)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at groovy.ui.Console.main(Console.groovy:209)
... 6 more
The libs I used worked fine in eclipse using java. What can I do?
Additional question:
I found a way to use libraries by loading files. Is there a way to load intire directories with jar files?
this.getClass().classLoader.rootLoader.addURL(new File("file.jar").toURL())
You should not add your script dependencies to %GROOVY_HOME%/lib.
You should instead change your script to declare the dependencies it needs.
One way is to do as you found with the adding JAR URLs to a class loader. If you want to add a directory, list the directory and iterate over the JAR files, something like new File('path/to/dir').eachFileMatch('*.jar') { ...addURL(it.toURI().toURL()) }.
Btw. as you can see in my example, you should never use File.toURL(), this is deprecated since a long time. Always do File.toURI().toURL() instead.
Besides all this, there is a better way to depend on libraries in Groovy scripts, which is Grape. You can read more about it at http://groovy-lang.org/grape.html. Basically you just declare your dependencies with annotations and they are automatically downloaded from a Maven repository and added to the classpath of your script, including any transitive dependencies.
I am using AJSC framework in SpringBoot with JaxB implementation. I built the stubs outside the project and copied them inside the project with proper directories.
However, during API execution, i get a classNotDef error. But I have seen my Jar file and i have the package-info class file inside the directory.
Caused by: java.lang.NoClassDefFoundError: BOOT-INF/classes/com/att/fpp/fpprome/opportunity/package-info (wrong name: com/att/fpp/fpprome/opportunity/package-info)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl.classForName(StandardClassLoaderDelegateImpl.java:57)
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl$4.classForName(MetadataBuilderImpl.java:758)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.packageForName(JavaReflectionManager.java:148)
at org.hibernate.cfg.AnnotationBinder.bindPackage(AnnotationBinder.java:281)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.prepare(AnnotationMetadataSourceProcessorImpl.java:186)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.prepare(MetadataBuildingProcess.java:156)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:253)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getDefaultEntityManager(EntityManagerHelper.java:250)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getEntityManager(EntityManagerHelper.java:174)
at acsi.grid.gridcore.core.JdbcGridBagImpl.getEntityManager(JdbcGridBagImpl.java:188)
at acsi.grid.gridcore.core.JdbcGridBagImpl.put(JdbcGridBagImpl.java:163)
at com.att.fpp.fpprome.dao.impl.OpportunityDaoImpl.updateOpportunityDatabaseROME(OpportunityDaoImpl.java:497)
at com.att.fpp.fpprome.bo.impl.OpportunityBusinessObjectImpl.getOpptyInfo(OpportunityBusinessObjectImpl.java:78)
at com.att.fpp.fpprome.service.impl.OpportunityServiceImpl.getOpportunitiesById(OpportunityServiceImpl.java:62)
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.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
Also I noticed that I am not using apache.cxf anywhere in pom but yet it is being called here.
A possible solution for the NoClassDefFoundError originated by the package-info class: Spring boot, runnable jar can't load package-info.class
Found the issue.
The AJSC framework implementing the ADF (Hibernate based ORM) did not support package-info and hence searched for that class everytime.
Only way around was to execute the command to not generate the package-info during stubs generation.
Use -npa in XJC utility to suppress package-info and everything will work.
In case you got here by looking for a solution to a similar "package-info (wrong name:" issue, I fixed my problem by upgrading hibernate (since the one in the app was quite old).
I am new to hibernate and I was trying to build a JSF application with Hibernate in the persistence layer. This is how I am getting the Session Factory.
Configuration config = new Configuration().configure("hibernate.cfg.xml");
StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(config.getProperties());
factory = config.buildSessionFactory(ssrb.build());
But I am getting the following error while running the application.
Error Message:
Caused by: java.lang.NoSuchMethodError: org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(Ljava/util/LinkedHashSet;Lorg/hibernate/boot/registry/classloading/spi/ClassLoaderService;)V
at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:247)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:73)
at com.sherwin.j29.jpa.factory.JPASessionFactory.createSessionFactory(JPASessionFactory.java:19)
at com.sherwin.j29.jpa.factory.JPASessionFactory.getSessionFactory(JPASessionFactory.java:13)
at com.sherwin.j29.dao.WorkItemDAO.<init>(WorkItemDAO.java:24)
at com.sherwin.j29.dao.WorkItemDAO$Proxy$_$$_WeldClientProxy.<init>(WorkItemDAO$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:344)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173)
at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:341)
at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:237)
at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:105)
at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:87)
at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:43)
at org.jboss.weld.bean.proxy.ClientProxyProvider$1.load(ClientProxyProvider.java:53)
at org.jboss.weld.bean.proxy.ClientProxyProvider$1.load(ClientProxyProvider.java:46)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3589)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2374)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2337)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2252)
I am using hibernate 4.3.6.
Please let me know if I am missing something.
Make sure that you have removed all of the previous version(s) of Hibernate from your classpath.
Looking at it on github, I do not see why that would be caused unless you were having class loader issues caused by version conflicts, as the IntegratorServiceImpl exists in both versions that you are/were using, which suggests a class loader issue to me
Try to clean and build your project if you had any package upgrade recently.
I am trying to deploy Sonar (automatic code monitoring tool) on a Jetty 7 servlet container.
I would like to use the default config first (embedded Derby DB) as a POC and transition to a production grade DB later.
So far I have tried various ways to make this work (todo: document failed attempts) without any luck...
Did anyone managed to pull this off?
This is the exception I get by deploying in jetty/webapps and launching with
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
And this is what I get by deploying in webappls-plus and launching with:
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)
Sonar tries to bind its JDBC datasource to JNDI. But it seems that Jetty 7 needs some extra-configuration to allow this. See this thread for more details.
I hope it helps.