Spring Boot cannot start server - spring

I am building a spring-boot service, but when I start run 'spring boot app' the server cannot start and I cannot access to localhost:8080. I research some topic but cannot find solution right now.
This is my pom file :
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
when I run the application the log file console :
2018-10-24 23:11:51.350 INFO 5492 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on Welcomes-PC with PID 5492 (C:\Users\Welcomes\Documents\workspace-spring-tool-suite-4-4.0.0.RELEASE\demo\target\classes started by Welcomes in C:\Users\Welcomes\Documents\workspace-spring-tool-suite-4-4.0.0.RELEASE\demo)
2018-10-24 23:11:51.354 INFO 5492 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2018-10-24 23:11:51.401 INFO 5492 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#40e6dfe1: startup date [Wed Oct 24 23:11:51 ICT 2018]; root of context hierarchy
2018-10-24 23:11:52.187 INFO 5492 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-10-24 23:11:52.201 INFO 5492 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.142 seconds (JVM running for 1.71)
2018-10-24 23:11:52.204 INFO 5492 --- [ Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#40e6dfe1: startup date [Wed Oct 24 23:11:51 ICT 2018]; root of context hierarchy
2018-10-24 23:11:52.207 INFO 5492 --- [ Thread-3] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
I cannot see the Tomcat initializatied with port(s) : 8080. Does I miss some steps? I'm using JDK jdk1.8.0_191

Related

Spring Boot Application Not Starting and no exception

I am using spring boot version: 2.3.5.RELEASE, with only the main class which I am trying to start. When I run the main class, I get the below message and the application fails to start without any error.
2020-11-03 12:39:17.871 INFO 15426 --- [ main] com.rahul.poc.HealthcheckApplication : Starting HealthcheckApplication on INMLTCU6LVCG with PID 15426 (/Users/rahul/Documents/Rahul/Projects/healthcheck/target/classes started by rahul in /Users/rahul/Documents/Rahul/Projects/healthcheck)
2020-11-03 12:39:17.873 INFO 15426 --- [ main] com.rahul.poc.HealthcheckApplication : No active profile set, falling back to default profiles: default
2020-11-03 12:39:18.617 INFO 15426 --- [ main] com.rahul.poc.HealthcheckApplication : Started HealthcheckApplication in 1.353 seconds (JVM running for 1.806)
Process finished with exit code 0
The pom.xml looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.rahul.poc</groupId>
<artifactId>healthcheck</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Healthcheck</name>
<description>Healthcheck POC</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<!-- <scope>test</scope>-->
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
The main class as:
package com.rahul.poc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class HealthcheckApplication {
public static void main(String[] args) {
SpringApplication.run(HealthcheckApplication.class, args);
}
}
I don't have any other class or configuration.
I believe that your problem is that you haven't added a starter package reference that adds a server component to your app, or otherwise adds anything that stays alive and does anything. I think your app is running, and then exiting because it has not been configured to run anything on a continual basis.
The most common thing you're missing that would cause your app to stay running is the web starter. Add this as a Maven dependency, and you should get behavior more like what you expect:
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>

#EnableEurekaServer, #EnableConfigServer, #EnableAdminServer and #EnableZuulProxy walk into a bar

I am having trouble building a Spring Boot + Spring Cloud application that is combining Zuul, Eureka server, Config server and Admin server in one unique application.
If you are already thinking: "Why on earth, this is breaking micro services concepts, etc.." I totally agree. This question is about the feasibility to make it happen, not to ask if it is a good idea to do it, thank you for your understanding.
Does anyone know how to make it happen? Some solution with Spring 2.1.0 + Spring Cloud Finchley or above will be great.
The code is obviously very straightforward:
`
#EnableZuulProxy
#EnableAdminServer
#EnableConfigServer
#EnableEurekaServer
#SpringBootApplication
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
}
`
The pom is also simple:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
With an also straightforward config file:
spring.application.name=question
server.port=8090
eureka.client.service-url.defaultZone=http://localhost:8090/eureka
spring.boot.admin.context-path=/admin
spring.cloud.config.server.prefix=/config
spring.cloud.config.server.git.uri=...
spring.cloud.config.server.git.searchPaths=...
[...]
The closest I got was to use 2.0.6 + Finchley:
2018-12-08 13:20:10.515 INFO 13078 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-12-08 13:20:10.519 WARN 13078 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
2018-12-08 13:20:10.534 INFO 13078 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-12-08 13:20:10.536 ERROR 13078 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method reactor.retry.Retry.retryMax(J)Lreactor/retry/Retry; but it does not exist. Its class, reactor.retry.Retry, is available from the following locations:
jar:file:/Users/aaa/.m2/repository/io/projectreactor/addons/reactor-extra/3.1.7.RELEASE/reactor-extra-3.1.7.RELEASE.jar!/reactor/retry/Retry.class
It was loaded from the following location:
file:/Users/aaa/.m2/repository/io/projectreactor/addons/reactor-extra/3.1.7.RELEASE/reactor-extra-3.1.7.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of reactor.retry.Retry
Process finished with exit code 1
You need version 2.0.4 of spring boot admin. You're using the latest (2.1.1) which is not compatible with the rest of Spring libraries you're using.

Jboss7 : Undertow Spring Boot throwing 404

I'm developing a Spring boot application.
I'm building a war file for JBoss
My war is building correctly , I'm using *-war.original as deployment for JBoss
the deployment seems fine
But when I make call to controller, it's throwing a 404
With embedded sever it's working fine
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.service</groupId>
<artifactId>my-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Swagger UI Depedency -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!-- Oracle JDBC driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<java.version>1.8</java.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- <version>2.0.1.RELEASE</version> -->
<!-- https://stackoverflow.com/questions/43641664/why-spring-boot-generate-jar-or-war-file-with-original-extention -->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<phase>package</phase>
<!-- https://stackoverflow.com/questions/30325549/only-generate-one-war-during-package -->
</execution>
</executions>
</plugin>
<!-- This configuration helps to generate war file without web.xml, spring
boot projects -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
SpringBootServletInitializer
#SpringBootApplication
public class ServletInitializer extends SpringBootServletInitializer{
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyApiApplication.class);
}
#Override
public void onStartup(ServletContext servletContext) throws ServletException{
super.onStartup(servletContext);
}
}
Deployment log
12:01:09,605 INFO [stdout] (ServerService Thread Pool -- 162) ::
Spring Boot :: (v2.0.1.RELEASE)
2018-04-24 12:01:09,605 [ServerService Thread Pool -- 162] INFO (AbstractLoggingWriter.java:71) - :: Spring Boot ::
(v2.0.1.RELEASE)
12:01:09,605 INFO [stdout] (ServerService Thread Pool -- 162)
2018-04-24 12:01:09,605 [ServerService Thread Pool -- 162] INFO (AbstractLoggingWriter.java:71) -
12:01:09,669 INFO [com.aerlingus.dei.subscriber.api.ServletInitializer] (ServerService
Thread Pool -- 162) Starting ServletInitializer on USER with PID 10692
(started by ADMIN in C:\pathto\jboss-eap-7.1\bin)
2018-04-24 12:01:09,669 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - Starting ServletInitializer on CND7064JRN with
PID 10692 (started by ADMIN in C:\pathto\jboss-eap-7.1\bin)
2018-04-24 12:01:09,669 [ServerService Thread Pool -- 162] DEBUG (JBossLog.java:134) - Running with Spring Boot v2.0.1.RELEASE, Spring
v5.0.5.RELEASE
12:01:09,670 INFO [com.aerlingus.dei.subscriber.api.ServletInitializer] (ServerService
Thread Pool -- 162) The following profiles are active: uat
2018-04-24 12:01:09,670 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - The following profiles are active: uat
12:01:09,686 INFO [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext]
(ServerService Thread Pool -- 162) Refreshing
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#5023cb50:
startup date [Tue Apr 24 12:01:09 BST 2018]; root of context hierarchy
2018-04-24 12:01:09,686 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - Refreshing
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#5023cb50:
startup date [Tue Apr 24 12:01:09 BST 2018]; root of context hierarchy
12:01:09,805 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor]
(ServerService Thread Pool -- 162) JSR-330 'javax.inject.Inject'
annotation found and supported for autowiring
2018-04-24 12:01:09,805 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - JSR-330 'javax.inject.Inject' annotation found
and supported for autowiring
12:01:09,816 INFO [io.undertow.servlet] (ServerService Thread Pool -- 162) Initializing Spring embedded WebApplicationContext
2018-04-24 12:01:09,816 [ServerService Thread Pool -- 162] INFO (ServletContextImpl.java:360) - Initializing Spring embedded
WebApplicationContext
12:01:09,816 INFO [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 162) Root WebApplicationContext:
initialization completed in 130 ms
2018-04-24 12:01:09,816 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - Root WebApplicationContext: initialization
completed in 130 ms
12:01:09,987 INFO [org.springframework.boot.web.servlet.FilterRegistrationBean]
(ServerService Thread Pool -- 162) Mapping filter: 'errorPageFilter'
to: [/*]
2018-04-24 12:01:09,987 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - Mapping filter: 'errorPageFilter' to: [/*]
12:01:10,015 INFO [com.aerlingus.dei.subscriber.api.ServletInitializer] (ServerService
Thread Pool -- 162) Started ServletInitializer in 0.683 seconds (JVM
running for 4712.635)
2018-04-24 12:01:10,015 [ServerService Thread Pool -- 162] INFO (JBossLog.java:134) - Started ServletInitializer in 0.683 seconds (JVM
running for 4712.635)
12:01:10,021 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService
Thread Pool -- 162) Initializing Mojarra 2.2.13.SP3 for context
'/my-api'
2018-04-24 12:01:10,021 [ServerService Thread Pool -- 162] INFO (ConfigureListener.java:213) - Initializing Mojarra 2.2.13.SP3 for
context '/my-api'
12:01:11,566 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 162) WFLYUT0021: Registered web context: '/my-api' for
server 'default-server'
2018-04-24 12:01:11,566 [ServerService Thread Pool -- 162] INFO (Host.java:220) - WFLYUT0021: Registered web context: '/my-api' for
server 'default-server'
12:01:11,583 INFO [org.jboss.as.server] (External Management Request Threads -- 3) WFLYSRV0010: Deployed "my-api.war" (runtime-name
: "my-api.war")
2018-04-24 12:01:11,583 [External Management Request Threads -- 3] INFO (DeploymentHandlerUtil.java:171) - WFLYSRV0010: Deployed
"my-api.war" (runtime-name : "my-api.war")
WEB-INF/jboss-web.xml
<jboss-web>
<context-root>my-api</context-root>
</jboss-web>
similar to this
Getting "404 - Not found" error with Wildfly and springboot
Finally figured out what was wrong in I did, I have an Application class with main method without #SpringBootApplication along with SpringBootServletInitializer , So Jboss was not picking up the mapping correctly
The resolution was to make SpringBootServletInitializer class with main method. So I change ServletInitializermentioned in question
#SpringBootApplication
public class ServletInitializer extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(ServletInitializer.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ServletInitializer.class);
}
#Override
public void onStartup(ServletContext servletContext) throws ServletException{
super.onStartup(servletContext);
}
}
After that I was able to hit endpoint,
Why I didn't do this earlier ??
I generated the project using
SPRING INITIALIZR with war packaging, When SPRING INITIALIZR generate project Application and SpringBootServletInitializer classes was there.
Among both classes Appliaction class has the main method and #SpringBootApplication annotation
While writing Integration test initially it was not working , Then I change #SpringBootApplication annotation to SpringBootServletInitializer and write a main method in SpringBootServletInitializer test start working. But I kept the main method back in Appliaction class that was the root cause of this issue.
Since Spring Initializer, generate the classes I was in assumption , all classes generated are required to build war .So I kept the Application class the way it's generated without #SpringBootApplication annotation while generating war file. I think Jboss got confused which main method it should run. And eventually throwing a 404 exception while hitting end point

How connect to embedded activeMQ in spring boot using Hawtio?

I have spring boot application contains embedded activeMQ, i want to connect to web console using hawtio but not able to connect .
i do the following steps :
1-in cmd "java -jar hawtio-app-1.5.7.jar".
2- trying connect to Host : localhost port : 1099 Path : /api/jolokia
but not working return the following :
Failed to load resource: the server responded with a status of 500 (localhost:1099 failed to respond)
Pom.xml
<!-- Starter for building web, including RESTful, applications using Spring
MVC. Uses Tomcat as the default embedded container -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- the embedded container dependencies as “provided” -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- Logging libraries -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- WebSocket libraries -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- reactor project libraries -->
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bus</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-net</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.33.Final</version>
</dependency>
<!-- Email -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>sockjs-client</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>stomp-websocket</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-stomp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-kahadb-store</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.7.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
the below log startup :
`2018-02-13;00:31:26.976 [localhost-startStop-1] INFO
o.s.b.w.s.ServletRegistrationBean.onStartup(190) - Mapping servlet: 'dispatcherServlet' to [/]
2018-02-13;00:31:27.016 [localhost-startStop-1] INFO
o.s.b.w.s.FilterRegistrationBean.configure(258) - Mapping filter: 'characterEncodingFilter' to: [/*]
2018-02-13;00:31:27.019 [localhost-startStop-1] INFO
o.s.b.w.s.FilterRegistrationBean.configure(258) - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-02-13;00:31:27.021 [localhost-startStop-1] INFO
o.s.b.w.s.FilterRegistrationBean.configure(258) - Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-02-13;00:31:27.022 [localhost-startStop-1] INFO
o.s.b.w.s.FilterRegistrationBean.configure(258) - Mapping filter: 'requestContextFilter' to: [/*]
2018-02-13;00:31:28.938 [main] INFO
o.s.s.c.ThreadPoolTaskExecutor.initialize(165) - Initializing ExecutorService 'clientInboundChannelExecutor'
2018-02-13;00:31:28.976 [main] INFO
o.s.s.c.ThreadPoolTaskExecutor.initialize(165) - Initializing ExecutorService 'clientOutboundChannelExecutor'
2018-02-13;00:31:29.434 [main] INFO
o.s.s.c.ThreadPoolTaskScheduler.initialize(165) - Initializing ExecutorService 'messageBrokerTaskScheduler'
2018-02-13;00:31:29.567 [main] INFO
o.s.w.s.s.s.WebSocketHandlerMapping.registerHandler(362) - Mapped URL path [/websocket/**] onto handler of type [class org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler]
2018-02-13;00:31:29.627 [main] INFO
o.s.s.c.ThreadPoolTaskExecutor.initialize(165) - Initializing ExecutorService 'brokerChannelExecutor'
2018-02-13;00:31:30.895 [main] WARN
o.a.activemq.broker.BrokerService.checkMemorySystemUsageLimits(2146) - Memory Usage for the Broker (1024mb) is more than the maximum available for the JVM: 512 mb - resetting to 70% of maximum available: 358 mb
2018-02-13;00:31:31.096 [main] INFO
o.a.activemq.broker.BrokerService.doStartPersistenceAdapter(671) - Using Persistence Adapter: KahaDBPersistenceAdapter[C:\Users\anash\git\Notfication\activemq-data\localhost\KahaDB]
2018-02-13;00:31:31.111 [JMX connector] INFO
o.a.a.broker.jmx.ManagementContext.run(155) - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
2018-02-13;00:31:31.721 [main] INFO
o.a.a.store.kahadb.MessageDatabase.read(191) - KahaDB is version 6
2018-02-13;00:31:31.747 [main] INFO
o.a.a.store.kahadb.MessageDatabase.recover(678) - Recovering from the journal #1:1026194
2018-02-13;00:31:31.768 [main] INFO
o.a.a.store.kahadb.MessageDatabase.recover(706) - Recovery replayed 253 operations from the journal in 0.037 seconds.
2018-02-13;00:31:31.965 [main] INFO
o.a.a.s.kahadb.plist.PListStoreImpl.doStart(371) - PListStore:[C:\Users\anash\git\Notfication\activemq-data\localhost\tmp_storage] started
2018-02-13;00:31:32.136 [main] INFO
o.a.activemq.broker.BrokerService.doStartBroker(734) - Apache ActiveMQ 5.14.5 (localhost, ID:SPS-Anash-49217-1518474691990-0:1) is starting
2018-02-13;00:31:32.159 [main] INFO
o.a.a.t.TransportServerThreadSupport.doStart(69) - Listening for connections at: stomp://127.0.0.1:61613
2018-02-13;00:31:32.160 [main] INFO
o.a.a.broker.TransportConnector.start(263) - Connector stomp://127.0.0.1:61613 started
2018-02-13;00:31:32.164 [main] INFO
o.a.activemq.broker.BrokerService.doStartBroker(761) - Apache ActiveMQ 5.14.5 (localhost, ID:SPS-Anash-49217-1518474691990-0:1) started
2018-02-13;00:31:32.165 [main] INFO
o.a.activemq.broker.BrokerService.doStartBroker(762) - For help or more information please see: http://activemq.apache.org
2018-02-13;00:31:32.169 [main] WARN `
You need to enable Jolokia endpoint on your Spring Boot app and make it accessible outside of the app.
To do so, firstly you need to add spring-boot-actuator in pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
Then in your application.properties, disable sensitivity of the Jolokia endpoint:
endpoints.jolokia.sensitive = false
Now you should be able to connect to Jolokia at: http://localhost:8080/jolokia Try connecting to it from your hawtio console.
FYI, here you can find a working example of hawtio integration with a Spring Boot app:
https://github.com/hawtio/hawtio/blob/hawtio-1.5.7/hawtio-sample-springboot/

Spring Boot Application immediately shuts down after starting

I am working currently on a project which includes the Spring Framework. Everything is working as aspect but there is one problem. When I try to start my application onto my laptop it immediately shuts down after startup. It is working on every other machine, so this problem occurs only on my laptop.
Maybe you got an idea what could force this problem ? I am working with IntelliJ and I haven´t found any solutions for this problem.
PC Specs
Laptop is a AsusN550JK( modified RAM and SSD)
Intel Core i7-4700HQ CPU#2.4 GHz
16 GB Ram
500 GB SSD Samsung EVO 840
1 TB HDD
64 Bit OS - Windows 10
ConsoleOutput
Exclusions:
-----------
None
Unconditional classes:
----------------------
org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
2017-04-22 21:24:15.756 INFO 6300 --- [ main] com.objectbay.test.me.Application : Started Application in 8.012 seconds (JVM running for 9.251)
2017-04-22 21:24:15.758 INFO 6300 --- [ Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#6fb0d3ed: startup date [Sat Apr 22 21:24:08 CEST 2017]; root of context hierarchy
2017-04-22 21:24:15.763 INFO 6300 --- [ Thread-3] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-04-22 21:24:15.764 INFO 6300 --- [ Thread-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-04-22 21:24:15.765 INFO 6300 --- [ Thread-3] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2017-04-22 21:24:15.771 DEBUG 6300 --- [ Thread-3] org.hibernate.SQL : drop table person if exists
2017-04-22 21:24:15.782 INFO 6300 --- [ Thread-3] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
Process finished with exit code 0
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-accessing-data-rest</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
Full example which is not working on my machine
Spring Guide Rest example
Console - LOG after Updating Dependencies
LOG after Updating Dependencies
Add this dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
For me what caused this was that I had this property below, in the application properties (carried over by mistake from a test application.properties file). See if any of your property files that are included have this like below, and remove it:
# disables the servlet-container initialization (for unit testing only)
spring.main.web-application-type=none
Problem is solved - thanks for your help crazycoder.
The issue was caused by an older version of tomcat. After upating the embedded tomcat of Spring to 1.5.3_RELEASE and updating mysql-jdbc-driver as well , it finally worked for me.
I adjusted the pom.xml like this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
I met the same problem, I fix by these steps as below:
update file application.yml
1- remove:
main:
web-application-type: none
2- if your change server port already, it's still error:
Identify and stop the process that's listening on port 8080 or
configure this application to listen on another port.
solution: move server port config on the top of yml file
Done! it's for my case.

Resources