J'essaie d'acheminer les demandes de mon démarrage printanier vers un autre serveur.
pom
<?xml version="1.0"?>
<project xmlns="http://maven.Apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0
http://maven.Apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company.etc.settings</groupId>
<artifactId>projects</artifactId>
<version>1.8</version>
</parent>
<groupId>com.company.gateway</groupId>
<artifactId>gateway</artifactId>
<name>gateway</name>
<version>0.0.1</version>
<packaging>jar</packaging>
<inceptionYear>2017</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<Java.source.version>1.8</Java.source.version>
<pmd.version>3.6</pmd.version>
<findbugs.version>3.0.3</findbugs.version>
<spring.boot>1.5.3.RELEASE</spring.boot>
<swagger.version>1.5.13</swagger.version>
<jacoco.version>0.7.5.201505241946</jacoco.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring.boot}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.Oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
<version>${spring.boot}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>${spring.boot}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring.boot}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>${spring.boot}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring.boot}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Application.properties
zuul.routes.foos.path=/r/users/**
zuul.routes.foos.url=http://com.company.sws/c/users/
Classe principale
@EnableZuulProxy
@SpringBootApplication
@ComponentScan
@EnableAutoConfiguration
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}
Je reçois cette erreur lors du démarrage de l'application
2017-06-20 09:13:42.720 ERROR 15296 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [se.telenor.bapigateway.GatewayApplication]; nested exception is Java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.zuul.ZuulConfiguration
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.Java:616)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.Java:299)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.Java:245)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.Java:198)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.Java:167)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.Java:308)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.Java:228)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.Java:270)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.Java:93)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.Java:686)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:524)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1151)
at se.telenor.bapigateway.GatewayApplication.main(GatewayApplication.Java:20)
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.loader.MainMethodRunner.run(MainMethodRunner.Java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.Java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.Java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.Java:51)
Caused by: Java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.zuul.ZuulConfiguration
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.Java:163)
at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.Java:380)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.Java:314)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.Java:245)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.Java:606)
... 25 common frames omitted
Caused by: Java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletRegistrationBean
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.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.Java:152)
... 29 common frames omitted
Caused by: Java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.ServletRegistrationBean
at Java.net.URLClassLoader.findClass(URLClassLoader.Java:381)
at Java.lang.ClassLoader.loadClass(ClassLoader.Java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.Java:94)
at Java.lang.ClassLoader.loadClass(ClassLoader.Java:357)
org.springframework.boot.context.embedded.ServletRegistrationBean
était obsolète dans la version 1.4 de spring-boot et son remplacement, org.springframework.boot.web.servlet.ServletRegistrationBean
, a été introduit. La classe obsolète a été supprimée dans la version 1.5 de spring-boot. Quelque chose dans votre application ou dans l'une de ses dépendances doit être mis à jour pour utiliser le remplacement.
pour spring-boot
version 1.5.x
, utilisez Dalston.RELEASE
à la place de Brixton.SR5
dans votre configuration de dépendance:
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.RELEASE</version>
Cela est dû à une dépendance réduite dans spring-boot. Utiliser les dépendances suivantes
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
</dependency>