writing to sqlite failed due to database locked file - spring-data-jpa

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.

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.

Failing to start up HazelCast on AWS ECS

I'm trying to start up Hazelcast on AWS ECS. I have gone through the tutorial and have enabled all the permissions on the task role i.e decribeTasks, lisTasks etc. I have have a very simple configuration file
hazelcast:
cluster-name: hs-dcom-hazelcast
network:
join:
multicast:
enabled: false
aws:
enabled: true
interfaces:
enabled: true
interfaces:
- 10.106.*.*
However when the container tries to start it throws the following error
2023-01-23T14:47:16.975Z INFO 835 --- [ main] com.hazelcast.instance.impl.Node : [10.106.139.69]:5701 [hs-dcom-hazelcast] [5.0-BETA-1] Shutting down node engine...
7467 2023-01-23T14:47:17.004Z INFO 835 --- [ main] c.hazelcast.instance.impl.NodeExtension : [10.106.139.69]:5701 [hs-dcom-hazelcast] [5.0-BETA-1] Destroying node NodeExtension.
7468 2023-01-23T14:47:17.004Z INFO 835 --- [ main] com.hazelcast.instance.impl.Node : [10.106.139.69]:5701 [hs-dcom-hazelcast] [5.0-BETA-1] Hazelcast Shutdown is completed in 35 ms.
! 7469 2023-01-23T14:47:17.006Z WARN 835 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [org/springframework/boot/autoconfigure/hazelcast/HazelcastServerConfiguration$HazelcastServerConfigFileConfiguration.class]: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception with message: Failure executing: POST at: https://ecs.eu-west-1.amazonaws.com. Message: {"__type":"InvalidParameterException","message":"Identifier is for 570169269855. Your accountId is 531465454359"}. HTTP Error Code: 400
7470 2023-01-23T14:47:17.021Z INFO 835 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :
7471
7472 Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
7473 2023-01-23T14:47:17.052Z ERROR 835 --- [ main] o.s.boot.SpringApplication : Application run failed
7474
7475 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [org/springframework/boot/autoconfigure/hazelcast/HazelcastServerConfiguration$HazelcastServerConfigFileConfiguration.class]: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception with message: Failure executing: POST at: https://ecs.eu-west-1.amazonaws.com. Message: {"__type":"InvalidParameterException","message":"Identifier is for 570169269855. Your accountId is 531465454359"}. HTTP Error Code: 400
7476 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657) ~[spring-beans-6.0.3.jar:6.0.3]
7477 at
I have tried looking on the forum, however can't seem to find anyone that has had this issue before.

Spring boot app does not run when putting Amazon RDS endpoint to the datasource URL

My app is running fine locally when testing with Postgres. But I am trying to connect to my RDS database which has Status:'Available' and Publicly acessible: 'Yes'.
RDS environment image
When updating the properties file with Amazon RDS endpoint in the datasource URL I get an error when running the application. The username and password are also correct in the properties file.
Application.properties file image
The error on Intellij console is:
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:313) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.Driver.makeConnection(Driver.java:466) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.Driver.connect(Driver.java:265) ~[postgresql-42.3.1.jar:42.3.1]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
at
... 55 common frames omitted
2022-01-18 23:26:55.667 WARN 18380 --- [ restartedMain] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:313) ~[postgresql-42.3.1.jar:42.3.1]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.3.1.jar:42.3.1]
2022-01-18 23:26:55.667 INFO 18380 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
Hibernate:
drop table if exists employee cascade
2022-01-18 23:26:56.026 INFO 18380 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-01-18 23:27:07.043 ERROR 18380 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: The connection attempt failed.
at
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-01-18 23:27:07.074 ERROR 18380 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
at
Process finished with exit code 0
Any suggestions would be greatly appreciated.
Note that spring is not complaining about wrong username/password. It cannot even connect to the database to check if the username/password is correct.
That indicates a network issue (i.e. there is no network connectivity from your machine to the RDS instance).
Please check if your security group allows access to the given port (5432) from your IP

PGPool not working with HikariCP in SpringBoot application

I have enabled replication for Postgresql and I am using PGPool to make load balancing.
I am having issues to connect to Postgres using HikariCP and even with Apache DBCP.
Is there a way to use PGPool in SpringBoot application?
Please find the configuration file
spring:
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://192.168.177.148:9999/test
username: myUser
password: XXXXXXX
jpa:
properties.hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
database-platform: org.hibernate.dialect.PostgreSQLDialect
hibernate.ddl-auto: update
logging:
level:
org.springframework: DEBUG
Please find the stack trace:
2018-08-10 10:20:19.124 INFO 37879 --- [ main]
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-08-10 10:20:20.617 ERROR 37879 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: FATAL: unable to bind
Detail: cannot get parse message ""
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.SetupQueryRunner.run(SetupQueryRunner.java:53) ~[postgresql-42.2.4.jar:42.2.4]
018-08-10 10:20:20.620 WARN 37879 --- [ main] o.s.b.a.orm.jpa.DatabaseLookup : Unable to determine jdbc url from datasource
More Trace
org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: FATAL: unable to bind
Detail: cannot get parse message ""
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:328) ~[spring-jdbc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:356) ~[spring-jdbc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.boot.autoconfigure.orm.jpa.DatabaseLookup.getDatabase(DatabaseLookup.java:72) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
More Trace
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: FATAL: unable to bind
Detail: cannot get parse message ""
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319) ~[spring-jdbc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
... 61 common frames omitted
Caused by: org.postgresql.util.PSQLException: FATAL: unable to bind
Detail: cannot get parse message ""
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.SetupQueryRunner.run(SetupQueryRunner.java:53) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.v3.ConnectionFactoryImpl.runInitialQueries(ConnectionFactoryImpl.java:674) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:223) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.jdbc.PgConnection.(PgConnection.java:195) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.Driver.makeConnection(Driver.java:454) ~[postgresql-42.2.4.jar:42.2.4]
at org.postgresql.Driver.connect(Driver.java:256) ~[postgresql-42.2.4.jar:42.2.4]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:117) ~[HikariCP-2.7.9.jar:na]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:123) ~[HikariCP-2.7.9.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:365) ~[HikariCP-2.7.9.jar:na]
Our Scenario
We have also almost the same issue on the Kubernetes cluster. The database was closed and HikariCP not able to validate the connection properly. The exception is given by a spring boot application like below:
2020-01-06 09:38:13.013 WARN 1 --- [nio-8080-exec-8] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection#490c2ee7 (This connection has been closed.)
2020-01-06 09:38:13.045 WARN 1 --- [nio-8080-exec-8] org.postgresql.jdbc.PgConnection : Validating connection.
org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:333) ~[postgresql-42.2.2.jar!/:42.2.2]
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) ~[postgresql-42.2.2.jar!/:42.2.2]
... common frames omitted
Caused by: java.io.EOFException: null
at org.postgresql.core.PGStream.receiveChar(PGStream.java:295) ~[postgresql-42.2.2.jar!/:42.2.2]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1947) ~[postgresql-42.2.2.jar!/:42.2.2]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306) ~[postgresql-42.2.2.jar!/:42.2.2]
... 111 common frames omitted
Solution
To fix this issue we supply the following properties for Hikari in spring boot application.
spring.datasource.hikari.leakDetectionThreshold=5000
spring.datasource.hikari.maxLifetime=900000
logging.level.com.zaxxer.hikari=DEBUG
References
https://github.com/brettwooldridge/HikariCP/issues/1237
HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection#2a84e649 (This connection has been closed.)

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

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?..