I'm using Spring Boot 2.0.0.M2 and Vaadin 8.1.0.rc1 in my project. Since I need to use custom widgets, I've added vaadin-client-compiler dependency to my project. The first weird thing that happened was that embedded Tomcat become replaced by embedded Jetty automatically. The second problem was that I've started to get warnings like this one during application initialization:
2017-08-01 11:07:27.822 WARN 1012 --- [ main] o.a.tomcat.util.scan.StandardJarScanner : Failed to scan [file:/Users/mac/.m2/repository/com/vaadin/vaadin-sass-compiler/0.9.13/sac-1.3.jar] from classloader hierarchy
java.io.FileNotFoundException: /Users/mac/.m2/repository/com/vaadin/vaadin-sass-compiler/0.9.13/sac-1.3.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_101]
at java.util.zip.ZipFile.<init>(ZipFile.java:219) ~[na:1.8.0_101]
at java.util.zip.ZipFile.<init>(ZipFile.java:149) ~[na:1.8.0_101]
at java.util.jar.JarFile.<init>(JarFile.java:166) ~[na:1.8.0_101]
at java.util.jar.JarFile.<init>(JarFile.java:130) ~[na:1.8.0_101]
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:60) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:43) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:327) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:277) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) [apache-jsp-8.5.9.1.jar:2.3]
at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104) [apache-jsp-8.5.9.1.jar:2.3]
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101) [apache-jsp-8.5.9.1.jar:2.3]
at org.springframework.boot.web.embedded.jetty.JasperInitializer.doStart(JasperInitializer.java:91) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:844) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344) [jetty-servlet-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1501) [jetty-webapp-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1463) [jetty-webapp-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261) [jetty-servlet-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545) [jetty-webapp-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.Server.start(Server.java:452) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.server.Server.doStart(Server.java:419) [jetty-server-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.4.6.v20170531.jar:9.4.6.v20170531]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:103) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:81) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:537) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:175) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:161) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:134) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:122) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
Still application worked properly: I just wanted to get rid of these warnings. So I've decided to set back Tomcat instead of Jetty and excluded Jetty like this:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${vaadin.version}</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
After it was done, warnings haven't disappeared, but have changed a bit:
java.io.FileNotFoundException: /Users/mac/.m2/repository/com/vaadin/vaadin-sass-compiler/0.9.13/sac-1.3.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_101]
at java.util.zip.ZipFile.<init>(ZipFile.java:219) ~[na:1.8.0_101]
at java.util.zip.ZipFile.<init>(ZipFile.java:149) ~[na:1.8.0_101]
at java.util.jar.JarFile.<init>(JarFile.java:166) ~[na:1.8.0_101]
at java.util.jar.JarFile.<init>(JarFile.java:130) ~[na:1.8.0_101]
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:60) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:338) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:288) ~[tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) [apache-jsp-8.5.9.1.jar:2.3]
at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104) [apache-jsp-8.5.9.1.jar:2.3]
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101) [apache-jsp-8.5.9.1.jar:2.3]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196) [tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.15.jar:8.5.15]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.15.jar:8.5.15]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_101]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
I've found a thread on Vaadin forum suggesting to use 8.0.32 version of Tomcat to fix it. When I switched to it, application stopped working at all:
Caused by: java.lang.ClassNotFoundException: org.apache.juli.WebappProperties
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 29 more
Then I've found some other thread suggesting to use Tomcat 8.5.5 as it has some fix (can't remember the URL of a thread). I've tried 8.5.5: warnings came back. Then I've also tried 8.5.19 and even 9.0.0.M25 with the same result.
So where is the problem: Spring, Tomcat, Vaadin or Maven dependencies versioning? And how do I solve it? These warnings don't fail the application, but I don't want them to appear in my startup log.
UPDATE
Here is my POM, Application-class and full mvn spring-boot:run output: https://gist.github.com/dtitov/ce9c098c8aa64073b3a22d2178f9aac7
Disclaimer: Probably this would be better suited as a comment but it does not fit the space.
1) You can use the stable Vaadin 8.1.0 and vaadin-spring-boot-starter 2.0.1. The Vaadin module versions are managed by the vaadin-bom (${vaadin.version} is a property in my pom and has a value of 8.1.0):
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
After this, you won't need to change their versions each time you change your Vaadin version (unless you really need to use a specific version):
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>
2) You should use the same vaadin-maven-plugin as your Vaadin version to avoid widgetset version mismatches/issues. You're using Vaadin 8.1.0 but the plugin version is 8.0.6. You can use <version>${vaadin.version}</version> to sync them.
3) As per the docs, vaadin-client-compiler is used only at compile time and should not be deployed with your application:
vaadin-client-compiler-8.x.x.jar
The Vaadin Client Compiler is a Java-to-JavaScript compiler that allows building client-side modules, such as the Client-Side Engine (widget set) required for server-side applications. The compiler is needed, for example, for compiling add-on components to the application widget set, as described in "Using Vaadin Add-ons".
For detailed information regarding the compiler, see "Compiling a Client-Side Module". Note that you should not deploy this library with a web application.
You can add <scope>provided</scope> to the dependency and that should probably fix your tomcat issue.
Important edit: I've checked the logs and it looks like you don't even need it in your classpath for your widgetset. The vaadin-maven-plugin uses it to compile your widgetset behind the curtain:
[INFO] --- vaadin-maven-plugin:8.1.0:compile (default) # test ---
[INFO] Using com.vaadin:vaadin-client-compiler version 8.1.0
[INFO] Compiling module MyCustomWidgetSet
[INFO] Computing all possible rebind results for 'com.vaadin.client.metadata.ConnectorBundleLoader'
...
After removing it, everything went as expected. Not entirely sure, but it's possible that it's required only for certain add-ons or the vaadin-maven-plugin. I didn't need to write any so far, so perhaps someone that has actually required it could provide more insight.
4) You can also remove vaadin-client-compiled as per the same docs suggestion.
Generally, for other libraries, it can help to disable the scan of manifest in the jar(s) referencing weired Class-Path. Refers to Disable scanManifest of Jar Scan in tomcat embed in spring boot for details (use precise enough filters).
Related
I am trying to integrate spring with hibernate and I have spring-orm .4.3.6 jar file in my project.But still I am getting below error :
java.lang.NoClassDefFoundError: org/springframework/orm/hibernate5/HibernateTransactionManager
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
Tried googling it.But did not find answer.
Can someone help?
This class is coming out of the spring-orm dependency (notice the hibernate5 package in there. There is equally hibernate3 and hibernate4 packages in the same jar not to break compatibility).
The Maven Coordinates are:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.3.10.RELEASE</version>
</dependency>
In Java project using Maven I add library for JxBrowser.
Program is compiling fine - with no errors, but when I try to run it in Intelij IDEA it returns error.
It shows when try to create BrowserView object(it is a class in lib package com.teamdev.jxbrowser.chromium.swing) and returned two errors NoClassDefFoundError and CLassNotFoundException and full message looks like :
java.lang.NoClassDefFoundError: com/teamdev/jxbrowser/chromium/swing/BrowserView
at com.goodsoft.stockbox.jxbrowser.JxBrowser.<init>(JxBrowser.java:26)
at com.goodsoft.stockbox.market.view.window.StockBoxWindowController.lambda$createMenuWindow$17(StockBoxWindowController.java:211)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.menuDragMouseReleased(BasicMenuItemUI.java:943)
at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:586)
at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:483)
at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:429)
at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:329)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:879)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: com.teamdev.jxbrowser.chromium.swing.BrowserView
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 45 more
How can I resolve it ?
When I type BrowserView browserView = new BrowserView() it is not highlighted, it means that lib was found in project resources.
pom.xml contains:
<dependencies>
<dependency>
<groupId>com.teamdev.jxbrowser</groupId>
<artifactId>jxbrowser-mac</artifactId>
<version>6.11.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>com.teamdev.jxbrowser</id>
<url>http://maven.teamdev.com/repository/products</url>
</repository>
</repositories>
When compiling project, the library is downloaded successfully with no error.
EDIT
I work on OS X system and IntelliJ IDEA.
I add license.jar file in module settings - Dependencies tab, ask me about which type and I choose "classes" also it is setted to "Compile"
EDIT 2
I checked System.getProperty("java.class.path") and there is no .jar files to JxBrowser... But why ? When it is set up in module dependencies
SOLVED
In JxBrowser installation guide (JxBrowser Installation) there was no information about adding dependency as below
<dependency>
<groupId>com.teamdev.jxbrowser</groupId>
<artifactId>jxbrowser</artifactId>
<version>${jxbrowser.version}</version>
</dependency>
only for different systems (as Windows, Mac, Linux), but not to main lib.
I am using maven to build project which deploys on the tomcat server. The build process completed successfully but when i am trying to deploy the project on tomcat 7 its throwing error.
I can see the twelemonkey-servlet.jar is present in the lib folder in WEB-INF.
pom.xml
<repository>
<id>project.local</id>
<name>project</name>
<url>file://${project.basedir}/repo</url>
</repository>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-metadata</artifactId>
<version>3.06</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys</groupId>
<artifactId>twelvemonkeys-servlet</artifactId>
<version>3.08</version>
</dependency>
The build is successful but while deployment i am getting following exception
SEVERE: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener#386d4852
java.lang.ClassNotFoundException: com.twelvemonkeys.servlet.image.IIOProviderContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
please suggest solution if someone faced this problem before.
Late answer, but I had the same problem today. I noticed the artifactId for the twelvemonkeys servlet has changed since version 3. Using the dependency below, it works for me.
<dependency>
<groupId>com.twelvemonkeys.servlet</groupId>
<artifactId>servlet</artifactId>
<version>3.1.2</version>
</dependency>
I am migrating my web application from Jboss 4.2 to tomcat 7 . After using the tomcat 7 i am facing the following exception.
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:855)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1051)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1883)
at org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment(ContextConfig.java:1469)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1246)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have tried to remove the catalina.jar (according to the solution given for the same exception)from the lib to solve the issue but it didn't worked.I am not getting any way to solve this issue can anyone please help on this issue.
In your pom.xml
if you have included dependencies like tomcat-catalina,
put the scope as provided
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.47</version>
<scope>provided</scope>
</dependency>
The container ( here tomcat ) itself provides some dependencies ( like tomcat-catalina jar ) when you deploy your app. So you don't need to include them in your application. But the jars are needed for compilation. This is achieved by setting the scope as 'provided'
I believe, this error is about the deployment assembly. You do not need the catalina.jar in the deployment assembly.
For the ones like me facing this issue with Spring Boot, adding this dependency solved it :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
For me, this error was being produced because my derived implementation of ServletContextListener had a CONCTRUCTOR PARAMETER. Apparently Spring/Java/Whatever can't load it up if you have ctor params, even though the params have values in the Application Context.
Hope this helps others.
I had this problem today, and it was because my executable spring boot jar had /BOOT-INF/lib/tomcat-embed-core-9.0.62.jar and my deployed WAR also had ../ROOT/WEB-INF/lib/tomcat-embed-core-9.0.62.jar. The jars were identical, but the tomcat webapp classloader creates a ProtectionDomain for the jars provided from BOOT-INF, and my deployed WAR was attempting to load the class from ROOT/WEB-INF/lib.
The fix is to make sure my deployed WAR uses jars from BOOT-INF ... I just have to figure out how to make that happen.
add <scope>provided</scope> into pom.xml :
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.27</version>
<scope>provided</scope>
</dependency>
There is another solution when you do need the catalina.jar, add
<Loader delegate="true"/>
to
<Context />
element in %TOMCAT_HOME%/conf/context.xml
I'm try to run a system my group made using Maven and Eclipse, but when I try to use mvn jetty:run, this error appears:
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:52)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:975)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:586)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:349)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:102)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:162)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:165)
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:228)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:69)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:433)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:377)
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:546)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
2012-07-10 13:35:25.948:INFO::Started SelectChannelConnector#0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.
My teammate's systems can run it fine, and we basically have the same settings, repositories, and we are all using Maven2.
Any ideas as to why the error occurs?
Well, you appear to be needing the asm library. The java.lang.NoClassDefFoundError means you simply don't have the org.objectweb.asm.ClassVisitor class on your classpath. I don't know which version of the Jetty plugin you're using, (if you'd paste your pom.xml), I could be more precise.
Basically, you need one of these dependencies:
Either add this in your project's <dependencies/>:
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
Or add this as a <dependency> of your Jetty plugin:
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-runner</artifactId>
<version>8.1.0.RC4</version>
</dependency>
(Apparently, this dependency contains the ASM classes).
In the future, in order to resolve noclassdef-s, I'd recommend you look up the dependencies the class is part of via some site like:
http://www.mvnrepository.net/
http://www.jarvana.com/
http://search.maven.org/ (using 'Advanced Search')
http://www.findjar.com/
If it works for your colleagues but not for you, then it may be due to a corrupt local repository on your machine. Try renaming or deleting your local repository directory to force Maven to download your plugins and dependencies again.