New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[portal] Exception when sending email during user registration #485

Closed
alessandrousseglioviretta opened this Issue Mar 6, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@alessandrousseglioviretta

alessandrousseglioviretta commented Mar 6, 2017

Email sending during user registration results in a java.lang.NoSuchMethodError exception; email is not sent.

Expected Behavior

No exception during email sending via SMTP

Current Behavior

When I click the "REGISTER" button I get a Thank you for registering, you will receive an e-mail confirmation in a few minutes toast, but the email is not sent. The Management API logs show the following exception:

21:32:05.461 [SimpleAsyncTaskExecutor-1] ERROR o.s.a.i.SimpleAsyncUncaughtExceptionHandler - Unexpected error occurred invoking async method 'public void io.gravitee.management.service.impl.EmailServiceImpl.sendAsyncEmailNotification(io.gravitee.management.service.EmailNotification)'.
java.lang.NoSuchMethodError: com.sun.mail.util.TraceInputStream.<init>(Ljava/io/InputStream;Lcom/sun/mail/util/MailLogger;)V
	at com.sun.mail.smtp.SMTPTransport.initStreams(SMTPTransport.java:2014)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1936)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
	at javax.mail.Service.connect(Service.java:291)
	at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:501)
	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:421)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
	at io.gravitee.management.service.impl.EmailServiceImpl.sendEmailNotification(EmailServiceImpl.java:86)
	at io.gravitee.management.service.impl.EmailServiceImpl.sendAsyncEmailNotification(EmailServiceImpl.java:96)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:745)

Possible Solution

A smtp-*.jar file might be missing, as suggested here: http://stackoverflow.com/questions/36184705/issue-when-using-smtp-and-javax-mail

Steps to Reproduce (for bugs)

Configure a SMTP server and email in gravitee.yml ( I used a Gmail account) and register a new user by using the portal. Then inspect the Management API logs.

My Environment

The exception gets thrown both when installing the docker demo with: curl -L http://bit.ly/graviteeiodemo | bash and running graviteeio-full-1.3.3.

@alessandrousseglioviretta alessandrousseglioviretta changed the title from Exception when sending email during user registration to [portal] Exception when sending email during user registration Mar 6, 2017

@brasseld brasseld added the type: bug label Mar 7, 2017

@brasseld brasseld self-assigned this Mar 7, 2017

@brasseld brasseld added this to the 1.4.0 milestone Mar 7, 2017

@NicolasGeraud

This comment has been minimized.

Member

NicolasGeraud commented Mar 7, 2017

The jar mail-1.4.7.jar is in the lib/ext and contains this method :

public class TraceInputStream extends FilterInputStream {
...
    public TraceInputStream(InputStream in, MailLogger logger) {
...

so a missing jar does not seem to be the root of the problem.

@alessandrousseglioviretta

This comment has been minimized.

alessandrousseglioviretta commented Mar 7, 2017

@NicolasGeraud I confirm that the issue is not a missing jar. I added smtp-1.5.6.jar to lib/ext to no avail.

brasseld added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Mar 7, 2017

brasseld added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Mar 7, 2017

NicolasGeraud added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Mar 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment