I am getting following error when I try to connect yahoo
pop3s. plus.mail.pop.yahoo.com:995
error while connecting to pop3 mail server javax.mail.MessagingException: Connect failed;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I have already tried adding the certificate into JAVA_Home/jre/lib/security. Also when I am trying to use the same code directly using the Java/javac Cmd it works. But from tomcat it does not work.
Also: the code which I am using that was working since last two years on same server. Recently we have migrated from dedicated server to cloud based server. Backspace is the vendor where we have deployed the code.
Thanks in advance!
Vivek Agrawal
Most probably cause os this is that the system is unable to locate a valid certificate because in your migration something related to the keystore was not properly set.
Review your configuration file $CATALINA_BASE/conf/server.xml and look if the path to the correct keystore is set under Connector tag. If you are using JSSL look for this in that file
<-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
<Connector
port="8443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="${user.home}/.keystore" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS"/>
Your keystoreFile has to be set to the correct path in order your application can validate amd resolve a certificacion path in a request (the keystorepass have to be correct too, indeed).
If you have another configuration (APR or something) look at the documentation about in http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
Hope this help,
Cheers!!
Related
I don't speak English, sorry.
I have this message to my DBeaver
Can you help me to fix the problem ?
Network error
Motif:
Network unavailable:
javax.net.ssl.SSLHandshakeException:PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
There are to ways to solve your problem.
1 - Check this link: ( https://dbeaver.com/docs/wiki/Importing-CA-Certificates-into-DBeaver/ ) and follow the steps.
2 - In DBeaver installation path, open the dbeaver.ini file and remove this line: -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT
I did the same step, and did not work, but then I changed the SSL Factory to org.postgresql.ssl.LibPQFactory and it works.
I have similar error the first time that i open a DB:
Network error
Reason: Network unavailable due to certificate issue. Try changing the
setting Use Windows trust store in Preferences->Connections and
restart DBeaver. It might help if you haven't overridden trust store.
javax.net.ssl.SSLHandshakeException:PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
I try 'bAsK' solution but not work for me.
The solution for me is remove check in the setting Use Windows trust store in Preferences->Connections and restart DBeaver
I also installed JRE 8 (Java)
for mac OS , just edit the file
/Applications/DBeaver.app/Contents/Eclipse/dbeaver.ini
and add the below line to the file
-Djavax.net.ssl.trustStoreType=KeychainStore
Restart the DBeaver application to resolve this problem.
Exception in thread "main"
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
anyone have face this issue ?
1.Compile & run java class
https://github.com/escline/InstallCert/blob/master/InstallCert.java
2.Run java InstallCert
3.It will fetch the certificates & create a new file "jssecacerts" on desktop.
4.Copy paste this file to /javaHome/jre/lib/security.
5.Now you can hit the https web api.
Similar you have to do on live server where you will deploy the webApp.
We are using the html-include macro for displaying content from an https resource. However, if we include the macro the following exception occurs:
Error rendering macro 'html-include' :
com.atlassian.renderer.v2.macro.MacroException:
com.atlassian.confluence.macro.MacroExecutionException:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
We don't know what to do for getting this to work. Can you please help us?
Cause
The two instances communicating do not explicitly trust one another, even though they are using the same keystore. The certificate the instances are using must be present in the truststore for server-to-server communication to work.
Resolution
Follow the instructions in this document: Connecting to LDAP or JIRA or Other Services via SSL if you are on JDK 1.5
Follow the instructions in this document: keytool - Key and Certificate Management Tool if you are on JDK 1.6
This will require a restart of all applications that have the parameter added.
I am trying to deploy a Play Framework 2.3 application to OpenShift.
I am following this example: https://github.com/JamesSullivan/play2-openshift-quickstart
Building and deploying the application is working (by that I mean the push to the git repository is working and the build is completing successfully), but during startup I see this error in play.log:
AbstractConnectionHook -
Failed to obtain initial connection Sleeping for 0ms and trying again.
Attempts left: 0. Exception: null.
Message:No suitable driver found for jdbc:${OPENSHIFT_POSTGRESQL_DB_URL}
Oops, cannot start the server.
Configuration error: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94)
at play.api.Configuration.reportError(Configuration.scala:743)
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:247)
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:238)
at scala.collection.immutable.List.map(List.scala:272)
at play.api.db.BoneCPPlugin.onStart(DB.scala:238)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
at scala.collection.immutable.List.foreach(List.scala:381)
at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.Play$.start(Play.scala:90)
at play.core.StaticApplication.<init>(ApplicationProvider.scala:55)
at play.core.server.NettyServer$.createServer(NettyServer.scala:244)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:280)
at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:275)
at scala.Option.map(Option.scala:145)
at play.core.server.NettyServer$.main(NettyServer.scala:275)
at play.core.server.NettyServer.main(NettyServer.scala)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:${OPENSHIFT_POSTGRESQL_DB_URL}
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:363)
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120)
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:240)
... 18 more
So it looks like the ${OPENSHIFT_POSTGRESQL_DB_URL} environment variable token-substitution is not working.
If I log in to my application, I see this via env (obviously I replaced the username, password, IP and port for the purposes of posting here):
OPENSHIFT_POSTGRESQL_DB_URL=postgresql://xxxx:yyyy#ip:port
I have also tried using the other environment variables, like OPENSHIFT_POSTGRESQL_DB_HOST but those too do not get substituted.
The relevant part of my openshift.conf looks like this:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:${OPENSHIFT_POSTGRESQL_DB_URL}"
db.default.user=myappuser
db.default.password=myapppassword
From the linked quickstart project, the following command is used to start the Play server (again, I replaced server-ip for the purposes of this post):
/app-root/runtime/repo/target/universal/stage/bin/myapp
"-DapplyEvolutions.default=true"
-Dhttp.port=8080 -Dhttp.address=server-ip
-Dconfig.resource=openshift.conf
You can see the openshift.conf file being referenced.
I tried a lot of things, eventually I found something that worked:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://"${OPENSHIFT_POSTGRESQL_DB_HOST}":"${OPENSHIFT_POSTGRESQL_DB_PORT}/mydb
db.default.user=(((db-user)))
db.default.password=(((dp-password)))
The upshot is, it seems, you need to watch out very carefully for correct usage of the quotation characters.
It looks "wrong" (at first glance) since the last quotation character closes the string prior to the OPENSHIFT_POSTGRESQL_DB_PORT variable.
I'm swapping out a derby database for a MySQL one. I had everything working before but after what I thought was the proper configuration I'm getting the error:
Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Full error output from console:
Caused by: javax.resource.ResourceException: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:292)
at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114)
at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1292)
at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:148)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:101)
at com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:87)
I've double checked some of the names, the connection pool and other resources.I've also added the MySQL driver .jars to the library of glassfish in both projects. The database was definitely working correctly through eclipse because I was able to view tables and display the resources inside the database context of eclipse. So I know that at least THOSE drivers are working correcly. Also the persistence.xml file looks good. it references the jdbc/mydatabase jndi reference like it should and default JTA is selected as the manament type.
Does anyone have another suggestion? Thank you
I've also added the MySQL driver .jars to the library of glassfish in both projects.
It was apparently not done right. The JAR has to go in /glassfish/domains/[domainname]/lib/ext folder of the Glassfish installation where [domainname] usually defaults to domain1. You can and should not configure it from the Eclipse side on.
Looks like I am replying very late, but however people who would be referring to this thread may find the following information being useful. So I am posting it here:
Download the connector Jar from http://dev.mysql.com/downloads/connector/j/5.0.html
unzip the pack and copy mysql-connector-java-verno-bin.jar
past the same at [GlassFish Installation Directory]/domains/[domain name]/lib folder
restart your domain and ping to check your connection in JDBC Connection Pools
There you go. If your MySql is running then it will ping the DB successfully
I copied the jar file to $glassfish_install_folder\glassfish\lib, after that it worked. I use glassfish 4.0.
Check this link from oracle.
I encountered this issue in 2018 and would like to note that if you are using glassfish 4 (current is 5) then it seems you have to use the Connector/J 5.1.47 version for it to work. If you use the current version (Connector/J 8.0.13) then exception mentioned in the original question keeps appearing, no matter where you place the .jar file.
With Connector/J 5.1.47 it works perfectly.
Solution is
> asadmin add-library /path/to/mysql-connector-java-bin.jar
Check this link:
https://blog.payara.fish/using-mysql-with-payara
I encountered this issue in 2019 and would like to note that if you are using docker image payara/server-full (I am using 5.194 so far) as I do the location to place the driver jar is:
/opt/payara/appserver/glassfish/domains/production/lib/
In the end I am doing something like this in the Dockerfile of payara server:
RUN wget http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.2.0/mariadb-java-client-2.2.0.jar \
-O /opt/payara/appserver/glassfish/domains/production/lib/mariadb-java-client-2.2.0.jar