I am trying to learn spring boot Webclient. In order to understand "non-blocking" HTTP requests, I made two spring boot applications
Spring Boot REST API server : This has a simple REST endpoint with a 10 seconds sleep to hold the request.
REST Client : A simple (non web) spring boot application which will call the REST API server by using RestTemplate and Webclient. I am using both to visually understand the non blocking behavior.
See the code for the REST API Server
#RestController
#RequestMapping("/api")
public class UserApi {
#GetMapping(path = "/test")
public String test() {
System.out.println("Test Request Started");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Test Request Ended");
return "OK";
}
}
Code of the REST client
public class RestClient{
public void restTemplate() {
RestTemplate restTemplate = new RestTemplate();
String string = restTemplate.getForObject("http://localhost:8080/api/test", String.class);
System.out.println(string);
}
public void webClient() {
Mono<String> bodyToMono = WebClient.create("http://localhost:8080/")
.get()
.uri("/api/test")
.retrieve()
.bodyToMono(String.class);
bodyToMono.subscribe(System.out::println);
}
}
And I am calling this class from my Spring Boot Main method as
#SpringBootApplication
public class WebClientApplication {
public static void main(String[] args) {
SpringApplication.run(WebClientApplication.class, args);
RestClient restClient = new RestClient();
System.out.println("Testing with Webclient");
restClient.webClient();
System.out.println("Testing with RestTemplate");
restClient.restTemplate();
}
}
Problem :
I get the following exception which I have no reason :
Caused by: reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ Request to GET http://localhost:8080/api/test [DefaultWebClient]
Stack trace:
If you want to see the detailed log :
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.0.RELEASE)
2020-05-16 16:32:17.506 INFO 9928 --- [ restartedMain] c.w.server.client.WebClientApplication : Starting WebClientApplication on DESKTOP-054O660 with PID 9928 (D:\eclipse-jee-2019-09-R-win32-x86_64\workspace\WebClientDemoServer\client\target\classes started by Akshay in D:\eclipse-jee-2019-09-R-win32-x86_64\workspace\WebClientDemoServer\client)
2020-05-16 16:32:17.506 INFO 9928 --- [ restartedMain] c.w.server.client.WebClientApplication : No active profile set, falling back to default profiles: default
2020-05-16 16:32:17.631 INFO 9928 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-05-16 16:32:17.631 INFO 9928 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-05-16 16:32:19.004 DEBUG 9928 --- [ restartedMain] reactor.netty.tcp.TcpResources : [http] resources will use the default LoopResources: DefaultLoopResources {prefix=reactor-http, daemon=true, selectCount=4, workerCount=4}
2020-05-16 16:32:19.007 DEBUG 9928 --- [ restartedMain] reactor.netty.tcp.TcpResources : [http] resources will use the default ConnectionProvider: reactor.netty.resources.PooledConnectionProvider#6eb63cda
2020-05-16 16:32:19.053 INFO 9928 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-05-16 16:32:19.121 INFO 9928 --- [ restartedMain] c.w.server.client.WebClientApplication : Started WebClientApplication in 2.446 seconds (JVM running for 3.272)
Testing with Webclient
2020-05-16 16:32:20.680 DEBUG 9928 --- [ restartedMain] r.netty.resources.DefaultLoopEpoll : Default Epoll support : false
2020-05-16 16:32:20.688 DEBUG 9928 --- [ restartedMain] r.netty.resources.DefaultLoopKQueue : Default KQueue support : false
2020-05-16 16:32:20.893 DEBUG 9928 --- [ restartedMain] r.n.resources.PooledConnectionProvider : Creating a new client pool [PoolFactory {maxConnections=500, pendingAcquireMaxCount=-1, pendingAcquireTimeout=45000, maxIdleTime=-1, maxLifeTime=-1, metricsEnabled=false}] for [localhost:8080]
Testing with RestTemplate
2020-05-16 16:32:21.369 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df] Created a new pooled channel, now 1 active connections and 0 inactive connections
2020-05-16 16:32:21.440 DEBUG 9928 --- [ctor-http-nio-1] reactor.netty.channel.BootstrapHandlers : [id: 0x77afe9df] Initialized pipeline DefaultChannelPipeline{(BootstrapHandlers$BootstrapInitializerHandler#0 = reactor.netty.channel.BootstrapHandlers$BootstrapInitializerHandler), (PooledConnectionProvider$PooledConnectionAllocator$PooledConnectionInitializer#0 = reactor.netty.resources.PooledConnectionProvider$PooledConnectionAllocator$PooledConnectionInitializer), (reactor.left.httpCodec = io.netty.handler.codec.http.HttpClientCodec), (reactor.left.decompressor = io.netty.handler.codec.http.HttpContentDecompressor), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
2020-05-16 16:32:21.457 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] Registering pool release on close event for channel
2020-05-16 16:32:21.458 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] Channel connected, now 1 active connections and 0 inactive connections
2020-05-16 16:32:21.459 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] onStateChange(PooledConnection{channel=[id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080]}, [connected])
2020-05-16 16:32:21.473 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] onStateChange(GET{uri=/, connection=PooledConnection{channel=[id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080]}}, [configured])
2020-05-16 16:32:21.475 DEBUG 9928 --- [ctor-http-nio-1] r.netty.http.client.HttpClientConnect : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] Handler is being applied: {uri=http://localhost:8080/api/test, method=GET}
2020-05-16 16:32:21.477 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] onStateChange(GET{uri=/api/test, connection=PooledConnection{channel=[id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080]}}, [request_prepared])
2020-05-16 16:32:21.517 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080] onStateChange(GET{uri=/api/test, connection=PooledConnection{channel=[id: 0x77afe9df, L:/127.0.0.1:52476 - R:localhost/127.0.0.1:8080]}}, [request_sent])
OK
2020-05-16 16:32:26.476 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 ! R:localhost/127.0.0.1:8080] Channel closed, now 0 active connections and 0 inactive connections
2020-05-16 16:32:26.476 DEBUG 9928 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider : [id: 0x77afe9df, L:/127.0.0.1:52476 ! R:localhost/127.0.0.1:8080] onStateChange(GET{uri=/api/test, connection=PooledConnection{channel=[id: 0x77afe9df, L:/127.0.0.1:52476 ! R:localhost/127.0.0.1:8080]}}, [response_incomplete])
2020-05-16 16:32:26.491 WARN 9928 --- [ctor-http-nio-1] r.netty.http.client.HttpClientConnect : [id: 0x77afe9df, L:/127.0.0.1:52476 ! R:localhost/127.0.0.1:8080] The connection observed an error
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
2020-05-16 16:32:26.491 WARN 9928 --- [ctor-http-nio-1] reactor.netty.channel.FluxReceive : [id: 0x77afe9df, L:/127.0.0.1:52476 ! R:localhost/127.0.0.1:8080] An exception has been observed post termination
reactor.core.Exceptions$ErrorCallbackNotImplemented: reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
Caused by: reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ Request to GET http://localhost:8080/api/test [DefaultWebClient]
Stack trace:
I am using tomcat in the REST API server :
Logs of server are also attached:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.0.RELEASE)
2020-05-16 16:36:25.661 INFO 6812 --- [ restartedMain] c.w.s.WebClientDemoServerApplication : Starting WebClientDemoServerApplication on DESKTOP-054O660 with PID 6812 (D:\eclipse-jee-2019-09-R-win32-x86_64\workspace\WebClientDemoServer\server\target\classes started by Akshay in D:\eclipse-jee-2019-09-R-win32-x86_64\workspace\WebClientDemoServer\server)
2020-05-16 16:36:25.661 INFO 6812 --- [ restartedMain] c.w.s.WebClientDemoServerApplication : No active profile set, falling back to default profiles: default
2020-05-16 16:36:25.723 INFO 6812 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-05-16 16:36:25.723 INFO 6812 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-05-16 16:36:26.942 INFO 6812 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-05-16 16:36:26.955 INFO 6812 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-05-16 16:36:26.955 INFO 6812 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-05-16 16:36:27.049 INFO 6812 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-05-16 16:36:27.049 INFO 6812 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1326 ms
2020-05-16 16:36:27.283 INFO 6812 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-16 16:36:27.455 DEBUG 6812 --- [ restartedMain] reactor.netty.tcp.TcpResources : [http] resources will use the default LoopResources: DefaultLoopResources {prefix=reactor-http, daemon=true, selectCount=4, workerCount=4}
2020-05-16 16:36:27.471 DEBUG 6812 --- [ restartedMain] reactor.netty.tcp.TcpResources : [http] resources will use the default ConnectionProvider: reactor.netty.resources.PooledConnectionProvider#7f6d3bcb
2020-05-16 16:36:27.487 INFO 6812 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-05-16 16:36:27.533 INFO 6812 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-05-16 16:36:27.549 INFO 6812 --- [ restartedMain] c.w.s.WebClientDemoServerApplication : Started WebClientDemoServerApplication in 2.36 seconds (JVM running for 3.545)
2020-05-16 16:36:39.781 INFO 6812 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-05-16 16:36:39.789 INFO 6812 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-05-16 16:36:39.791 INFO 6812 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
Test Request Started
Test Request Started
Test Request Ended
Test Request Ended
For future readers. I had a similar issue, I've fixed it by adding ReactorClientHttpConnector to Webclient creation process.
BEFORE:
this.webClient = WebClient.builder()
.baseUrl(url)
.build();
AFTER:
this.webClient = WebClient.builder()
.baseUrl(url)
.clientConnector(new ReactorClientHttpConnector(HttpClient.newConnection().compress(true)))
.build();
Spring Boot version: 2.3.6
Reactor netty version: 0.9.14
Good luck!
Related
I am trying to build a Kafka Consumer using Spring Boot. It's a multi-module Maven project where consumer-app is the SpringBoot application and rest of the modules are added as dependencies to the parent project.
With this, I am able to build the project and run the app as well. But the app is not connecting to the Kafka broker (bootstrap server on my local).
Log ends as this:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.12.RELEASE)
2022-06-28 20:26:50.849 INFO 17284 --- [ restartedMain] c.t.c.c.c.CardConsumerApplication : Starting CardConsumerApplication on WorkIsOn with PID 17284 (C:\Users\myuser\Workspace\card-consumer\card-consumer\target\classes started by myuser in C:\Users\myuser\Workspace\card-consumer)
2022-06-28 20:26:50.851 INFO 17284 --- [ restartedMain] c.t.c.c.c.CardConsumerApplication : No active profile set, falling back to default profiles: default
2022-06-28 20:26:50.900 INFO 17284 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-06-28 20:26:50.901 INFO 17284 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-06-28 20:26:51.778 INFO 17284 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9090 (http)
2022-06-28 20:26:51.784 INFO 17284 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-06-28 20:26:51.785 INFO 17284 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2022-06-28 20:26:51.850 INFO 17284 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-06-28 20:26:51.850 INFO 17284 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 949 ms
2022-06-28 20:26:51.977 INFO 17284 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2022-06-28 20:26:52.157 INFO 17284 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2022-06-28 20:26:52.182 INFO 17284 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9090 (http) with context path ''
2022-06-28 20:26:52.189 INFO 17284 --- [ restartedMain] c.t.c.c.c.CardConsumerApplication : Started CardConsumerApplication in 1.688 seconds (JVM running for 3.215)
Now, I made another app with the code of Kafka consumer module in a non-multi-module Maven project, I am able to connect to the Kafka's bootstrap server and this app is able to get the message as well.
I have same SpringBoot configuration placed in both the application/project.
Please help me understand how to make this multi-module Maven app work.
i have a application.yml to auto-creation some table:
## JDBC part
spring:
config:
activate:
on-profile: local
enabled: true
datasource:
url: jdbc:mysql://localhost:3306/kazi?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
driver-class-name: com.mysql.cj.jdbc.Driver
username: emo
password: 123qwe
jpa:
show-sql: true
database-platform: org.hibernate.dialect.MySQL8Dialect
hibernate:
ddl-auto: update
liquibase:
change-log: classpath:liquibase/changelog.xml
#spring.jpa.properties.hibernate.hbm2ddl.import_files=import.sql
main class:
#EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class)
#SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Log
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=57211:/Applications/IntelliJ IDEA.app/Contents/bin -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath /Users/emoleumassi/Documents/Projects/me/kazi/kazi-core/target/classes:/Users/emoleumassi/.m2/repository/org/liquibase/liquibase-core/4.5.0/liquibase-core-4.5.0.jar:/Users/emoleumassi/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/Users/emoleumassi/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/Users/emoleumassi/.m2/repository/org/liquibase/liquibase-maven-plugin/3.8.2/liquibase-maven-plugin-3.8.2.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-project/2.0/maven-project-2.0.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-profile/2.0/maven-profile-2.0.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-model/2.0/maven-model-2.0.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-artifact-manager/2.0/maven-artifact-manager-2.0.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar:/Users/emoleumassi/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar:/Users/emoleumassi/.m2/repository/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.jar:/Users/emoleumassi/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.jar:/Users/emoleumassi/.m2/repository/junit/junit/4.13.2/junit-4.13.2.jar:/Users/emoleumassi/.m2/repository/org/hamcrest/hamcrest-core/2.2/hamcrest-core-2.2.jar:/Users/emoleumassi/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar:/Users/emoleumassi/.m2/repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar:/Users/emoleumassi/.m2/repository/ch/qos/logback/logback-classic/1.2.9/logback-classic-1.2.9.jar:/Users/emoleumassi/.m2/repository/ch/qos/logback/logback-core/1.2.9/logback-core-1.2.9.jar:/Users/emoleumassi/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.13.1/jackson-module-jaxb-annotations-2.13.1.jar:/Users/emoleumassi/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.1/jackson-annotations-2.13.1.jar:/Users/emoleumassi/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.1/jackson-core-2.13.1.jar:/Users/emoleumassi/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.1/jackson-databind-2.13.1.jar:/Users/emoleumassi/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/Users/emoleumassi/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.6.2/spring-boot-starter-data-jpa-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.6.2/spring-boot-starter-aop-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/aspectj/aspectjweaver/1.9.7/aspectjweaver-1.9.7.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.6.2/spring-boot-starter-jdbc-2.6.2.jar:/Users/emoleumassi/.m2/repository/com/zaxxer/HikariCP/4.0.3/HikariCP-4.0.3.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-jdbc/5.3.14/spring-jdbc-5.3.14.jar:/Users/emoleumassi/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/Users/emoleumassi/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar:/Users/emoleumassi/.m2/repository/org/hibernate/hibernate-core/5.6.3.Final/hibernate-core-5.6.3.Final.jar:/Users/emoleumassi/.m2/repository/org/jboss/logging/jboss-logging/3.4.2.Final/jboss-logging-3.4.2.Final.jar:/Users/emoleumassi/.m2/repository/net/bytebuddy/byte-buddy/1.11.22/byte-buddy-1.11.22.jar:/Users/emoleumassi/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/emoleumassi/.m2/repository/org/jboss/jandex/2.2.3.Final/jandex-2.2.3.Final.jar:/Users/emoleumassi/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/Users/emoleumassi/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.1.2.Final/hibernate-commons-annotations-5.1.2.Final.jar:/Users/emoleumassi/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.5/jaxb-runtime-2.3.5.jar:/Users/emoleumassi/.m2/repository/org/glassfish/jaxb/txw2/2.3.5/txw2-2.3.5.jar:/Users/emoleumassi/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.12/istack-commons-runtime-3.0.12.jar:/Users/emoleumassi/.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/data/spring-data-jpa/2.6.0/spring-data-jpa-2.6.0.jar:/Users/emoleumassi/.m2/repository/org/springframework/data/spring-data-commons/2.6.0/spring-data-commons-2.6.0.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-orm/5.3.14/spring-orm-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-context/5.3.14/spring-context-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-tx/5.3.14/spring-tx-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-beans/5.3.14/spring-beans-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-aspects/5.3.14/spring-aspects-5.3.14.jar:/Users/emoleumassi/.m2/repository/mysql/mysql-connector-java/8.0.27/mysql-connector-java-8.0.27.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter/2.6.2/spring-boot-starter-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.6.2/spring-boot-starter-logging-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.17.0/log4j-to-slf4j-2.17.0.jar:/Users/emoleumassi/.m2/repository/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar:/Users/emoleumassi/.m2/repository/org/slf4j/jul-to-slf4j/1.7.32/jul-to-slf4j-1.7.32.jar:/Users/emoleumassi/.m2/repository/org/yaml/snakeyaml/1.29/snakeyaml-1.29.jar:/Users/emoleumassi/.m2/repository/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-core/5.3.14/spring-core-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-jcl/5.3.14/spring-jcl-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-security/2.6.2/spring-boot-starter-security-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-aop/5.3.14/spring-aop-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/security/spring-security-config/5.6.1/spring-security-config-5.6.1.jar:/Users/emoleumassi/.m2/repository/org/springframework/security/spring-security-core/5.6.1/spring-security-core-5.6.1.jar:/Users/emoleumassi/.m2/repository/org/springframework/security/spring-security-crypto/5.6.1/spring-security-crypto-5.6.1.jar:/Users/emoleumassi/.m2/repository/org/springframework/security/spring-security-web/5.6.1/spring-security-web-5.6.1.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-expression/5.3.14/spring-expression-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/spring-web/5.3.14/spring-web-5.3.14.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.6.2/spring-boot-starter-tomcat-2.6.2.jar:/Users/emoleumassi/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/emoleumassi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.56/tomcat-embed-core-9.0.56.jar:/Users/emoleumassi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.56/tomcat-embed-el-9.0.56.jar:/Users/emoleumassi/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.56/tomcat-embed-websocket-9.0.56.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-devtools/2.6.2/spring-boot-devtools-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot/2.6.2/spring-boot-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.6.2/spring-boot-autoconfigure-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.6.2/spring-boot-starter-actuator-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.6.2/spring-boot-actuator-autoconfigure-2.6.2.jar:/Users/emoleumassi/.m2/repository/org/springframework/boot/spring-boot-actuator/2.6.2/spring-boot-actuator-2.6.2.jar:/Users/emoleumassi/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.1/jackson-datatype-jsr310-2.13.1.jar:/Users/emoleumassi/.m2/repository/io/micrometer/micrometer-core/1.8.1/micrometer-core-1.8.1.jar:/Users/emoleumassi/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.12/HdrHistogram-2.1.12.jar:/Users/emoleumassi/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar:/Users/emoleumassi/.m2/repository/org/projectlombok/lombok/1.18.16/lombok-1.18.16.jar:/Users/emoleumassi/.m2/repository/org/projectlombok/lombok-mapstruct-binding/0.2.0/lombok-mapstruct-binding-0.2.0.jar com.kazi.Application
19:21:19.040 [Thread-0] DEBUG org.springframework.boot.devtools.restart.classloader.RestartClassLoader - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader#32d703c9
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.2)
2022-01-24 19:21:19.677 INFO 28392 --- [ restartedMain] com.kazi.Application : Starting Application using Java 11.0.11 on FVFFF491Q05N.fritz.box with PID 28392 (/kazi/kazi-core/target/classes started by in //kazi)
2022-01-24 19:21:19.678 INFO 28392 --- [ restartedMain] com.kazi.Application : No active profile set, falling back to default profiles: default
2022-01-24 19:21:19.743 INFO 28392 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in //.m2/repository/org/liquibase/liquibase-core/4.5.0/liquibase-core-4.5.0.jar referenced one or more files that do not exist: file://.m2/repository/org/liquibase/liquibase-core/4.5.0/snakeyaml-1.27.jar
2022-01-24 19:21:19.745 INFO 28392 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-01-24 19:21:19.745 INFO 28392 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-01-24 19:21:21.125 INFO 28392 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-01-24 19:21:21.132 INFO 28392 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-01-24 19:21:21.132 INFO 28392 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-01-24 19:21:21.208 INFO 28392 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-01-24 19:21:21.209 INFO 28392 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1464 ms
2022-01-24 19:21:21.656 INFO 28392 --- [ restartedMain] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 6b57bd8f-9f75-40b5-8805-d33182a6782f
2022-01-24 19:21:21.719 INFO 28392 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#585f2fd, org.springframework.security.web.context.SecurityContextPersistenceFilter#217e757f, org.springframework.security.web.header.HeaderWriterFilter#54ef1e31, org.springframework.security.web.csrf.CsrfFilter#1323ecfd, org.springframework.security.web.authentication.logout.LogoutFilter#50c74237, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#31cfd78a, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#175a6ba7, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#74ce9809, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#1143ca59, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#4de8bf20, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#272d7d98, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#7bd095cb, org.springframework.security.web.session.SessionManagementFilter#7d64f793, org.springframework.security.web.access.ExceptionTranslationFilter#8fd5915, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#53681a29]
2022-01-24 19:21:21.782 INFO 28392 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2022-01-24 19:21:21.835 INFO 28392 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-01-24 19:21:21.856 INFO 28392 --- [ restartedMain] com.kazi.Application : Started Application in 2.798 seconds (JVM running for 3.673)
The application start successfully but the tables haven't created. I tried it with ddl-auto: create und have the same problem.
I think the application.yml isn't load.
The location:
I think no Datasource in this app.
#EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class)
try this
#EnableAutoConfiguration
I/O error on POST request for "http://localhost:9411/api/v2/spans": Connect timed out; nested exception is java.net.SocketTimeoutException: Connect timed out
2021-11-24 10:17:30.642 INFO [,,,] 7872 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.2.RELEASE)
2021-11-24 10:17:31.942 INFO [service,,,] 7872 --- [ restartedMain] ServiceApplication : No active profile set, falling back to default profiles: default
2021-11-24 10:17:35.956 INFO [service,,,] 7872 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2021-11-24 10:17:36.883 INFO [service,,,] 7872 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 901ms. Found 27 JPA repository interfaces.
2021-11-24 10:17:38.737 INFO [service,,,] 7872 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=f090e4ad-27c8-34fa-89ba-eeeccacd1fd9
2021-11-24 10:17:42.104 INFO [service,,,] 7872 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9194 (http)
2021-11-24 10:17:42.149 INFO [service,,,] 7872 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-11-24 10:17:42.150 INFO [service,,,] 7872 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2021-11-24 10:17:42.661 INFO [service,,,] 7872 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-11-24 10:17:42.662 INFO [service,,,] 7872 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 10646 ms
2021-11-24 10:17:43.074 INFO [service,,,] 7872 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-11-24 10:17:43.494 INFO [service,,,] 7872 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-11-24 10:17:43.517 INFO [service,,,] 7872 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:postgresql://localhost:5432/codeis'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/Hp/.m2/repository/org/springframework/spring-core/5.2.8.RELEASE/spring-core-5.2.8.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-11-24 10:17:46.238 WARN [school-erp-service,,,] 7872 --- [ restartedMain] o.s.c.s.zipkin2.ZipkinAutoConfiguration : Check result of the [org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender#41a2805a] contains an error [CheckResult{ok=false, error=org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:9411/api/v2/spans": Connect timed out; nested exception is java.net.SocketTimeoutException: Connect timed out}]
What mistake I make?
I am not using the Zipkin server.
Why throw such type of error how to resolve it?
I am using zuul API gateway.
Check your build dependency tree, there must be an entry for spring-cloud-starter-sleuth. In case you are planning not to use it, then remove it.
The firewall is not turned off
$ systemctl stop firewalld
I don't understand why my spring boot app takes 15 seconds to start when I run it in regular mode vs 15 minutes when I run it in debug mode.
Debug mode Logs:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
2020-02-28 16:57:27.214 INFO [my-project,,,] 5740 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://config-server.my-company.org
2020-02-28 16:57:29.442 INFO [my-project,,,] 5740 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=my-project, profiles=[dev], label=null, version=c656a6ca556f4fc58135e673a7e5c4e97a2e5088, state=null
2020-02-28 16:57:33.537 INFO [my-project,,,] 5740 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-02-28 16:57:33.537 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4023 ms
2020-02-28 16:57:37.986 INFO [my-project,,,] 5740 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-02-28 17:00:22.158 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-02-28 17:02:21.271 WARN [my-project,,,] 5740 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-02-28 17:03:37.441 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 16 endpoint(s) beneath base path '/actuator'
2020-02-28 17:04:22.272 INFO [my-project,,,] 5740 --- [ restartedMain] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2020-02-28 17:04:58.404 WARN [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-02-28 17:04:58.416 INFO [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-28 17:04:58.753 WARN [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-02-28 17:04:58.765 INFO [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-28 17:05:58.718 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-02-28 17:07:05.596 INFO [my-project,,,] 5740 --- [ restartedMain] o.e.s.filters.AnnotationSizeOfFilter : Using regular expression provided through VM argument org.ehcache.sizeof.filters.AnnotationSizeOfFilter.pattern for IgnoreSizeOf annotation : ^.*cache\..*IgnoreSizeOf$
2020-02-28 17:07:29.728 INFO [my-project,,,] 5740 --- [ restartedMain] c.my-company.security.idp.BeanFactory : override default IdpOAuthManager userInfoCallDisabled = true, IdpUser will only contains uid
2020-02-28 17:08:24.056 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService
2020-02-28 17:09:58.919 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request org.springframework.web.filter.CorsFilter#7430bc1e,
2020-02-28 17:12:03.101 INFO [my-project,,,] 5740 --- [ restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2020-02-28 17:12:05.749 INFO [my-project,,,] 5740 --- [ restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#69e6f894]
2020-02-28 17:12:17.850 INFO [my-project,,,] 5740 --- [ restartedMain] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2020-02-28 17:13:54.484 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-02-28 17:13:54.837 INFO [my-project,,,] 5740 --- [ restartedMain] c.d.i.b.p.MySpringBootApplication : Started MySpringBootApplication in 988.725 seconds (JVM running for 989.776)
2020-02-28 17:14:17.835 INFO [my-project,,,] 5740 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 6879 ms
2020-02-28 17:14:35.004 INFO [my-project,b5277242974c5225,b5277242974c5225,false] 5740 --- [nio-8080-exec-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://config-server.my-company.org
2020-02-28 17:14:42.858 INFO [my-project,b5277242974c5225,b5277242974c5225,false] 5740 --- [nio-8080-exec-1] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=my-project, profiles=[dev], label=null, version=c656a6ca556f4fc58135e673a7e5c4e97a2e5088, state=null
Any help or explanation would be appreciated.
Thanks
You probably have a breakpoint on a method call, those can slow down a Java application by quite a lot, instead if you can try to put your breakpoint on the first line of code in the method.
Breakpoints or conditional breakpoints usually cause this issue. Remove all breakpoints and run it.
I'm trying to get working the SOAP web consumer example given in spring doc
spring doc
However, I keep getting the following when I try to run the Applicaiton class as Spring Boot App.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.RELEASE)
2016-10-14 10:58:08.193 INFO 4496 --- [ main] hello.Application : Starting Application on bumblebee with PID 4496 (C:\Users\menuka\workspace\monkey-api-netbeans\gs-consuming-web-service-complete\target\classes started by menuka in C:\Users\menuka\workspace\monkey-api-netbeans\gs-consuming-web-service-complete)
2016-10-14 10:58:08.196 INFO 4496 --- [ main] hello.Application : No active profile set, falling back to default profiles: default
2016-10-14 10:58:08.244 INFO 4496 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#37918c79: startup date [Fri Oct 14 10:58:08 PDT 2016]; root of context hierarchy
2016-10-14 10:58:08.808 INFO 4496 --- [ main] o.s.oxm.jaxb.Jaxb2Marshaller : Creating JAXBContext with context path [hello.wsdl]
2016-10-14 10:58:08.900 INFO 4496 --- [ main] o.s.ws.soap.saaj.SaajSoapMessageFactory : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
2016-10-14 10:58:08.902 DEBUG 4496 --- [ main] o.s.ws.soap.saaj.SaajSoapMessageFactory : Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl]
2016-10-14 10:58:09.067 INFO 4496 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-10-14 10:58:09.076 INFO 4496 --- [ main] hello.WeatherClient : Requesting forecast for 94304
2016-10-14 10:58:09.083 DEBUG 4496 --- [ main] o.s.ws.client.core.WebServiceTemplate : Opening [org.springframework.ws.transport.http.HttpUrlConnection#2fc6f97f] to [http://wsf.cdyne.com/WeatherWS/Weather.asmx]
2016-10-14 10:58:09.155 DEBUG 4496 --- [ main] o.s.ws.client.MessageTracing.sent : Sent request [SaajSoapMessage {http://ws.cdyne.com/WeatherWS/}GetCityForecastByZIP]
2016-10-14 10:58:21.633 DEBUG 4496 --- [ main] o.s.ws.client.MessageTracing.received : Received response [SaajSoapMessage {http://schemas.xmlsoap.org/soap/envelope/}Fault] for request [SaajSoapMessage {http://ws.cdyne.com/WeatherWS/}GetCityForecastByZIP]
2016-10-14 10:58:21.633 DEBUG 4496 --- [ main] o.s.ws.client.core.WebServiceTemplate : Received Fault message for request [SaajSoapMessage {http://ws.cdyne.com/WeatherWS/}GetCityForecastByZIP]
2016-10-14 10:58:21.637 INFO 4496 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2016-10-14 10:58:21.643 ERROR 4496 --- [ main] o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:803) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:784) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:771) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
at hello.Application.main(Application.java:15) [classes/:na]
Caused by: org.springframework.ws.soap.client.SoapFaultClientException: Server was unable to process request. ---> Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:830) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:624) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at hello.WeatherClient.getCityForecastByZip(WeatherClient.java:29) ~[classes/:na]
at hello.Application.lambda$lookup$0(Application.java:26) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
... 6 common frames omitted
2016-10-14 10:58:21.644 INFO 4496 --- [ main] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#37918c79: startup date [Fri Oct 14 10:58:08 PDT 2016]; root of context hierarchy
2016-10-14 10:58:21.646 INFO 4496 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
What is going on here? Can anybody advise here me?
This SOAP action is not available at the moment.
You can try it yourself on a browser: http://wsf.cdyne.com/WeatherWS/Weather.asmx?op=GetCityForecastByZIP
If you enter 94304 and hit "Invoke" you get error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)