question

DsevenX-0892 avatar image
0 Votes"
DsevenX-0892 asked SamaraSoucy-MSFT commented

org.springframework.dao.DataAccessResourceFailureException

In my local SpringBoot-Application I can access to my Azure SQL Database, but in the wepapp I got always :
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Could not create JPA EntityManager; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apac
...
org.springframework.dao.DataAccessResourceFailureException

the application.properties-file is always the same.


azure-sql-databaseazure-spring-cloud
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If it is possible to safely do so you can check to make sure the environment variables are loading correctly? If your app is publically accessible then then exposing the actuator endpoints could expose your environment variables.

This requires the spring-boot-starter-actuator dependency. From there you can create an environment variable in the portal: MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: *. That will make your environment variables visible at https://<your application test endpoint>/actuator/env.

Another item to check is the firewall on your Azure SQL Server. The default setting is to allow access from other Azure services, but if this is disabled you will need to manually set the firewall to allow traffic from Spring Cloud.

0 Votes 0 ·

1 Answer

DsevenX-0892 avatar image
0 Votes"
DsevenX-0892 answered SamaraSoucy-MSFT commented

Thanks for your help. I appreciate your support. I did the version with "allow access from other Azure services" and then I mention there every IP-adresses of my APPs. But I think, it is not the smartest one.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If you are allowing access from other Azure resources it's very unlikely that the firewall is the cause. Were you able to check to ensure your configuration was properly loaded with the actuator endpoint?

0 Votes 0 ·

Sorry I do not know, what to do for :
Were you able to check to ensure your configuration was properly loaded with the actuator endpoint?
When I look in the logs - there is no other error, than this above. Are there some key words to check this ?

0 Votes 0 ·

You can verify the spring-boot-starter-actuator dependency. From there you can create an environment variable in the portal: MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: *. That will make your environment variables visible at https://<your application test endpoint>/actuator/env. It's important to note if your endpoint is public, then that exposes your config publicly.

That is the preferred option, but another way to check to ensure that the connection string was properly loaded in would be to set the environment variables through the portal and restart the app. If it is able to connect to the database after setting the variables in the portal, then the issue is probably that the the application.properties file isn't being loaded properly.


0 Votes 0 ·