• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

JavaMail failing in Plesk PowerPack

D

danipage

Guest
Hi everyone,

I've recently rented a dedicated server with Plesk control panel and the PowerPack license

This is my configuration:

- CentOS release 5.5 (Final)
- Kernel 2.6.34.6-xxxx-std-ipv6-64
- Apache/2.2.3
- OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
- Plesk 9.5.4
- PowerPack with the following:
- tomcat5-5.5.23-0jpp.9.el5_5
- java version "1.4.2"
- jre 1.4.2
- gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)


This is the JSP I'm trying to execute (a working example from the Internet):

<html>
<head>
<title>JSP JavaMail Example </title>
</head>

<body>


<%@ page import="java.util.Properties" %>
<%@ page import="javax.mail.Message" %>
<%@ page import="javax.mail.MessagingException" %>
<%@ page import="javax.mail.Session" %>
<%@ page import="javax.mail.Transport" %>
<%@ page import="javax.mail.internet.InternetAddress" %>
<%@ page import="javax.mail.internet.MimeMessage" %>


<%


String host = "smtp.gmail.com";
int port = 587;
String username = "xxxxxxxxxxxxxxx";
String password = "xxxxxxxxxxxxxxx";

Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");

Session ses = Session.getInstance(props);

try {

Message message = new MimeMessage(ses);
message.setFrom(new InternetAddress("xxxxxxxxxxxxxxx"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("xxxxxxxxxxxxxxx"));
message.setSubject("Testing Subject");
message.setText("Dear Mail Crawler,\n\n No spam to my email, please!");

Transport transport = ses.getTransport("smtp");
transport.connect(host, port, username, password);

Transport.send(message);

System.out.println("Done");

} catch (MessagingException e) {
throw new RuntimeException(e);
}


%>
</table>
</body>
</html>


This is the error obtained when reaching the "Transport.send(message);" instruction:

nested exception is:
javax.mail.MessagingException: decompression_failure: remotely generated; fatal;
nested exception is:
gnu.javax.net.ssl.provider.AlertException: decompression_failure: remotely generated; fatal


Also, I've granted "permission java.security.AllPermission;" in catalina.policy for the related domain



I think that Plesk and PowerPack have an issue here, because this is a fresh installation, I haven't performed any manual update, and JavaMail is not working



On the flip side, I can only think about manually updating JRE, but at first I don't like the idea, as I would prefer updating Plesk only via admin panel for better standardization the deployment of virtual sites

Any clue for solving this issue?
 
I assume that your JSP connects to SMTP server, invokes STARTTLS command, receives certificate of SMTP server and then sends encrypted data back. Most probably server replies with this error like:
454 TLS connection.failed: error:1408F06B:SSL routines:SSL3_GET_RECORD:bad decompression (#4.3.0)

Check it in logs.
It appears that application sends incorrect SSL data.
Most possible cause is that JSP cannot properly initiate SSL session.

At least try to disable
props.put("mail.smtp.starttls.enable", "true");
 
Hi, thanks!

But I already tried that against the local SMTP

No TLS, No SSL, etc. and still obtaining same error:

nested exception is:
javax.mail.MessagingException: decompression_failure: remotely generated; fatal;
nested exception is:
gnu.javax.net.ssl.provider.AlertException: decompression_failure: remotely generated; fatal

That's why I think that Java, or Tomcat, or OpenSSL are not properly aligned

Also, please note that my server is 64 bits, maybe is it lacking some Java lib?
 
Hi,

I managed to solve it

It's a matter of fact that Java 1.4.2-gcj and Java 1.6.0-openjdk (both available @ yum list) are not working well with CentOS

So I had to rebuild Java 1.6.0-sun from source code

If your OS is CentOS, and you need Java, then follow this guide: http://wiki.centos.org/HowTos/JavaOnCentOS
 
Back
Top