Closed apahne closed 10 years ago
Gradle is such a pain with dependency management. Can you start your app with "--debug=true" (or put it in application.properties), and paste in the autoconfig report?
I think that gradle's dependency resulution is working fine. Here is the relevant part of "gradle dependencies" when the tomcat module is excluded. So all the jetty related dependencies are there. But the spring-boot application does not serve web content.
See below for auto configuration report
---
+--- org.springframework.boot:spring-boot-starter-jetty:1.1.1.RELEASE
| +--- org.eclipse.jetty:jetty-webapp:8.1.15.v20140411
| | +--- org.eclipse.jetty:jetty-xml:8.1.15.v20140411
| | | \--- org.eclipse.jetty:jetty-util:8.1.15.v20140411
| | \--- org.eclipse.jetty:jetty-servlet:8.1.15.v20140411
| | \--- org.eclipse.jetty:jetty-security:8.1.15.v20140411
| | \--- org.eclipse.jetty:jetty-server:8.1.15.v20140411
| | +--- org.eclipse.jetty:jetty-continuation:8.1.15.v20140411
| | \--- org.eclipse.jetty:jetty-http:8.1.15.v20140411
| | \--- org.eclipse.jetty:jetty-io:8.1.15.v20140411
| | \--- org.eclipse.jetty:jetty-util:8.1.15.v20140411
| \--- org.eclipse.jetty:jetty-jsp:8.1.15.v20140411
...
...
=========================
AUTO-CONFIGURATION REPORT
=========================
Positive matches:
-----------------
AuditAutoConfiguration.AuditEventRepositoryConfiguration
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.audit.AuditEventRepository; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#autoConfigurationAuditEndpoint
- @ConditionalOnBean (types: org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport; SearchStrategy: all) found the following [autoConfigurationReport] @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.AutoConfigurationReportEndpoint; SearchStrategy: current) found no beans (OnBeanCondition)
EndpointAutoConfiguration#beansEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.BeansEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#configurationPropertiesReportEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.ConfigurationPropertiesReportEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#dumpEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.DumpEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#environmentEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.EnvironmentEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#healthEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.HealthEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#infoEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.InfoEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#metricsEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.MetricsEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#shutdownEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.ShutdownEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration#traceEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.TraceEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
EndpointAutoConfiguration.RequestMappingEndpointConfiguration
- @ConditionalOnClass classes found: org.springframework.web.servlet.handler.AbstractHandlerMethodMapping (OnClassCondition)
EndpointAutoConfiguration.RequestMappingEndpointConfiguration#requestMappingEndpoint
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.endpoint.RequestMappingEndpoint; SearchStrategy: all) found no beans (OnBeanCondition)
HealthIndicatorAutoConfiguration#healthAggregator
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.health.HealthAggregator; SearchStrategy: all) found no beans (OnBeanCondition)
HealthIndicatorAutoConfiguration#statusHealthIndicator
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.health.HealthIndicator; SearchStrategy: all) found no beans (OnBeanCondition)
ManagementServerPropertiesAutoConfiguration#managementServerProperties
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.autoconfigure.ManagementServerProperties; SearchStrategy: all) found no beans (OnBeanCondition)
ManagementServerPropertiesAutoConfiguration#serverProperties
- @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.ServerProperties; SearchStrategy: all) found no beans (OnBeanCondition)
MetricRepositoryAutoConfiguration#counterService
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.metrics.CounterService; SearchStrategy: all) found no beans (OnBeanCondition)
MetricRepositoryAutoConfiguration#gaugeService
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.metrics.GaugeService; SearchStrategy: all) found no beans (OnBeanCondition)
MetricRepositoryAutoConfiguration.CodahaleMetricRegistryConfiguration
- @ConditionalOnClass classes found: com.codahale.metrics.MetricRegistry (OnClassCondition)
MetricRepositoryAutoConfiguration.CodahaleMetricRegistryConfiguration#metricRegistry
- @ConditionalOnMissingBean (types: com.codahale.metrics.MetricRegistry; SearchStrategy: all) found no beans (OnBeanCondition)
MetricRepositoryAutoConfiguration.CodahaleMetricRegistryConfiguration#primaryMetricWriter
- @ConditionalOnMissing classes not found: org.springframework.messaging.MessageChannel (OnClassCondition)
- @ConditionalOnMissingBean (names: primaryMetricWriter; SearchStrategy: all) found no beans (OnBeanCondition)
MetricRepositoryAutoConfiguration.MetricRepositoryConfiguration
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.metrics.repository.MetricRepository; SearchStrategy: all) found no beans (OnBeanCondition)
TraceRepositoryAutoConfiguration#traceRepository
- @ConditionalOnMissingBean (types: org.springframework.boot.actuate.trace.TraceRepository; SearchStrategy: all) found no beans (OnBeanCondition)
PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer
- @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) found no beans (OnBeanCondition)
JacksonAutoConfiguration
- @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)
JacksonAutoConfiguration#jacksonObjectMapper
- @ConditionalOnMissingBean (types: com.fasterxml.jackson.databind.ObjectMapper; SearchStrategy: all) found no beans (OnBeanCondition)
HttpMessageConvertersAutoConfiguration
- @ConditionalOnClass classes found: org.springframework.http.converter.HttpMessageConverter (OnClassCondition)
HttpMessageConvertersAutoConfiguration#messageConverters
- @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.HttpMessageConverters; SearchStrategy: all) found no beans (OnBeanCondition)
HttpMessageConvertersAutoConfiguration.ObjectMappers
- @ConditionalOnClass classes found: com.fasterxml.jackson.databind.ObjectMapper (OnClassCondition)
HttpMessageConvertersAutoConfiguration.ObjectMappers#mappingJackson2HttpMessageConverter
- @ConditionalOnMissingBean (types: org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; SearchStrategy: all) found no beans (OnBeanCondition)
Negative matches:
-----------------
AuditAutoConfiguration#authenticationAuditListener
- required @ConditionalOnClass classes not found: org.springframework.security.authentication.event.AbstractAuthenticationEvent (OnClassCondition)
AuditAutoConfiguration#authorizationAuditListener
- required @ConditionalOnClass classes not found: org.springframework.security.access.event.AbstractAuthorizationEvent (OnClassCondition)
CrshAutoConfiguration
- required @ConditionalOnClass classes not found: org.crsh.plugin.PluginLifeCycle (OnClassCondition)
EndpointMBeanExportAutoConfiguration
- SpEL expression on org.springframework.boot.actuate.autoconfigure.EndpointMBeanExportAutoConfiguration: ${endpoints.jmx.enabled:true} && ${spring.jmx.enabled:true} (OnExpressionCondition)
EndpointWebMvcAutoConfiguration
- required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
HealthIndicatorAutoConfiguration.DataSourcesHealthIndicatorConfiguration
- SpEL expression on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$DataSourcesHealthIndicatorConfiguration: ${health.db.enabled:true} (OnExpressionCondition)
- @ConditionalOnBean (types: javax.sql.DataSource; SearchStrategy: all) found no beans (OnBeanCondition)
HealthIndicatorAutoConfiguration.MongoHealthIndicatorConfiguration
- SpEL expression on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$MongoHealthIndicatorConfiguration: ${health.mongo.enabled:true} (OnExpressionCondition)
- @ConditionalOnBean (types: org.springframework.data.mongodb.core.MongoTemplate; SearchStrategy: all) found no beans (OnBeanCondition)
HealthIndicatorAutoConfiguration.RabbitHealthIndicatorConfiguration
- SpEL expression on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RabbitHealthIndicatorConfiguration: ${health.rabbit.enabled:true} (OnExpressionCondition)
- @ConditionalOnBean (types: org.springframework.amqp.rabbit.core.RabbitTemplate; SearchStrategy: all) found no beans (OnBeanCondition)
HealthIndicatorAutoConfiguration.RedisHealthIndicatorConfiguration
- SpEL expression on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RedisHealthIndicatorConfiguration: ${health.redis.enabled:true} (OnExpressionCondition)
- @ConditionalOnBean (types: org.springframework.data.redis.connection.RedisConnectionFactory; SearchStrategy: all) found no beans (OnBeanCondition)
HealthIndicatorAutoConfiguration.SolrHealthIndicatorConfiguration
- SpEL expression on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$SolrHealthIndicatorConfiguration: ${health.solr.enabled:true} (OnExpressionCondition)
- @ConditionalOnBean (types: org.apache.solr.client.solrj.SolrServer; SearchStrategy: all) found no beans (OnBeanCondition)
JolokiaAutoConfiguration
- not a web application (OnWebApplicationCondition)
ManagementSecurityAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.security.config.annotation.web.configuration.EnableWebSecurity (OnClassCondition)
ManagementServerPropertiesAutoConfiguration#securityProperties
- @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.security.SecurityProperties; SearchStrategy: all) found no beans (OnBeanCondition)
- required @ConditionalOnClass classes not found: org.springframework.security.config.annotation.web.configuration.EnableWebSecurity (OnClassCondition)
MetricFilterAutoConfiguration
- required @ConditionalOnClass classes not found: javax.servlet.Servlet,javax.servlet.ServletRegistration (OnClassCondition)
MetricRepositoryAutoConfiguration.MetricsChannelConfiguration
- required @ConditionalOnClass classes not found: org.springframework.messaging.MessageChannel (OnClassCondition)
TraceWebFilterAutoConfiguration
- required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,javax.servlet.ServletRegistration (OnClassCondition)
MessageSourceAutoConfiguration
- Bundle found for spring.messages.basename: messages (MessageSourceAutoConfiguration.ResourceBundleCondition)
RabbitAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.amqp.rabbit.core.RabbitTemplate,com.rabbitmq.client.Channel (OnClassCondition)
AopAutoConfiguration
- required @ConditionalOnClass classes not found: org.aspectj.lang.annotation.Aspect,org.aspectj.lang.reflect.Advice (OnClassCondition)
BatchAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.batch.core.launch.JobLauncher,org.springframework.jdbc.core.JdbcOperations (OnClassCondition)
ElasticsearchRepositoriesAutoConfiguration
- required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.repository.ElasticsearchRepository (OnClassCondition)
JpaRepositoriesAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.data.jpa.repository.JpaRepository (OnClassCondition)
MongoRepositoriesAutoConfiguration
- required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.repository.MongoRepository (OnClassCondition)
RepositoryRestMvcAutoConfiguration
- not a web application (OnWebApplicationCondition)
SolrRepositoriesAutoConfiguration
- required @ConditionalOnClass classes not found: org.apache.solr.client.solrj.SolrServer,org.springframework.data.solr.repository.SolrRepository (OnClassCondition)
ElasticsearchAutoConfiguration
- required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.client.TransportClientFactoryBean,org.springframework.data.elasticsearch.client.NodeClientFactoryBean (OnClassCondition)
ElasticsearchDataAutoConfiguration
- required @ConditionalOnClass classes not found: org.elasticsearch.client.Client,org.springframework.data.elasticsearch.core.ElasticsearchTemplate (OnClassCondition)
FlywayAutoConfiguration
- required @ConditionalOnClass classes not found: org.flywaydb.core.Flyway (OnClassCondition)
FreeMarkerAutoConfiguration
- required @ConditionalOnClass classes not found: freemarker.template.Configuration,org.springframework.ui.freemarker.FreeMarkerConfigurationFactory (OnClassCondition)
GroovyTemplateAutoConfiguration
- required @ConditionalOnClass classes not found: groovy.text.TemplateEngine (OnClassCondition)
HypermediaAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.hateoas.Resource (OnClassCondition)
IntegrationAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.integration.config.EnableIntegration (OnClassCondition)
JacksonAutoConfiguration.JodaModuleAutoConfiguration
- required @ConditionalOnClass classes not found: com.fasterxml.jackson.datatype.joda.JodaModule (OnClassCondition)
JacksonAutoConfiguration.Jsr310ModuleAutoConfiguration
- Required JVM version 1.8 or newer found 1.7 (OnJavaCondition)
DataSourceAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType (OnClassCondition)
DataSourceTransactionManagerAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.jdbc.core.JdbcTemplate (OnClassCondition)
JmsAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.jms.core.JmsTemplate (OnClassCondition)
ActiveMQAutoConfiguration
- required @ConditionalOnClass classes not found: javax.jms.ConnectionFactory,org.apache.activemq.ActiveMQConnectionFactory (OnClassCondition)
HornetQAutoConfiguration
- required @ConditionalOnClass classes not found: javax.jms.ConnectionFactory,org.hornetq.api.jms.HornetQJMSClient (OnClassCondition)
JmxAutoConfiguration
- @ConditionalOnClass classes found: org.springframework.jmx.export.MBeanExporter (OnClassCondition)
- SpEL expression on org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration: ${spring.jmx.enabled:true} (OnExpressionCondition)
LiquibaseAutoConfiguration
- required @ConditionalOnClass classes not found: liquibase.integration.spring.SpringLiquibase (OnClassCondition)
DeviceDelegatingViewResolverAutoConfiguration
- not a web application (OnWebApplicationCondition)
DeviceResolverAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.mobile.device.DeviceResolverHandlerInterceptor,org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver (OnClassCondition)
SitePreferenceAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor,org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver (OnClassCondition)
MongoAutoConfiguration
- required @ConditionalOnClass classes not found: com.mongodb.Mongo (OnClassCondition)
MongoDataAutoConfiguration
- required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.core.MongoTemplate (OnClassCondition)
HibernateJpaAutoConfiguration
- did not find HibernateEntityManager class (HibernateJpaAutoConfiguration.HibernateEntityManagerCondition)
ReactorAutoConfiguration
- required @ConditionalOnClass classes not found: reactor.spring.context.config.EnableReactor (OnClassCondition)
RedisAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.data.redis.connection.jedis.JedisConnection,org.springframework.data.redis.core.RedisOperations,redis.clients.jedis.Jedis (OnClassCondition)
FallbackWebSecurityAutoConfiguration
- SpEL expression on org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration: !${security.basic.enabled:true} (OnExpressionCondition)
SecurityAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.security.authentication.AuthenticationManager (OnClassCondition)
FacebookAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.social.facebook.connect.FacebookConnectionFactory (OnClassCondition)
LinkedInAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.social.linkedin.connect.LinkedInConnectionFactory (OnClassCondition)
SocialWebAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.social.connect.web.ConnectController,org.springframework.social.config.annotation.SocialConfigurerAdapter (OnClassCondition)
TwitterAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.social.twitter.connect.TwitterConnectionFactory (OnClassCondition)
SolrAutoConfiguration
- required @ConditionalOnClass classes not found: org.apache.solr.client.solrj.SolrServer (OnClassCondition)
ThymeleafAutoConfiguration
- required @ConditionalOnClass classes not found: org.thymeleaf.spring4.SpringTemplateEngine (OnClassCondition)
VelocityAutoConfiguration
- required @ConditionalOnClass classes not found: org.apache.velocity.app.VelocityEngine,org.springframework.ui.velocity.VelocityEngineFactory (OnClassCondition)
DispatcherServletAutoConfiguration
- not a web application (OnWebApplicationCondition)
EmbeddedServletContainerAutoConfiguration
- not a web application (OnWebApplicationCondition)
ErrorMvcAutoConfiguration
- required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
MultipartAutoConfiguration
- required @ConditionalOnClass classes not found: javax.servlet.Servlet,javax.servlet.MultipartConfigElement (OnClassCondition)
ServerPropertiesAutoConfiguration
- not a web application (OnWebApplicationCondition)
WebMvcAutoConfiguration
- not a web application (OnWebApplicationCondition)
WebSocketAutoConfiguration
- required @ConditionalOnClass classes not found: javax.servlet.Servlet,org.apache.catalina.startup.Tomcat,org.springframework.web.socket.WebSocketHandler,org.apache.tomcat.websocket.server.WsSci (OnClassCondition)
I managed to exclude the tomcat dependencies and start the application as a web application by adding an additional dependency: compile 'javax.servlet:javax.servlet-api:3.1.0'
When using tomcat, this dependency is not necessary.
I am not sure, if it is correct to pull this dependency. Shouldn't jetty contain this API?
It should. At least you have a workaround. I would use servlet-api:3.0.1 if I were you though (that's correct for jetty 8). We can try and fix things in the gradle dependency management.
I think you're hitting a quirk of the recent fix for #1047 which is attempting to make Gradle respect exclusions from our spring-boot-dependencies
BOM. The jetty-jsp
project has excluded javax.servlet
, in the Maven build this doesn't seems to matter because jetty-webapp
brings it back again, but our new automatic Gradle rules are obviously being a little too aggressive.
Another workaround would be to set applyExcludeRules
to false in your Gradle springBoot
configuration. You then might also need to manually exclude commons-logging
.
I am using spring-boot 1.1.1.RELEASE
My dependencies are declared in gradle like this:
The application starts fine, as expected and Jetty is used to serve web requests.
However, when I try to exclude tomcat dependencies
then the application context will be initialized and then shut down instantly. Serving web content is not enabled at all without tomcat dependencies.