Sonar-Upgrade from 3.5.1 to 3.6.2 failed - upgrade

I'm getting this error, when upgrading from 3.5.1 to 3.6.2.
We are using a Oracle-DB.
What can I do to solve this issues?
I've found no information with google, stackoverflow or the codehaus-jira.
== MigrateViolationsToIssues: migrating ======================================
INFO | jvm 1 | 2013/07/18 16:58:17 | java.lang.IllegalStateException: Fail to convert violations to issues
INFO | jvm 1 | 2013/07/18 16:58:17 | at org.sonar.server.db.migrations.ConvertViolationsToIssues.execute(ConvertViolationsToIssues.java:62)
INFO | jvm 1 | 2013/07/18 16:58:17 | at org.sonar.server.db.DatabaseMigrator.executeMigration(DatabaseMigrator.java:77)
INFO | jvm 1 | 2013/07/18 16:58:17 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2013/07/18 16:58:17 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
INFO | jvm 1 | 2013/07/18 16:58:17 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
INFO | jvm 1 | 2013/07/18 16:58:17 | at java.lang.reflect.Method.invoke(Method.java:597)
INFO | jvm 1 | 2013/07/18 16:58:17 | at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:450)
INFO | jvm 1 | 2013/07/18 16:58:17 | at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:311)
[...]
Caused by: java.sql.SQLException: Invalid column type Query: INSERT INTO issues(id, kee, component_id, root_component_id, rule_id, severity, manual_severity, message, line, effort_to_fix, status, resolution, checksum, reporter, assignee, action_plan_key, issue_attributes, issue_creation_date, issue_update_date, created_at, updated_at) VALUES (issues_seq.nextval, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Parameters: [[4d4eb093-1843-4f4c-b175-beca9f9c6eb3, 11750, 11699, 10286, INFO, false, '32'
[...]

We finally reproduced the migration issue. It will be fixed in version 3.7 :
http://jira.codehaus.org/browse/SONAR-4542
Thanks for your patience.

Related

Dynamically transpose a table using PostgresSQL

I have a table, with this schema:
summary | time | v1 | v2 | .... v28
---------------------------------------------------------
count | 12345 | 3.7 | 9.8 | .... 6.8
stddev | 23564 | 5.7 | 8.8 | .... 6.6
min | 12345 | 6.7 | 3.8 | .... 6.5
25% | 12545 | 7.7 | 1.8 | .... 6.4
50% | 13455 | 8.7 | 2.8 | .... 6.3
75% | 32345 | 9.7 | 4.8 | .... 6.2
max | 89045 | 1.7 | 4.9 | .... 6.1
I wan to the result to be:
column_Name | count | count | stddev | min | 25% | 50% | 75% | max
--------------------------------------------------------------------------------------------------------
time | ..... | ..... | ..... | .... | ... | ... | ... | ...
v1 | ..... | ..... | ..... | .... | ... | ... | ... | ...
v2 | ..... | ..... | ..... | .... | ... | ... | ... | ...
.
.
.
v28 | ..... | ..... | ..... | .... | ... | ... | ... | ...
I'm using PostgresSQL 9.4 and DBeaver to transpose/pivot it using several queries I found on stack overflow, but I'm getting errors! I don't know why I'm getting them:
Query1
SELECT (each(hstore(dataset.stats.*))).* FROM dataset.stats
Getting this error:
SQL Error [1]: Query failed (#20190927_165859_00936_zga4f): line 1:77: mismatched input '*'. Expecting: <identifier>
This is query2:
SELECT 'SELECT *
FROM crosstab(
''SELECT u.attnum, t.rn, u.val
FROM (SELECT row_number() OVER () AS rn, * FROM ' || attrelid::regclass || ') t
, unnest(ARRAY[' || string_agg(quote_ident(attname) || '::text', ',') || '])
WITH ORDINALITY u(val, attnum)
ORDER BY 1, 2''
) t (attnum int, '
|| (SELECT string_agg('r'|| rn ||' text', ',')
FROM (SELECT row_number() OVER () AS rn FROM tbl) t)
|| ')' AS sql
FROM pg_attribute
WHERE attrelid = 'dataset.stats'::regclass
AND attnum > 0
AND NOT attisdropped
GROUP BY attrelid;
Getting this error:
SQL Error [1]: Query failed (#20190927_165928_00937_zga4f): line 4:63: identifiers must not contain ':'

Spark Standalone java.lang.OutOfMemoryError

I have Spark Standalone application on 64GB ram server. The amount of data I want to process is much more than the amount of ram I can afford.
I'm reading a huge amount of data into one big table and trying to do self-join on it. Pseudo-code looks like this:
val df = spark.read.parquet("huge_table.parquet")
val df2 = df.select(...).withColumn(...) // some data manipulations
df.as("df1").join(df2.as("df2"), $"df1.store_name" == $"df2.store_name" && $"df1.city_id" === $"df2.city_id")
My executor settings look like this --driver-memory 8g --executor-memory 32g.
spark-defaults.conf:
spark.driver.extraJavaOptions -XX:+UseG1GC
spark.executor.extraJavaOptions -XX:+UseG1GC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
The problem is that no matter what I do, I get
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.apache.spark.util.collection.unsafe.sort.UnsafeSorterSpillReader.<init>(UnsafeSorterSpillReader.java:53)
at org.apache.spark.util.collection.unsafe.sort.UnsafeSorterSpillWriter.getReader(UnsafeSorterSpillWriter.java:150)
at org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.getSortedIterator(UnsafeExternalSorter.java:472)
at org.apache.spark.sql.execution.UnsafeExternalRowSorter.sort(UnsafeExternalRowSorter.java:142)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator.processNext(Unknown Source)
at org.apache.spark.sql.execution.BufferedRowIterator.hasNext(BufferedRowIterator.java:43)
at org.apache.spark.sql.execution.WholeStageCodegenExec$$anonfun$8$$anon$1.hasNext(WholeStageCodegenExec.scala:377)
at org.apache.spark.sql.execution.window.WindowExec$$anonfun$14$$anon$1.fetchNextRow(WindowExec.scala:301)
at org.apache.spark.sql.execution.window.WindowExec$$anonfun$14$$anon$1.<init>(WindowExec.scala:310)
at org.apache.spark.sql.execution.window.WindowExec$$anonfun$14.apply(WindowExec.scala:290)
at org.apache.spark.sql.execution.window.WindowExec$$anonfun$14.apply(WindowExec.scala:289)
at org.apache.spark.rdd.RDD$$anonfun$mapPartitions$1$$anonfun$apply$23.apply(RDD.scala:797)
at org.apache.spark.rdd.RDD$$anonfun$mapPartitions$1$$anonfun$apply$23.apply(RDD.scala:797)
I've tried to persist tables before data manipulations, tried df.persist(org.apache.spark.storage.StorageLevel.MEMORY_AND_DISK_SER)
I know I don't have enough resources to process data efficiently, but what can I do to make process finish, no matter how long does it take.
UPDATE
df
+----+--------------+---------+
| ID | store_name | city_id |
+----+--------------+---------+
| 1 | Apple ... | 22 |
| 2 | Apple ... | 33 |
| 3 | Apple ... | 44 |
+----+--------------+---------+
df2
+----+--------------+---------+---------+-------------+
| ID | store_name | city_id | sale_id | sale_amount |
+----+--------------+---------+---------+-------------+
| 1 | Apple ... | 33 | 1 | $30 |
| 2 | Apple ... | 44 | 2 | $50 |
| 3 | Apple ... | 44 | 3 | $50 |
| 4 | Apple ... | 44 | 4 | $50 |
| 5 | Apple ... | 44 | 5 | $40 |
+----+--------------+---------+---------+-------------+

postgres select latest record per entity except on field value

I have a log table that looks something like this:
---------------------------------------------
| id | company | type | date_created |notes|
---------------------------------------------
| 1 | co1 | | 2016-06-30 | ... |
| 2 | co2 | ERROR | 2016-06-30 | ... |
| 3 | co1 | | 2016-06-29 | ... |
| 4 | co2 | | 2016-06-29 | ... |
I have the following which selects the latest record per entity:
SELECT *
FROM import_data_log a
JOIN (SELECT company, max(date_created) date_created
FROM import_data_log
GROUP BY company) b
ON a.company = b.company AND a.date_created = b.date_created
which gives the result:
| 1 | co1 | | 2016-06-30 | ... |
| 2 | co2 | ERROR | 2016-06-30 | ... |
I need to add a condition that does not select the entry with type = ERROR and get the next highest date for that company, so it would give:
| 1 | co1 | | 2016-06-30 | ... |
| 4 | co2 | | 2016-06-29 | ... |
Any ideas? It's probably something simple but for the life of me I can't seem to get it to work.
UPDATE / FIX:
Ok so after a lot of hair pulling, for anyone running into this issue, apparently Postgres doesn't compare null fields with anything, so it completely ignores all rows with type = null.
The way I fixed it is this, there is probably a nicer solution out there but for now this works:
SELECT *
FROM import_data_log a
JOIN (SELECT company, max(date_created) date_created
FROM import_data_log
WHERE (type <> 'ERROR' OR type is null)
GROUP BY company) b
ON a.company = b.company AND a.date_created = b.date_created
Use the below Query
SELECT id,company,type,max(date_created),notes
FROM import_data_log
WHERE type != 'ERROR'
GROUP BY company
select distinct on (company) *
from import_data_log
where type is distinct from 'ERROR'
order by company, date_created desc
Check distinct on and is [not] distinct from:
Ordinary comparison operators yield null (signifying "unknown"), not true or false, when either input is null. For example, 7 = NULL yields null, as does 7 <> NULL. When this behavior is not suitable, use the IS [ NOT ] DISTINCT FROM constructs

Getting NullPointerException from Play framework

I have been using play framework 2.2.4 version. While executing particular action getting NullPointerException, If its from my code I can fix it but it has come from play library.
could someone help on this??
# action #
public static Result getOverViewPage(final String errorMsg){
String autoBillStatusMsg = "";
//business logic is here
Logger.info("Final Auto-pay status message : "+autoBillStatusMsg);
return ok(rave_customer_index.render());
}
We are able to see the above logger statement. But after that we are getting NullPointerException
Exception StackTrace
INFO | jvm 1 | 2015/09/18 15:15:24 | [info] application - Final
Auto-pay status message :
INFO | jvm 1 | 2015/09/18 15:15:24 | [error] play - Cannot invoke
the action, eventually got an error: java.lang.NullPointerException
INFO | jvm 1 | 2015/09/18 15:15:24 | [error] application - INFO
| jvm 1 | 2015/09/18 15:15:24 | INFO | jvm 1 | 2015/09/18
15:15:24 | ! #6nfm0a093 - Internal server error, for (GET) [/] ->
INFO | jvm 1 | 2015/09/18 15:15:24 |
INFO | jvm 1 | 2015/09/18 15:15:24 |
play.api.Application$$anon$1: Execution
exception[[NullPointerException: null]]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
play.api.Application$class.handleError(Application.scala:296)
~[com.typesafe.play.play_2.11-2.3.2.jar:2.3.2]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
play.api.DefaultApplication.handleError(Application.scala:402)
[com.typesafe.play.play_2.11-2.3.2.jar:2.3.2]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320)
[com.typesafe.play.play_2.11-2.3.2.jar:2.3.2]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320)
[com.typesafe.play.play_2.11-2.3.2.jar:2.3.2]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
scala.Option.map(Option.scala:145)
[org.scala-lang.scala-library-2.11.1.jar:na] INFO | jvm 1 |
2015/09/18 15:15:24 |
Caused by: java.lang.NullPointerException: null
INFO | jvm 1 | 2015/09/18 15:15:24 | at
java.net.URLEncoder.encode(URLEncoder.java:205) ~[na:1.7.0_21]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
play.api.mvc.CookieBaker$$anonfun$3.apply(Http.scala:427)
~[com.typesafe.play.play_2.11-2.3.2.jar:2.3.2]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
play.api.mvc.CookieBaker$$anonfun$3.apply(Http.scala:426)
~[com.typesafe.play.play_2.11-2.3.2.jar:2.3.2]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
~[org.scala-lang.scala-library-2.11.1.jar:na]
INFO | jvm 1 | 2015/09/18 15:15:24 | at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
~[org.scala-lang.scala-library-2.11.1.jar:na]
DEBUG | wrapperp | 2015/09/18 15:15:25 | send a packet PING : ping
INFO | jvm 1 | 2015/09/18 15:15:26 | WrapperManager Debug:
Received a packet PING : ping
INFO | jvm 1 | 2015/09/18 15:15:26 | WrapperManager Debug: Send a
packet PING : ping

JavaMail to send secure email through vps - SSLHandshake Exception, PKIX path building failed, etc. - Can't send mail

I'm testing out sending email through my vps and I've run into a problem when it comes to sending a secure mail through SMTPS. SMTP and POP3 functions work, as the email is successfully sent. SMTPS doesn't.
I setup a simple test (JSP) page to send off an email. The code is provided below.
Transport t = null;
try {
String SMTPS = "mydomainname.com";
String Username = "maindomainemail";
String Password = "myhiddenpassword";
InternetAddress from = new InternetAddress("mrsmith#mydomainname.com", "Bob Smith");
Properties props = new Properties();
props.setProperty("mail.smtps.auth", "true");
props.put("mail.smtps.host", "mydomainname.com");
String protocol = "smtps";
Session ssn = Session.getInstance(props, null);
ssn.setDebug(true);
t = ssn.getTransport(protocol);
t.connect(SMTPS,Username,Password);
InternetAddress to = new InternetAddress("mypersonalemail#hotmail.com", "Tom Smith");
String subject = "testing email";
String newBody = "message body of email";
// Create the message
Message msg = new MimeMessage(ssn);
msg.setFrom(from);
msg.addRecipient(Message.RecipientType.TO, to);
msg.setSubject(subject);
msg.setContent(newBody, "text/html");
t.sendMessage(msg, msg.getAllRecipients());
t.close();
}//try
catch (MessagingException mex) {
mex.printStackTrace(); }
catch(Exception e) {}
On my vps, I had to follow instructions to setup secure smtp.
After running the jsp test page, I'm getting the following exceptions in my tomcat log file.
INFO | jvm 1 | 2011/01/06 12:29:11 | DEBUG: setDebug: JavaMail version 1.4.1
INFO | jvm 1 | 2011/01/06 12:29:11 | DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc]
INFO | jvm 1 | 2011/01/06 12:29:11 | DEBUG SMTP: useEhlo true, useAuth true
INFO | jvm 1 | 2011/01/06 12:29:11 | DEBUG SMTP: trying to connect to host "mydomainname.com", port 465, isSSL true
INFO | jvm 1 | 2011/01/06 12:29:12 | DEBUG SMTP: exception reading response: 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
INFO | jvm 1 | 2011/01/06 12:29:12 | javax.mail.MessagingException: Exception reading response;
INFO | jvm 1 | 2011/01/06 12:29:12 | nested exception is:
INFO | jvm 1 | 2011/01/06 12:29:12 | 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
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
INFO | jvm 1 | 2011/01/06 12:29:12 | at javax.mail.Service.connect(Service.java:288)
INFO | jvm 1 | 2011/01/06 12:29:12 | at javax.mail.Service.connect(Service.java:169)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jsp.SendEmailViaEappsVPS_005fSMTPS_jsp._jspService(SendEmailViaEappsVPS_005fSMTPS_jsp.java:112)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
INFO | jvm 1 | 2011/01/06 12:29:12 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
INFO | jvm 1 | 2011/01/06 12:29:12 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
INFO | jvm 1 | 2011/01/06 12:29:12 | at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
INFO | jvm 1 | 2011/01/06 12:29:12 | at java.lang.Thread.run(Thread.java:595)
INFO | jvm 1 | 2011/01/06 12:29:12 | Caused by: 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
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1584)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:848)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:877)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1089)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:737)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
INFO | jvm 1 | 2011/01/06 12:29:12 | at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
INFO | jvm 1 | 2011/01/06 12:29:12 | at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1589)
INFO | jvm 1 | 2011/01/06 12:29:12 | ... 26 more
INFO | jvm 1 | 2011/01/06 12:29:12 | Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
INFO | jvm 1 | 2011/01/06 12:29:12 | at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221)
INFO | jvm 1 | 2011/01/06 12:29:12 | at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145)
INFO | jvm 1 | 2011/01/06 12:29:12 | at sun.security.validator.Validator.validate(Validator.java:203)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)
INFO | jvm 1 | 2011/01/06 12:29:12 | at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841)
INFO | jvm 1 | 2011/01/06 12:29:12 | ... 38 more
INFO | jvm 1 | 2011/01/06 12:29:12 | Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
INFO | jvm 1 | 2011/01/06 12:29:12 | at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236)
INFO | jvm 1 | 2011/01/06 12:29:12 | at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194)
INFO | jvm 1 | 2011/01/06 12:29:12 | at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216)
INFO | jvm 1 | 2011/01/06 12:29:12 | ... 43 more
What does this mean? Has anyone seen this type of exception before? What steps do I need to take to fix this problem?
Java is not finding the SSL certification, you need to manually add the host. You need to add server's certification to keystore implying it's your trusted server.
Alternatively, with JavaMail 1.5.2, you can use the 'Socket Factory'-Approach as described in the official SSLNOTES.txt:
JavaMail now includes a special SSL socket factory that can simplify
dealing with servers with self-signed certificates. While the
recommended approach is to include the certificate in your keystore
as described above, the following approach may be simpler in some cases.
The class com.sun.mail.util.MailSSLSocketFactory can be used as a
simple socket factory that allows trusting all hosts or a specific set
of hosts. For example:
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
// or
// sf.setTrustedHosts(new String[] { "my-server" });
props.put("mail.smtp.ssl.enable", "true");
// also use following for additional safety
//props.put("mail.smtp.ssl.checkserveridentity", "true");
props.put("mail.smtp.ssl.socketFactory", sf);
Use of MailSSLSocketFactory avoids the need to add the certificate to
your keystore as described above, or configure your own TrustManager
as described below.