question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application failed to registered itself as Application

See original GitHub issue

Hello, I’m trying to test spring-boot-admin in my spring-boot application.

The admin page is loaded but with no informations inside. In the console, I have this error message :

2017-06-02 12:42:30.803  WARN 8164 --- [gistrationTask1] d.c.b.a.c.r.ApplicationRegistrator       
: Application failed to registered itself as Application [name=spring-boot-application, 
managementUrl=http://DESKTOP-KEUAJ1V.home:8080, healthUrl=http://DESKTOP-KEUAJ1V.home:8080/health, 
serviceUrl=http://DESKTOP-KEUAJ1V.home:8080]. Response: <302 Found,{X-Content-Type-Options=[nosniff],
 X-XSS-Protection=[1; mode=block], Cache-Control=[no-cache, no-store, max-age=0, must-revalidate],
 Pragma=[no-cache], Expires=[0], Location=[http://localhost:8080/login], Content-Length=[0], Date=[Fri, 02 Jun 2017 10:42:30 GMT]}>

I use gradle and not maven…

My build.gradle add this dependencies :

    // spring-boot-admin
    compile "de.codecentric:spring-boot-admin-server:1.5.0"
    compile "de.codecentric:spring-boot-admin-server-ui:1.5.0"
    compile 'de.codecentric:spring-boot-admin-server-ui-login:1.5.0'
    compile "de.codecentric:spring-boot-admin-starter-client:1.5.0"

    runtime("org.springframework.boot:spring-boot-starter-actuator")

and before I activate the spring-boot-plugin :

buildscript {

    repositories {
        jcenter()
    }

    // to let gradle to use kotlin, spring boot, and kotlin-allopen
    // kotlin-allopen let spring use kotlin classes without the need to add the keyword 'open'
    // see https://blog.jetbrains.com/kotlin/2016/12/kotlin-1-0-6-is-here/
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version"
        classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
    }
}

plugins {
    id 'org.springframework.boot' version '1.5.3.RELEASE'
}

my Application class look like that :

@SpringBootApplication
@EnableAdminServer
class Application 
fun main(args: Array<String>) {


	SpringApplication.run(Application::class.java, *args)
}

I’m using the Kotlin language instead of java.

I aslo add a spring security configuration.

And my applications.properties have this content :

management.security.enabled=false
spring.boot.admin.url=http://localhost:8080
spring.boot.admin.context-path=/admin

Maybe the problem come from spring-security. my security-config look like that :

@Configuration
@EnableWebSecurity
class SecurityConfig(val userDetailsService: AuthenticationService, var env: Environment)
	: WebSecurityConfigurerAdapter() {


	@Throws(Exception::class)
	override fun configure(http: HttpSecurity) {
		http
				.authorizeRequests()
				.antMatchers("/css/**", "/js/**", "/images/**",
						"/api/rest/**", "/login", "/signup", "/logout", "/myconsole/**").permitAll()
				.antMatchers("/", "/**").hasRole("USER")
				.and()
				.formLogin()
				.loginPage("/login")
				.defaultSuccessUrl("/", true)

		if (!env.activeProfiles.contains("production")) {
			// we are not in a production environment
			println("we are not in production mode")
			http.csrf().disable()
			http.headers().frameOptions().disable()
		}

	}

	@Throws(Exception::class)
	override fun configure(auth: AuthenticationManagerBuilder) {
		auth.authenticationProvider(authProvider())
		auth.inMemoryAuthentication()
				.withUser("user").password("password").roles("USER")
	}

	@Bean
	fun authProvider(): DaoAuthenticationProvider {
		val authProvider = DaoAuthenticationProvider()
		authProvider.setUserDetailsService(userDetailsService)
		authProvider.setPasswordEncoder(passwordEncoder())
		return authProvider
	}


	@Bean
	fun passwordEncoder(): PasswordEncoder {
		return BCryptPasswordEncoder()
	}

}

For testing, i am not in production profile, so the csrf security is disabled.

Do you have any ideas ?

Thank you 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
jguidouxcommented, Jun 7, 2017

Exactly. You got it: It is because of spring security: when spring-admin look to the url /healh, it is redirected to /login. So I have to find a way to manage with spring-security

0reactions
nagendrabathulacommented, Oct 7, 2018

if possible please make one client and server integration using SPRING BOOT ADMIN with spring security.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Client Failed to register with Admin - Stack Overflow
Basically it failing to register because of difference in version of Spring Boot Admin Server(2.1.0) and Client(1.5.7).
Read more >
codecentric/spring-boot-admin - Gitter
I have some trouble to to register sba for Spring Boot 2.1.4. ... Failed to register application as Application(name=My-Server, ...
Read more >
Foreign or Out-of-State Entities
No member of the secretary of state staff can determine whether an entity is transacting business in Texas or needs to file an...
Read more >
Getting Started | Service Registration and Discovery - Spring
The second application (the client application) needs the Eureka Server and ... By default, the registry also tries to register itself, so you...
Read more >
Application Monitoring Using Spring Boot Admin (Part 2)
In the console, we can see our client application has registered successfully itself as 3a9aa6fe85fe with the Spring Boot Admin. Now let's make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found