Using Gmail as JIRA mail server error

Rumceisz June 28, 2012

Hi Jobin,

yes I am behind a firewall but it can be done. ()

I summarize what I did - maybe it has to extend with sg.

1. I moved the 'activation' and 'mail' JAR files from the from the <jira-application-dir>/WEB-INF/lib/ to C:\Program Files\Atlassian\JIRA\lib

maybe it can be wrong but based on the documentation I couldn't identify which is actually the Jira installation dir.

2. I added Gmail as a JNDI resource within the within the <Context/> elements of the /conf/server.xml file.

3. I set 2 things in the setenv.bat file:

* I put this line: set JVM_PROXY=-Dhttp.proxyHost=proxy.xxx.xxx.xxx.de -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts="127.0.0.1|*.xxx.xx"

* And I added to JAVA_OPTS this: %JVM_PROXY%

I didn't do this OPENSSL step because I didn't understand at all.

I attach a picture of the settings in the Outgoing Mail section and my setenv.bat file. Can you please check whether I pasted the proxy settings in a wrong place in the setenv.

Thanks in advance!

Rumi

5 answers

1 accepted

0 votes
Answer accepted
Gian Carlo Moore June 30, 2012
Exactly, 465 is for SSL whereas 587 is TLS
Rumceisz July 2, 2012

Hi GCM and Norman,

do you mean it will work inside of firewall with SMTP Port: 587?

Rumi

Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2012

What we are saying you need to specify the correct combination of parameters to get email to work. In the image below where you had TLS checked, you need to use port 587.

Yes, gmail communication behind a firewall is possible. but you need to

1) configure Jira for email access correctly.

https://confluence.atlassian.com/display/JIRA/Using+Gmail+as+a+JIRA+Mail+Server

2) Use the correct set of parameters for your email service

(See the comments on the above url about certificates and the url below

http://support.google.com/mail/bin/answer.py?hl=en&answer=78775

3) Configure your firewall(s) to allow email communications.

See your network administrator or see the person who configures your firewall(s) or call your firewall vendor to get some help on configuration.

Rumceisz, If I misspoke for you, I apologize.

Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2012

What we are saying you need to specify the correct combination of parameters to get email to work. In the image below where you had TLS checked, you need to use port 587.

Yes, gmail communication behind a firewall is possible. but you need to

1) configure Jira for email access correctly.

https://confluence.atlassian.com/display/JIRA/Using+Gmail+as+a+JIRA+Mail+Server

2) Use the correct set of parameters for your email service

(See the comments on the above url about certificates and the url below

http://support.google.com/mail/bin/answer.py?hl=en&answer=78775

3) Configure your firewall(s) to allow email communications.

See your network administrator or see the person who configures your firewall(s) or call your firewall vendor to get some help on configuration.

GCM, If I misspoke for you, I apologize.

1 vote
Rumceisz July 6, 2012

I got this:

Caused by: java.lang.NoClassDefFoundError: javax/mail/Authenticator
	at org.apache.naming.factory.MailSessionFactory.getObjectInstance(MailSessionFactory.java:105)
	at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140)
	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at com.atlassian.mail.server.impl.SMTPMailServerImpl.getJndiSession(SMTPMailServerImpl.java:141)
	at com.atlassian.mail.server.impl.SMTPMailServerImpl.getSession(SMTPMailServerImpl.java:112)
	at com.atlassian.jira.plugins.mail.webwork.VerifySmtpServerConnection$VerifySmptServer.verifyMailServer(VerifySmtpServerConnection.java:156)
	at com.atlassian.jira.plugins.mail.webwork.VerifySmtpServerConnection.validateServer(VerifySmtpServerConnection.java:47)
	at com.atlassian.jira.plugins.mail.webwork.VerifySmtpServerConnection.doExecute(VerifySmtpServerConnection.java:95)
	at com.atlassian.jira.plugins.mail.webwork.VerifySmtpServerConnection.doVerification(VerifySmtpServerConnection.java:112)
	at com.atlassian.jira.plugins.mail.webwork.VerifySmtpServerConnection.doAdd(VerifySmtpServerConnection.java:103)
	... 135 more
Caused by: java.lang.ClassNotFoundException: javax.mail.Authenticator
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 155 more
Jaime Hablutzel November 30, 2013

See here https://confluence.atlassian.com/display/CROWD/Configuring+your+Mail+Server

If you have something like this

<Resource name="mail/YahooSmtpServer"

auth="Container"

type="javax.mail.Session"

mail.smtp.host="smtp.bizmail.yahoo.com"

mail.smtp.port="587"

mail.smtp.auth="true"

mail.smtp.user="xxx"

password="xxx"

mail.debug="true"

/>

In your server.xml, quoting:

You will also need to ensure that the JavaMail classes and Java Beans Activation Framework are present in your application server's classpath.

This is, to copy activation-1.0.2.jar and mail-1.4.1.jar from tomcat/confluence/WEB-INF/lib to tomcat/lib/

0 votes
Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2012

With TLS set, try port 587 instead of port 465 or uncheck TLS if you do not need it and then use port 465.

0 votes
Rumceisz June 28, 2012

Rumceisz July 6, 2012

Hi All,

I got the following error after Jira reinstall:

Unfortunately no connection was possible. Review the errors below and rectify:

  • NameNotFoundException: Name mail is not bound in this Context
Rumceisz July 6, 2012

And I also get:

Oops - an error has occurred

System Error

A system error has occurred.

Please try submitting this problem via the Support Request Page
Otherwise, please create a support issue on our support system at http://support.atlassian.com with the following information:

  1. a description of your problem
  2. cut & paste the error and system information found below
  3. attach the application server log file ( C:\Program Files (x86)\Atlassian\Application Data\JIRA\log\atlassian-jira.log )

Cause:
java.lang.reflect.InvocationTargetException

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2012

Are you sure all the parameters are right? If so, is it blocked in firewall?

Rumceisz June 28, 2012

Here are the excerpts from my setenv.bat file:

IF "x%JIRA_HOME%x" == "xx" GOTO NOJIRAHOME2
echo Using JIRA_HOME: %JIRA_HOME%
:NOJIRAHOME2

set JVM_PROXY=-Dhttp.proxyHost=proxy.xxx.xxx.xxx.xx -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts="127.0.0.1|*.xxx.xx"

and:

set JAVA_OPTS=%JAVA_OPTS% -Xms%JVM_MINIMUM_MEMORY% -Xmx%JVM_MAXIMUM_MEMORY% %JVM_REQUIRED_ARGS% %DISABLE_NOTIFICATIONS% %JVM_SUPPORT_RECOMMENDED_ARGS% %JVM_EXTRA_ARGS% %JIRA_HOME_MINUSD%JVM_PROXY%

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2012

Have you tried SMTP settings instead of JNDI?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2012

You don't need to open it. Make sure the TLS option is checked. Can you post a screenshot?

Rumceisz June 28, 2012

Not yet, I check.

Rumceisz June 28, 2012

It doesn't work either.

Do I have to open this 465 port? Never done it before.

Rumceisz June 28, 2012

I checked but it doesn't work.

I could only attach the screen as an answer sorry

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2012

Well, that should normally work. It is time to call the network guys. I am guessing a firewall rule..

Rumceisz July 2, 2012

Hi Jobin,

the connection works from outside of the company network, so the problem is related to the firewall.

I summarize the correct gmail settings (outside of firewall) for the users meeting this problem in the future:

* From address: gmail email address

* Protocol: SMTP

* Host name: LEAVE BLANK!

* SMTP Port: 25

* TLS: checked

* JNDI Location: java:comp/env/mail/GmailSmtpServer

Set setenv.bat and server.xml

Suggest an answer

Log in or Sign up to answer