Spring-Integration: int:http:inbound-channel-adapter throws 403 after spring-boot upgrade to 1.4 - rest

After Upgrading Spring-Boot from 1.3.7.RELEASE to 1.4.0.RELEASE I get the issue, when calling my rest service by inbound-channel-adapter, it throws a HttpClientErrorException.
Configuration inbound-channel-adapter:
<int-http:inbound-channel-adapter
channel="api_app_integration_request_channel"
supported-methods="PUT"
path="/process/ticket"
request-payload-type="*.model.Ticket"
header-mapper="headerMapper"
error-channel="internal-client-rest-ticket-error-channel"
>
<int-http:request-mapping consumes="application/json" />
</int-http:inbound-channel-adapter>
Restservice-Call:
private static final String URL = "http://localhost:8080/process/ticket";
public void openTicket(final Profile profile, final Ticket ticket) {
final HttpHeaders headers = new HttpHeaders();
headers.set(Profile.PROFILE, profile.toString());
final HttpEntity<Ticket> entity = new HttpEntity<Ticket>(ticket, headers);
template.exchange(URL, HttpMethod.PUT, entity, Ticket.class);
}
Exception:
org.springframework.web.client.HttpClientErrorException: 403 null
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:667)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:498)
at *.client.rest.simulator.ProblemReporter.openTicket(ProblemReporter.java:28)
at *.client.SassRestSimulatorApplication.lambda$0(SassRestSimulatorApplication.java:96)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.SliceOps$1$1.accept(SliceOps.java:204)
at java.util.stream.StreamSpliterators$InfiniteSupplyingSpliterator$OfRef.tryAdvance(StreamSpliterators.java:1356)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at *.client.SassRestSimulatorApplication.executeApplication(SassRestSimulatorApplication.java:96)
at *.client.SassRestSimulatorApplication.main(SassRestSimulatorApplication.java:47)
Debug-Output
2016-08-07 18:56:24.022 DEBUG 16288 --- [ main] o.s.web.client.RestTemplate : Created PUT request for "http://localhost:8080/process/ticket"
2016-08-07 18:56:24.180 DEBUG 16288 --- [ main] o.s.web.client.RestTemplate : Setting request Accept header to [application/json, application/*+json]
2016-08-07 18:56:24.223 DEBUG 16288 --- [ main] o.s.web.client.RestTemplate : Writing [Ticket# 1: [SIDE1-BS1-SP1] [SIDE1-BS1-SP1] [emergency] [NEW] Urgend problem. Fix immediately or revenue will be lost!] using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#18918d70]
2016-08-07 18:56:24.331 DEBUG 16288 --- [ main] o.s.web.client.RestTemplate : PUT request for "http://localhost:8080/process/ticket" resulted in 403 (null); invoking error handler
I tried int-http:inbound-gateway BUT with same result.
When accessing service directly via Postman I get an 403 - Access denied and no logging found:
I am little bit supried about access denied, I don't use any security framework.
Under Spring-Boot 1.3.7.RELEASE works fine:
Logging-Output:
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Bound request context to thread: org.apache.catalina.connector.RequestFacade#32818b2d
2016-08-07 20:03:23.098 DEBUG 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing PUT request for [/process/ticket]
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#23764bec] in DispatcherServlet with name 'dispatcherServlet'
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.w.s.handler.SimpleUrlHandlerMapping : No handler mapping found for [/process/ticket]
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#5fa0d972] in DispatcherServlet with name 'dispatcherServlet'
2016-08-07 20:03:23.098 DEBUG 9372 --- [nio-8080-exec-4] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /process/ticket
2016-08-07 20:03:23.098 DEBUG 9372 --- [nio-8080-exec-4] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/process/ticket]
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Testing handler map [org.springframework.integration.http.inbound.IntegrationRequestMappingHandlerMapping#64dfb31d] in DispatcherServlet with name 'dispatcherServlet'
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Testing handler adapter [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#35467187]
2016-08-07 20:03:23.098 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Testing handler adapter [org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter#52466d8b]
2016-08-07 20:03:23.100 DEBUG 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2016-08-07 20:03:23.100 TRACE 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade#32818b2d
2016-08-07 20:03:23.100 DEBUG 9372 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Successfully completed request
2016-08-07 20:03:23.119 DEBUG 9372 --- [ sassExecutor-1] o.s.web.client.RestTemplate : Created PUT request for "http://localhost:8080/process/ticket"
2016-08-07 20:03:23.120 DEBUG 9372 --- [ sassExecutor-1] o.s.web.client.RestTemplate : Writing [Ticket# 666: [SIDE1-BS1-SP1] ] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#4d3ce1c0]
2016-08-07 20:03:23.126 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Bound request context to thread: org.apache.catalina.connector.RequestFacade#32818b2d
2016-08-07 20:03:23.127 DEBUG 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing PUT request for [/process/ticket]
2016-08-07 20:03:23.128 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#23764bec] in DispatcherServlet with name 'dispatcherServlet'
2016-08-07 20:03:23.128 TRACE 9372 --- [nio-8080-exec-5] o.s.w.s.handler.SimpleUrlHandlerMapping : No handler mapping found for [/process/ticket]
2016-08-07 20:03:23.128 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#5fa0d972] in DispatcherServlet with name 'dispatcherServlet'
2016-08-07 20:03:23.128 DEBUG 9372 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /process/ticket
2016-08-07 20:03:23.129 DEBUG 9372 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/process/ticket]
2016-08-07 20:03:23.129 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Testing handler map [org.springframework.integration.http.inbound.IntegrationRequestMappingHandlerMapping#64dfb31d] in DispatcherServlet with name 'dispatcherServlet'
2016-08-07 20:03:23.129 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Testing handler adapter [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#35467187]
2016-08-07 20:03:23.129 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Testing handler adapter [org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter#52466d8b]
2016-08-07 20:03:23.130 DEBUG 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2016-08-07 20:03:23.130 TRACE 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade#32818b2d
2016-08-07 20:03:23.130 DEBUG 9372 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Successfully completed request
2016-08-07 20:03:23.134 DEBUG 9372 --- [ sassExecutor-1] o.s.web.client.RestTemplate : PUT request for "http://localhost:8080/process/ticket" resulted in 200 (OK)
Ticket# 666: [SIDE1-BS1-SP1] [SIDE1-BS1-SP1] [low] [DECRYPTED] Ich bin von Postman gesendet worden
====== EDIT =======
Under Spring Boot 1.4.0 I get following Debug-Informations when calling the rest service:
2016-08-08 19:21:35.382 DEBUG 8268 --- [nio-8080-exec-2] o.a.coyote.http11.Http11InputBuffer : Received [PUT /process/ticket HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 206
Cache-Control: no-cache
Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
profile: 192.168.56.102:10000
Content-Type: application/json
Accept: */*
Accept-Encoding: gzip, deflate, sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
{"ticketId":666,"issueDateTime":"2016-06-27","description":"Ich bin von Postman gesendet worden","sender":"SIDE1-BS1-SP1","receiver":"SIDE1-BS1-SP1","priority":"low","secured":"NEW","mimeType":"text/plain"}]
2016-08-08 19:21:35.383 DEBUG 8268 --- [nio-8080-exec-2] o.a.c.authenticator.AuthenticatorBase : Security checking request PUT /process/ticket
2016-08-08 19:21:35.383 DEBUG 8268 --- [nio-8080-exec-2] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2016-08-08 19:21:35.383 DEBUG 8268 --- [nio-8080-exec-2] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2016-08-08 19:21:35.383 DEBUG 8268 --- [nio-8080-exec-2] o.apache.catalina.core.StandardWrapper : Returning non-STM instance
2016-08-08 19:21:35.384 DEBUG 8268 --- [nio-8080-exec-2] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper#16ab5cb1:org.apache.tomcat.util.net.NioChannel#5a719bf2:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:57863]], Status in: [OPEN_READ], State out: [OPEN]
Spring-Boot-Starter:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
====
Example-Application:
Under Spring-Boot 1.3.7 Works, 1.4.0 Error like described.
Dropboxlink: link

Well, since you have a Spring Boot there it really looks like the spring-security in classpath causes a Security auto-configuration (SecurityAutoConfiguration).
Try to switch on --debug option when you start the application and look into auto-configuration for the "security" word.
OTOH you showed the first logs for Tomcat, but they say nothing about the further process with DispatcherServlet.
Can we see those logs?
UPDATE
Thank you for sample application. Unfortunately that works for me:
:: Spring Boot :: (v1.4.0.RELEASE)
2016-08-11 11:35:36.762 INFO 8636 --- [ main] com.example.RestSimulatorApplication : Starting RestSimulatorApplication on HOME with PID 8636 (D:\SpringIO\Spring140IntegrationTest\target\classes started by abilan in D:\SpringIO\Spring140IntegrationTest)
...
'dispatcherServlet': initialization started
2016-08-11 11:35:39.694 INFO 8636 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 11 ms
Ticket# 1: [emergency] [NEW] Urgend problem. Fix immediately or revenue will be lost!
Ticket# 2: [medium] [NEW] There is an issue; take a look whenever you have time.
Ticket# 3: [emergency] [NEW] Urgend problem. Fix immediately or revenue will be lost!
Ticket# 4: [medium] [NEW] There is an issue; take a look whenever you have time.
I tried it on Windows and Mac with the same good results.
Maybe you have some Fire Wall on your machine with the rule do not allow requests with some header or something else?..

Related

Getting exception when running Okta Spring Security & Okta-Hosted Login Page example

I followed the steps in this sample code: https://github.com/okta/samples-java-spring/tree/master/okta-hosted-login
When I run the example using the command:
mvn -Dokta.oauth2.issuer=https://{yourOktaDomain}/oauth2/default \ -Dokta.oauth2.clientId={clientId} \ -Dokta.oauth2.clientSecret={clientSecret}
I get the following exception:
`2023-02-06 11:08:41.717 INFO 17288 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-02-06 11:08:41.725 INFO 17288 --- [ main] c.o.s.e.CodeFlowExampleApplication : Started CodeFlowExampleApplication in 2.881 seconds (JVM running for 5.358)
2023-02-06 11:08:53.299 INFO 17288 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-02-06 11:08:53.299 INFO 17288 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-02-06 11:08:53.301 INFO 17288 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms
2023-02-06 11:08:53.558 ERROR 17288 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.thymeleaf.context.IWebContext.getExchange()Lorg/thymeleaf/web/IWebExchange;] with root cause
java.lang.NoSuchMethodError: org.thymeleaf.context.IWebContext.getExchange()Lorg/thymeleaf/web/IWebExchange;
at org.thymeleaf.extras.springsecurity5.util.Spring5VersionSpecificUtility.isWebMvcContext(Spring5VersionSpecificUtility.java:80) ~[thymeleaf-extras-springsecurity5-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.extras.springsecurity5.util.SpringVersionSpecificUtils.isWebMvcContext(SpringVersionSpecificUtils.java:118) ~[thymeleaf-extras-springsecurity5-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.extras.springsecurity5.util.SpringSecurityContextUtils.getAuthenticationObject(SpringSecurityContextUtils.java:127) ~[thymeleaf-extras-springsecurity5-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.extras.springsecurity5.auth.AuthUtils.getAuthenticationObject(AuthUtils.java:102) ~[thymeleaf-extras-springsecurity5-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.thymeleaf.extras.springsecurity5.dialect.expression.SpringSecurityExpressionObjectFactory.buildObject(SpringSecurityExpressionObjectFactory.java:91) ~[thymeleaf-extras-springsecurity5-3.1.1.RELEASE.jar:3.1.1.RELEASE]
...`
I also tried running this sample from my Intellij IDEA IDE and when I open it I get the following error:
'parent.relativePath' of POM com.example.okta:okta-spring-boot-oauth-code-flow-example:0.0.1-SNAPSHOT (C:\Users\fteran\repos\demos\okta-github\samples-java-spring\okta-hosted-login\pom.xml) points at com.okta.examples:aggregator instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure
I was kind of expecting the sample code to work if I was very careful to follow the instructions, which I think I did, at this point I am not sure if this is an issue on my local or if there is an issue with the sample code itself.
Try this example: https://github.com/okta-samples/okta-spring-boot-sample/
It's more up-to-date.

writing to sqlite failed due to database locked file

i'm newbie with springboot jpa and get error on writing to sqlite database table,
reading from table is working nomarly.
[SQLITE_BUSY] The database file is locked. (database is locked)
Here is the detail log:
2022-01-25 13:05:45.295 INFO 2001 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-01-25 13:05:45.296 INFO 2001 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-01-25 13:05:45.297 INFO 2001 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
Hibernate: select bike0_.id as id1_0_, bike0_.contact as contact2_0_, bike0_.email as email3_0_, bike0_.model as model4_0_, bike0_.name as name5_0_, bike0_.phone as phone6_0_, bike0_.purchase_date as purchase7_0_, bike0_.purchase_price as purchase8_0_, bike0_.serial_number as serial_n9_0_ from bike bike0_
Hibernate: select bike0_.id as id1_0_0_, bike0_.contact as contact2_0_0_, bike0_.email as email3_0_0_, bike0_.model as model4_0_0_, bike0_.name as name5_0_0_, bike0_.phone as phone6_0_0_, bike0_.purchase_date as purchase7_0_0_, bike0_.purchase_price as purchase8_0_0_, bike0_.serial_number as serial_n9_0_0_ from bike bike0_ where bike0_.id=?
Hibernate: select next_val as id_val from hibernate_sequence
Hibernate: update hibernate_sequence set next_val= ? where next_val=?
2022-01-25 13:06:00.068 WARN 2001 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 5, SQLState: null
2022-01-25 13:06:00.070 ERROR 2001 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : [SQLITE_BUSY] The database file is locked (database is locked)
2022-01-25 13:06:00.120 ERROR 2001 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.CannotAcquireLockException: error performing isolated work; SQL [n/a]; nested exception is org.hibernate.exception.LockAcquisitionException: error performing isolated work] with root cause
org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
at org.sqlite.core.DB.newSQLException(DB.java:1030) ~[sqlite-jdbc-3.36.0.3.jar:na]
at org.sqlite.core.DB.newSQLException(DB.java:1042) ~[sqlite-jdbc-3.36.0.3.jar:na]
at org.sqlite.core.DB.throwex(DB.java:1007) ~[sqlite-jdbc-3.36.0.3.jar:na]
at org.sqlite.core.DB.exec(DB.java:178) ~[sqlite-jdbc-3.36.0.3.jar:na]
at org.sqlite.SQLiteConnection.commit(SQLiteConnection.java:421) ~[sqlite-jdbc-3.36.0.3.jar:na]
at com.zaxxer.hikari.pool.ProxyConnection.commit(ProxyConnection.java:387) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.HikariProxyConnection.commit(HikariProxyConnection.java) ~[HikariCP-4.0.3.jar:na]
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:60) ~[hibernate-core-5.6.4.Final.jar:5.6.4.Final]
Please help me on this.
thank in advanced
Kbg
enter image description here
enter image description here
you have to unlock the database file before you can write on it.

Swagger can't start in jhipster when using Eclipse

I'm working on application with jhipster. It was good so far however today I have an issue that I can't resolve.
When I use Eclipse I can't start application. I suppose that it is caused of Swagger can't start.
It looks like that:
The Class-Path manifest attribute in C:\Users\twloszki\.m2\repository\org\liquibase\liquibase-core\3.5.5\liquibase-core-3.5.5.jar referenced one or more files that do not exist: file:/C:/Users/twloszki/.m2/repository/org/liquibase/liquibase-core/3.5.5/lib/snakeyaml-1.13.jar
13:22:12.567 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
13:22:12.567 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
13:22:12.567 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/GSMR/ICOMS-web/target/classes/]
██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗
██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝
██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
:: JHipster 🤓 :: Running Spring Boot 1.5.14.RELEASE ::
:: http://www.jhipster.tech ::
2019-01-21 13:22:13.580 INFO 2492 --- [ restartedMain] com.App : Starting App on PC
2019-01-21 13:22:13.580 DEBUG 2492 --- [ restartedMain] com.App : Running with Spring Boot v1.5.14.RELEASE, Spring v4.3.18.RELEASE
2019-01-21 13:22:13.580 INFO 2492 --- [ restartedMain] com.App : The following profiles are active: swagger,dev
2019-01-21 13:22:13.861 DEBUG 2492 --- [kground-preinit] org.jboss.logging : Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2019-01-21 13:22:16.660 DEBUG 2492 --- [ restartedMain] p.w.g.config.AsyncConfiguration : Creating Async Task Executor
2019-01-21 13:22:17.347 DEBUG 2492 --- [ restartedMain] p.w.g.config.MetricsConfiguration : Registering JVM gauges
2019-01-21 13:22:17.472 DEBUG 2492 --- [ restartedMain] p.w.g.config.MetricsConfiguration : Monitoring the datasource
2019-01-21 13:22:17.472 DEBUG 2492 --- [ restartedMain] p.w.g.config.MetricsConfiguration : Initializing Metrics JMX reporting
2019-01-21 13:22:18.421 DEBUG 2492 --- [ restartedMain] com.config.WebConfigurer : Registering CORS filter
2019-01-21 13:22:18.625 INFO 2492 --- [ restartedMain] com.config.WebConfigurer : Web application configuration, using profiles: swagger
2019-01-21 13:22:18.625 DEBUG 2492 --- [ restartedMain] com.config.WebConfigurer : Initializing Metrics registries
2019-01-21 13:22:18.625 DEBUG 2492 --- [ restartedMain] com.config.WebConfigurer : Registering Metrics Filter
2019-01-21 13:22:18.625 DEBUG 2492 --- [ restartedMain] com.config.WebConfigurer : Registering Metrics Servlet
2019-01-21 13:22:18.625 INFO 2492 --- [ restartedMain] com.config.WebConfigurer : Web application fully configured
2019-01-21 13:22:18.922 DEBUG 2492 --- [ restartedMain] p.w.g.config.DatabaseConfiguration : Configuring Liquibase
2019-01-21 13:22:18.937 WARN 2492 --- [port-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2019-01-21 13:22:23.527 DEBUG 2492 --- [ restartedMain] c.ehcache.core.Ehcache-usersByLogin : Initialize successful.
2019-01-21 13:22:23.527 DEBUG 2492 --- [ restartedMain] c.ehcache.core.Ehcache-usersByEmail : Initialize successful.
2019-01-21 13:22:23.543 DEBUG 2492 --- [ restartedMain] c.e.c.E.w.g.domain.DictionaryValue : Initialize successful.
2019-01-21 13:22:23.543 DEBUG 2492 --- [ restartedMain] c.e.c.E.w.g.domain.DictionaryType : Initialize successful.
2019-01-21 13:22:23.543 DEBUG 2492 --- [ restartedMain] c.e.c.E.domain.Line : Initialize successful.
2019-01-21 13:22:23.543 DEBUG 2492 --- [ restartedMain] c.e.c.E.domain.Section : Initialize successful.
2019-01-21 13:22:23.583 DEBUG 2492 --- [ restartedMain] c.e.c.E.domain.WorkCost : Initialize successful.
2019-01-21 13:22:23.585 DEBUG 2492 --- [ restartedMain] c.e.c.E.domain.WorkAttachment : Initialize successful.
The next step should be:
2019-01-21 13:07:24.089 DEBUG 10764 --- [ restartedMain] i.g.j.c.apidoc.SwaggerConfiguration : Starting Swagger
2019-01-21 13:07:24.096 DEBUG 10764 --- [ restartedMain] i.g.j.c.apidoc.SwaggerConfiguration : Started Swagger in 6 ms
Somehow swagger can't start and nothing happen.
Edit: The funny thing is that I can run my application with mvnw command in cmd.
I found solution. I tried to turn on my application in debug mode however when I just run it everything was okay. I removed all breakpoints that I had in code and that helped me.

Zuul cannot connect to Eureka

I have a Eureka server running ok and a service connecting to it.
Now, I'm trying to connect a Zuul server to Eureka, but it isn't working.
I configure Zuul like this:
zuul:
ignoredServices: "*"
routes:
contacts-service:
path: /contacts/**
serviceId: contacts-service
eureka:
instance:
preferIpAddress: true
client:
serviceUrl:
defaultZone: http://eureka:admin#127.0.0.1:8761/eureka/
and my class as
#SpringBootApplication
#EnableZuulServer
#EnableDiscoveryClient
public class EdgeApplication {
public static void main(String[] args) {
SpringApplication.run(EdgeApplication.class, args);
}
}
It never show in eureka neither nothing on the zuul logs eureka-related. Seems like I'm still missing something.
Edit
When I changed to #EnableZuulProxy, I get an error and the zuul service is still not shown at Eureka server
2016-10-06 23:26:46.574 WARN 8303 --- [nio-8080-exec-3] o.s.c.n.z.filters.post.SendErrorFilter : Error during filtering
com.netflix.zuul.exception.ZuulException: Forwarding error
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:164) ~[spring-cloud-netflix-core-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:139) ~[spring-cloud-netflix-core-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:84) ~[spring-cloud-netflix-core-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.2.2.jar:1.2.2]
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) ~[zuul-core-1.2.2.jar:1.2.2]
at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161) ~[zuul-core-1.2.2.jar:1.2.2]
at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120) ~[zuul-core-1.2.2.jar:1.2.2]
at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96) ~[zuul-core-1.2.2.jar:1.2.2]
at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116) ~[zuul-core-1.2.2.jar:1.2.2]
at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81) ~[zuul-core-1.2.2.jar:1.2.2]
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:157) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequestInternal(ZuulController.java:43) [spring-cloud-netflix-core-1.2.0.RELEASE.jar:1.2.0.RELEASE]
Edit 2
From time to time, I see this in the eureka server logs (not sure if its related or not to my problem, tho):
2016-10-06 23:52:32.824 ERROR 7053 --- [et_localhost-14] c.n.e.cluster.ReplicationTaskProcessor : Batch update failure with HTTP status code 401; discarding 1 replication tasks
2016-10-06 23:52:32.825 WARN 7053 --- [et_localhost-14] c.n.eureka.util.batcher.TaskExecutors : Discarding 1 tasks of TaskBatchingWorker-target_localhost-14 due to permanent error
2016-10-06 23:52:38.279 INFO 7053 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 1ms
and right after I call the `/contacts/ endpoint, I see this in the zuul proxy logs:
2016-10-06 23:52:50.256 INFO 9346 --- [nio-8080-exec-1] c.n.u.concurrent.ShutdownEnabledTimer : Shutdown hook installed for: NFLoadBalancer-PingTimer-contacts-service
2016-10-06 23:52:50.309 INFO 9346 --- [nio-8080-exec-1] c.netflix.loadbalancer.BaseLoadBalancer : Client:contacts-service instantiated a LoadBalancer:DynamicServerListLoadBalancer:{NFLoadBalancer:name=contacts-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2016-10-06 23:52:50.316 INFO 9346 --- [nio-8080-exec-1] c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater
2016-10-06 23:52:50.322 INFO 9346 --- [nio-8080-exec-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client contacts-service initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=contacts-service,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:com.netflix.loadbalancer.ConfigurationBasedServerList#29851ac8
2016-10-06 23:52:50.785 WARN 9346 --- [nio-8080-exec-1] o.s.c.n.z.filters.post.SendErrorFilter : Error during filtering
You are missing following dependency in your zuul service:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
I used this below which works for me.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

Externalizing properties for Spring Boot

I know there are quite a few threads on this, but none have solved my issue yet. I have a Spring Boot app that was running in Eclipse and I externalized the parameters in order to deploy to an external Tomcat and keep the properties out of the war. I moved my application.properties out of src/main/resources and into APP_ROOT/config. In catalina.sh, I added this:
JAVA_OPTS="-Dspring.profiles.active=local -Dspring.config.location=$CATALINA_BASE/conf/"
The external build is working fine; however, now it is not starting in Eclipse any longer. I replicated what I did in Tomcat by adding spring.config.location and spring.profiles.active to the VM arguments in the Launch Configuration.
During bootstrapping, it registers an Oracle driver (not the same version I specify in my properties file) and then stops. If I add:
#EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
to my config class so that driver isn't auto-registered, then I get:
No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate]
The odd part is that I tried putting my application.properties back in src/main/resources and removing the VM arguments and I'm getting the same behaviors. This is what I am seeing on startup without excluding the DataSourceAutoConfiguration. Any ideas?
2016-09-30 11:44:59.661 INFO 5150 --- [ main] org.usp.mct.MctApplication : Starting MctApplication on cici-mac.local with PID 5150 (/Users/cici/Documents/workspace-sts-3.7.3.RELEASE/mct.usp.org/target/classes started by cici in /Users/cici/Documents/workspace-sts-3.7.3.RELEASE/mct.usp.org)
2016-09-30 11:44:59.663 INFO 5150 --- [ main] org.usp.mct.MctApplication : The following profiles are active: local
2016-09-30 11:44:59.713 INFO 5150 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#550ee7e5: startup date [Fri Sep 30 11:44:59 EDT 2016]; root of context hierarchy
2016-09-30 11:45:01.005 INFO 5150 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-09-30 11:45:01.019 INFO 5150 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-09-30 11:45:01.088 INFO 5150 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.9.Final}
2016-09-30 11:45:01.089 INFO 5150 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-09-30 11:45:01.091 INFO 5150 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-09-30 11:45:01.127 INFO 5150 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2016-09-30 11:45:01.598 INFO 5150 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
2016-09-30 11:45:01.749 INFO 5150 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [byte[]] overrides previous : org.hibernate.type.BinaryType#70972170
2016-09-30 11:45:01.749 INFO 5150 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [[B] overrides previous : org.hibernate.type.BinaryType#70972170
2016-09-30 11:45:01.750 INFO 5150 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [Byte[]] overrides previous : org.hibernate.type.WrapperBinaryType#69fe0ed4
2016-09-30 11:45:01.750 INFO 5150 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [[Ljava.lang.Byte;] overrides previous : org.hibernate.type.WrapperBinaryType#69fe0ed4
2016-09-30 11:45:02.181 INFO 5150 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2016-09-30 11:45:02.984 INFO 5150 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-09-30 11:45:02.992 INFO 5150 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-09-30 11:45:03.059 INFO 5150 --- [ main] org.usp.mct.MctApplication : Started MctApplication in 3.796 seconds (JVM running for 4.181)
2016-09-30 11:45:03.060 INFO 5150 --- [ Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#550ee7e5: startup date [Fri Sep 30 11:44:59 EDT 2016]; root of context hierarchy
2016-09-30 11:45:03.061 INFO 5150 --- [ Thread-3] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2016-09-30 11:45:03.063 INFO 5150 --- [ Thread-3] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
In this case, I blew away my repo and then re-cloned. Still have to get it working with external parameters instead of src/main/resources/application.properties, but at least I am back to square one.