Java application deploying on Linux platform - java

I am trying to deploy project war file on Linux platform and its giving me following error.
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:1207f4ed-32d0-44e8-ae1c-308b157e9903
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Could not open connection
Server details
Server - Tomcat v8.5
configuration in the property file.
jdbc.url = jdbc:sqlserver://DC01ODSDBDV03;databaseName=ExecDB_Stg;integratedSecurity=true;
hibernate.dialect = org.hibernate.dialect.SQLServer2008Dialect
hibernate.show_sql = true
hibernate.format_sql = true
We have tried adding the following javakerberos property but it didnt work.
authenticationScheme=JavaKerberos
Please help.

To save you a lot of pain really try to convince sql admins to allow you the password authentication.
Otherwise you need to run Tomcat under an AD service account, which is not difficult if you kow how to do that.
I wrote a blog about SPNEGO authentication. you do not need all the steps, it is enough that Tomcat will run as AD service. (until configuring krb5.ini file)

Related

Springboot 2.0 unable to access SQL Server Database

Please some help with an issue I'm getting on the latest Springboot (2.0.3.RELEASE)
I'm getting the following error when trying to access the database. It was working before migrating to the mentioned version of Springboot and Java 10.
Development Enviroment:
-Spring Boot 2.0.3.RELEASE
-JDK / JRE 10 (jdk-10.0.1)
-IDE: Spring Tool Suite 3.9.5.RELEASE
ERROR:
2018-07-19 20:24:37.524 ERROR 12532 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
Caused by: java.io.IOException: SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25
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 com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server did not return a response. The connection has been closed. ClientConnectionId:33a45785-248c-4b57-ba29-f8802ddd8b25".
I followed the migration guide but without success. I have also tried different configuration found in the web, but nothing addresses this issue.
Is this happening because of the Spring / Java version.
Note the DataSource configuration in the application.properties:
#CURRENT DATASOURCE CONFIG
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.url=jdbc:sqlserver://xxx.xxx.x.xx;databaseName=XXX
spring.datasource.hikari.username=user
spring.datasource.hikari.password=password
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto = none
spring.jpa.show-sql=true
#FOLLOWING CONFIG ARE JUST FOR REFERENCE. I TRIED THEM AS PER BLOGS
#spring.datasource.hikari.dataSourceClassName=com.microsoft.sqlserver.jdbc.SQLServerDataSource
#spring.datasource.url=jdbc:sqlserver://XXX.XXX.X.XX;databaseName=XXX
#spring.datasource.url=jdbc:sqlserver://XXX.XXX.X.XX:1433/XXX
#spring.datasource.type=
#spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
#spring.datasource.tomcat.max-active=1
#spring.datasource.username=wstapp
#spring.datasource.password=wstapp#test
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDataSource
#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
#spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
I have been looking for a reason this current week. Some advice on a Correct Configuration would be helpful.
Thanks in advance.
It's a MSSQL-JDBC issue. The answer by: Nitin Vavdiya pointed me in the right direction.
I found the "solution" here: https://github.com/Microsoft/mssql-jdbc/issues/719
I just modified the java.security file in the JRE Install folder and remove the value: 3DES_EDE_CBC from the jdk.tls.disabledAlgorithms in the file:
Program Files\Java\"JRE Version"\lib\security
The following is the exact answer that helped me:
To improve the strength of SSL/TLS connections, 3DES cipher suites have been disabled in SSL/TLS connections in the JDK via the jdk.tls.disabledAlgorithms Security Property.
(http://www.oracle.com/technetwork/java/javase/8u171-relnotes-4308888.html)
After changing java.security and removing 3DES_EDE_CBC from jdk.certpath.disabledAlgorithms everything works fine. I'm not sure what needs to be changed in SQLServer config to disable 3DES as an SSL scheme though.

portgresql server version 10 - FATAL: password authentication failed for user "postgres"

I'm trying to open a web application in the browser with Tomcat. But when I debug or start Tomcat, I get this error. The database username in the web.xml file in the Dynamic Web Project and in PostgreSQL is already "postgres".
I get:
"HTTP Status 404" error
when I run the server. I do not understand why it's making this mistake.
Don't Set Password for PostgreSQL, leave it empty and it will solve your problem.

HTTP Status 500 - Request processing failed in shopizer

After following the instruction of buildin Shopizer from this link
https://github.com/shopizer-ecommerce/shopizer
and after building and moving sm-shop.war to Tomcat webapps folder and then accessing the url:
http://localhost:8080/sm-shop/shop
I'm facing this error
HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
So, what is the problem, can anybody help ?
It expects this DB configuration.
You have two options:
Configure your own local DB and fill it with your connection and authentication details (config is using MySQL).
Uncomment H2 database config and comment out MySQL config. H2 is embedded database and therefore you wouldn't need to install anything.

Mysql communication error in tomcat even with out using any mysql in application

I am Getting following error when ever i am starting my tomcat
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection refused
I am getting this error even with out using any application in my tomcat.
Could you please help me why tomcat is looking for mysql connect at the time of start
Regards
May be you have configured a Tomcat Datasource Resource in your server.xml or context.xml in your ${CATALINA_BASE}/conf directory. So, whenever tomcat starts it tries to create the connection pool for your datasource and it is not able to communicate to the db server host. This is highly possible if you don't use mysql in your application

GlassFish Server does not connect to SQL database (error w.r.t. SQL driver)

I am using a brand new developing pc and need to test a personal application that runs on a local GlassFish server 3.1.2 and should connect with a local SQL database called 'funkOneDB' (my IDE is NetBeans 7.2.1). But I can't get the GlassFish server to connect with the database, and the problem seems to be related to the (place of the) SQL driver in the GlassFish Server's directories (more problem specifics in a few lines).
I am fairly certain I correctly set up the related JDBC Resource and Connection Pool on the GlassFish Server (as I mimic a set-up already existing and working properly on another developing pc).
The Resource specifics are:
jndi name: jdbc/FunkResource
pool name: FunkPool
The (most important) Pool specifics are:
pool name: FunkPool
resource type: javax.sql.Datasource
datasource classname: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
additional properties correspond to the specifics in the XML GlassFish-resources of the application (username, password, url, etc.; no problems there)
I first placed the necessary SQL driver in the GlassFish Server's directories, i.e. the file mysql-connector-java-5.1.18-bin.jar at ..\GlassFish3\GlassFish\domains\domain1\lib\ext.
Yet, when I perform a ping test from the JDBC Pool 'FunkPool' at the GlassFish server, I get the following error:
Ping Connection Pool failed for FunkPool. WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.SQLError], because it has not yet been started, or was already stopped Please check the server.log for more details.
In the server.log I only find the following extra logging exception and failure info:
(i) Exception while creating an unpooled [test] connection for pool [ FunkPool ], WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.SQLError], because it has not yet been started, or was already stopped
(ii) RestResponse.getResponse() gives FAILURE. endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=FunkPool}'
Note however, that when I ping the database funkOneDB from my IDE NetBeans via jdbc:mysql://localhost:33066/funkOneDB, it's succesful. As already mentioned, the credentials and other data I use for this IDE-based ping are the same data I use in the JDBC Connection Pool.
I searched for the problem also on stackoverflow for some. And I did find some people talking about it, like
Glassfisch MySQL ping ERROR (no answer by anybody), or
Struggling to create MySQL Connection Pool on Glassfish (tried that solution, i.e. putting the SQL driver one level up in ..\GlassFish3\GlassFish\domains\domain1\lib\, but this creates other errors, even after restarting the Glassfish server), or
GlassFish not loading connector
(even tried this solution, no succes).
Can somebody help me solve this problem? Many thanks in advance!
With kind regards,
Heinz
Place the mysql driver in the lib folder of your project. Then do a clean-and-build. It's also helpful to have netbeans communicate directly with your database. This will allow you to view the database structure and the contents of your database right from your IDE. For help integrating MySQL with netbeans, look here: netbeans.org/kb/docs/ide/mysql.html
My friend, i had this same exception:
RestResponse.getResponse() gives FAILURE. endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=FunkPool}'
The cause of my error was that, i put wrong credentials. Check your credentials in your client DB App (SQL Developer, for example).
I had the same problem with SQL server and Netbeans. To resolve it, i put the sqljdbc.jar in the java direcory "Java\jdk1.8.0_121\lib directory" and it works :)
I've just spebnt 10 hours on this bug.

Categories