Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java auto reconfiguration issue : why we need to specified “JBP_CONFIG_SPRING_AUTO_RECONFIGURATION '{enabled: false}'” the environment variable with the database and we didn’t need it for my application. #160

Closed
sirishareddiroutu opened this issue Jul 15, 2021 · 5 comments
Labels
question Further information is requested

Comments

@sirishareddiroutu
Copy link

The scenario we are facing with:

There are 2 apps that are connected to 2 user-provided service instances which is RDS. APP 1 and DB1 are able to connect successfully without any mention of autoconfiguration false in the environment variables and were deployed last year.

The APP 2 and DB2 crashes without the mention of “JBP_CONFIG_SPRING_AUTO_RECONFIGURATION '{enabled: false}'" if we mention this in env var the app2 starts and able to connect to DB2.

But when I try to connect to App2 with DB1 it successfully runs without the env var addition [autoreconfiguration false].

The Question is why app1 and app2 are able to connect to the db1 without mention of autoconfiguration but the the same apps are not able to connect to db2 without the autoconfiguration env var.

Can you please help us by providing the reason for this scenario we are facing with?

@sirishareddiroutu
Copy link
Author

We would like to understand why for one service we do not need the java-cfenv-boot library, and for another we need it. Could you help us with that?
We do not use this library java-cfenv-boot library in any of our apps.
We would prefer to remain platform agnostic to ease future migration processes if needed.

@spikymonkey
Copy link
Contributor

I think we'll need some more information to be able to diagnose this one, and if you want to continue to use the buildpack autoreconfiguration feature then I think this could be a question for the Java buildpack rather than java-cfenv. I understand the Java Buildpack backs off from autoconfiguration if certain conditions apply (such as described in the Limitations section here), but without seeing the apps, bindings, buildpack version or logs I can't really say what's happening. A small sample project that reproduces the issue could really help.

@sirishareddiroutu
Copy link
Author

sirishareddiroutu commented Jul 19, 2021

When I had deployed the application on the CF platform.

I have received these error logs when the app starts and try to connect to the database.

See bellow an extract of the log:

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT 2021-05-25 14:54:47.860 ERROR 7 --- [ main] c.z.h.p.HikariPool : HikariPool-1 - Exception during pool initialization.

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT java.sql.SQLException: Access denied for user 'user'@'ip'---here the ip is the diego cell ip. (using password: YES)

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-java-8.0.22.jar:8.0.22]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.5.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at org.springframework.jdbc.datasource.DelegatingDataSource.getConnection(DelegatingDataSource.java:99) ~[spring-jdbc-5.3.3.jar:5.3.3]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at org.cloudfoundry.reconfiguration.org.springframework.cloud.service.relational.UrlDecodingDataSource.getConnection(UrlDecodingDataSource.java:82) ~[spring_auto_reconfiguration-2.11.0_RELEASE.jar:?]

2021-05-25T16:54:47.86+0200 [APP/PROC/WEB/0] OUT at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]

@sirishareddiroutu
Copy link
Author

Later I have redeployed a version of my application without adding the “java-cfenv-boot” jar within the app.
As I noticed it will be added automatically by the java-build pack, and I have set the environment variable “JBP_CONFIG_SPRING_AUTO_RECONFIGURATION '{enabled: false}'”. With this configuration, the application is able to start and access the database.

It is acceptable as the jar we deliver does not include the specific CF library. But still remaining confused why we need to specify the environment variable JBP_CONFIG_SPRING_AUTO_RECONFIGURATION with this database and we didn’t need it for the application.

@pivotal-david-osullivan pivotal-david-osullivan added the question Further information is requested label Apr 7, 2022
@pivotal-david-osullivan
Copy link
Member

Hi @sirishareddiroutu, revisiting this issue, it seems you were able to resolve the problem you were seeing via configuration. If there is still an outstanding question, please provide more details here, otherwise I can proceed to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants