Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Email sending error java.lang.reflect.InvocationTargetException

Featured Replies

  • Newbies

Hi all,

I have an email sending groovy script which works pecfectly from command line. But when I paste it to Filemaker 17 EvaluateGroovy it gives this stack trace:


 

Quote

 

java.util.concurrent.ExecutionException: java.lang.reflect.InvocationTargetException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at com.prosc.fmkit.Plugin.invokeFunctionNoErrors(Plugin.java:362)
    at com.prosc.fmkit.PluginBridge2$1.call(PluginBridge2.java:860)
    at com.prosc.fmkit.PluginBridge2$1.call(PluginBridge2.java:848)
    at com.prosc.fmkit.PluginBridge2.doFunction(PluginBridge2.java:880)
    at com.prosc.fmkit.PipeChild.lambda$handleMessage$11(PipeChild.java:323)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    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 com.prosc.fmkit.StaticFunction.invoke(StaticFunction.java:260)
    at com.prosc.fmkit.Plugin.invokeFunction(Plugin.java:384)
    at com.prosc.fmkit.RegisterablePlugin.invokeFunction(RegisterablePlugin.java:177)
    at com.prosc.fmkit.Plugin.lambda$invokeFunctionNoErrors$0(Plugin.java:358)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.test.co.uk, port: 587;  nested exception is:    java.net.ConnectException: Connection refused: connect
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
    at javax.mail.Service.connect(Service.java:275)
    at javax.mail.Service$connect.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:144)
    at Script1.run(Script1.groovy:36)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:627)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:598)
    at com.prosc.beanshell.BeanShellModel.evaluateGroovy(BeanShellModel.java:199)
    at com.prosc.beanshell.BeanShellPlugin.EvaluateGroovy(BeanShellPlugin.java:628)
    ... 23 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
    ... 35 more


 

 

The code is:

Quote

EvaluateGroovy( "import javax.mail.*;¶
import javax.mail.internet.*;¶
def  from = \"[email protected]\",¶
     username = \"[email protected]\",¶
     password = \"testpassword\",¶
     host = \"mail.test.co.uk\",¶
     port  = 587, ¶
     to = \"[email protected]\",¶
     subject = \"Testing\",¶
     htmlbody = \"Hey, this is the testing email.\";¶

Properties properties = System.getProperties();¶

    ¶
    properties.put(\"mail.smtp.starttls.enable\", \"true\");¶
    properties.put(\"mail.smtp.host\", host);¶
    properties.put(\"mail.smtp.user\", from );¶
    properties.put(\"mail.smtp.password\", password);¶
    properties.put(\"mail.smtp.port\", port);¶
    properties.put(\"mail.smtp.auth\", \"true\");¶
    properties.put(\"java.net.preferIPv4Stack\", \"true\");¶
    properties.put(\"mail.smtp.ssl.trust\", \"mail.macrefresh.co.uk\");¶

   ¶
MimeMessage mime = new MimeMessage(Session.getInstance(properties));¶


mime.setFrom(new InternetAddress(from));¶

mime.addRecipient(Message.RecipientType.TO, new InternetAddress(to));¶
mime.setSubject(subject);¶
mime.setText(htmlbody);¶
Transport transport = Session.getInstance(properties).getTransport(\"smtp\");¶
transport.connect(host, port, from, password);¶
transport.sendMessage(mime, mime.getAllRecipients());¶
transport.close();¶
¶"
 )

Anybod have a clue what am I missing?

Thank you

 

Hello,

Could you please reproduce the issue and e-mail the log file to [email protected]? I'll need to see the full context of the error to discern exactly why it is failing, although, the stack trace indicates some sort of authentication or security issue. You can reference our documentation on how to locate the log file at the following link.
http://docs.360works.com/index.php/Plugin_log_files

  • 3 weeks later...

The error, shown by you is 

>> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.test.co.uk, port: 587;  nested exception is:    java.net.ConnectException: Connection refused: connect

 

That code works, so it is something in your parameters...

 

Edited by john renfrew

Hi John,

Thank you for your input on this issue. He submitted a support ticket with us and we resolved his issue by having him upgrade to the latest build of our plugin(v5.1099). I apologize for not sharing that update in this forum.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.