[ https://issues.apache.org/jira/browse/CAMEL-12536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16489892#comment-16489892 ]
Willem Jiang commented on CAMEL-12536: -------------------------------------- It is caused by the servlet API conflict which is introduced by camel-google-mail. You can work around this issue by excluding the servlet-api from jetty just like this. {code} <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-google-mail</artifactId> <version>${camel.version}</version> <exclusions> <exclusion> <groupId>org.mortbay.jetty</groupId> <artifactId>servlet-api</artifactId> </exclusion> </exclusions> </dependency> {code} It's strange that google mail API still has this kind of 10 years old API, I will dig more about shortly. > camel-google-mail: adding the camel component to a spring boot project leads > to java.lang.NoSuchMethodError: > javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader; > --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: CAMEL-12536 > URL: https://issues.apache.org/jira/browse/CAMEL-12536 > Project: Camel > Issue Type: Bug > Affects Versions: 2.21.1, 2.22.0 > Reporter: Luca Burgazzoli > Assignee: Willem Jiang > Priority: Major > Attachments: project.tgz > > > I've created a very simple spring boot (1.x) which includes camel-google-mail > as dependency and when running the application, the following exception is > thrown: > {code} > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke > (NativeMethodAccessorImpl.java:62) > at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke (Method.java:498) > at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run > (AbstractRunMojo.java:527) > at java.lang.Thread.run (Thread.java:748) > Caused by: org.springframework.context.ApplicationContextException: Unable to > start embedded container; nested exception is java.lang.NoSuchMethodError: > javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader; > at > org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh > (EmbeddedWebApplicationContext.java:137) > at org.springframework.context.support.AbstractApplicationContext.refresh > (AbstractApplicationContext.java:537) > at > org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh > (EmbeddedWebApplicationContext.java:122) > at org.springframework.boot.SpringApplication.refresh > (SpringApplication.java:693) > at org.springframework.boot.SpringApplication.refreshContext > (SpringApplication.java:360) > at org.springframework.boot.SpringApplication.run > (SpringApplication.java:303) > at org.springframework.boot.SpringApplication.run > (SpringApplication.java:1118) > at org.springframework.boot.SpringApplication.run > (SpringApplication.java:1107) > at test.Application.main (Application.java:9) > at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke > (NativeMethodAccessorImpl.java:62) > at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke (Method.java:498) > at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run > (AbstractRunMojo.java:527) > at java.lang.Thread.run (Thread.java:748) > Caused by: java.lang.NoSuchMethodError: > javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader; > at io.undertow.websockets.jsr.Bootstrap.handleDeployment > (Bootstrap.java:92) > at io.undertow.servlet.core.DeploymentManagerImpl.handleExtensions > (DeploymentManagerImpl.java:263) > at io.undertow.servlet.core.DeploymentManagerImpl.deploy > (DeploymentManagerImpl.java:153) > at > org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory.createDeploymentManager > (UndertowEmbeddedServletContainerFactory.java:412) > at > org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory.getEmbeddedServletContainer > (UndertowEmbeddedServletContainerFactory.java:234) > at > org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer > (EmbeddedWebApplicationContext.java:164) > at > org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh > (EmbeddedWebApplicationContext.java:134) > at org.springframework.context.support.AbstractApplicationContext.refresh > (AbstractApplicationContext.java:537) > at > org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh > (EmbeddedWebApplicationContext.java:122) > at org.springframework.boot.SpringApplication.refresh > (SpringApplication.java:693) > at org.springframework.boot.SpringApplication.refreshContext > (SpringApplication.java:360) > at org.springframework.boot.SpringApplication.run > (SpringApplication.java:303) > at org.springframework.boot.SpringApplication.run > (SpringApplication.java:1118) > at org.springframework.boot.SpringApplication.run > (SpringApplication.java:1107) > at test.Application.main (Application.java:9) > at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke > (NativeMethodAccessorImpl.java:62) > at sun.reflect.DelegatingMethodAccessorImpl.invoke > (DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke (Method.java:498) > at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run > (AbstractRunMojo.java:527) > at java.lang.Thread.run (Thread.java:748) > {code} > Sample project included in the attached reproducer -- This message was sent by Atlassian JIRA (v7.6.3#76005)