Unable to send email and error as javax.mail.NoSuchProviderException

dhaval soni
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.
May 7, 2013

Hi,

My email sending stuff was working fine before i executed atlas-clean. Now, i am not able send email from my created scheduler service and raising an error as below:

javax.mail.NoSuchProviderException: smtp
	at javax.mail.Session.getService(Session.java:798)
	at javax.mail.Session.getTransport(Session.java:720)
	at javax.mail.Session.getTransport(Session.java:660)
	at javax.mail.Session.getTransport(Session.java:640)
	at com.crawco.jira.plugin.Reports.DailyReportService.execute(DailyReportService.java:449)
	at com.atlassian.sal.jira.scheduling.JiraPluginSchedulerService.run(JiraPluginSchedulerService.java:94)
	at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
	at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:47)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
	at com.atlassian.multitenant.quartz.MultiTenantThreadPool$MultiTenantRunnable.run(MultiTenantThreadPool.java:72)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

What can be the cause.

I have already included below stuff in pom.xml -

<dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.5</version>
        </dependency>
        <dependency>
	    <groupId>javax.activation</groupId>
	    <artifactId>activation</artifactId>
	    <version>1.1.1</version>
	</dependency>

Thank You

Dhaval Soni

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Radu Dumitriu
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.
May 7, 2013

I bet this is another problem of classloading. You need to ensure that:

1. There's just one mail library in the application (JIRA comes with it, so you do not need to add it in your runtime dependencies)

2. You access it from the correct classloader.

dhaval soni
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.
May 7, 2013

I have tried by removing javax.mail and activation dependencies from pom.xml and recompile the JIRA but it did'nt work.. now i've stop the jira and again executing - "atlas-run" command , suppose the case then it would work...

Thanks.

dhaval soni
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.
May 7, 2013

It does not work.. still it gives me same error for "javax.mail.NoSuchProviderException: smtp" .

dhaval soni
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.
May 8, 2013

I did again execute atlas-run after removing javax.mail and activation dependencies. and it works fine and mail got working ....

Thank You.

Paul L August 28, 2013

Hi Dhaval,

How did you solve the problem?

My problem is I am running automation test cases using Maven+java+testng. On Success/Failure I want pom.xml to send to specific users. But it doesn't send any email. Its a postman plugin to send email maven central repo.

This runs perfectly fine on ubuntu machine but not on windows7 machine.

<plugin>
            <groupId>ch.fortysix</groupId>
            <artifactId>maven-postman-plugin</artifactId>
            <executions>
                <execution>
                    <id>send a mail</id>
                    <phase>test</phase>
                    <goals>
                        <goal>send-mail</goal>
                    </goals>
                    <inherited>false</inherited>
                    <configuration>
                        <from>test123@test.com</from>
                        <subject> Test Results</subject>
                        <failonerror>true</failonerror>
                        <mailhost></mailhost>
                        <receivers>
                            <receiver>paul.lev007@gmail.com</receiver>

                        </receivers>
                        <htmlMessageFile>target/surefire-reports/emailable-report.html</htmlMessageFile>
</configuration>
                </execution>
</plugin>


TAGS
AUG Leaders

Atlassian Community Events