I am working on creating a smart service for reading emails from POP3 mail server. I am using mailapi.jar and pop3.jar as external libraries. When I invoke the plugin from a process model, I am receiving the below error in the logs. However, the same code is working fine in Eclipse. Code is identical (other than the Appian API calls for accessing credential store and ContentService). Any help is appreciated.
Code snippet below:
Map<String, String> credentials = CredentialStore.getCredentials(this.scsKey, this.scs);
Properties properties = new Properties();
String pop3Host = (String) credentials.get(EmailConstants.MAIL_SERVER);
String userName = (String) credentials.get(EmailConstants.USERNAME);
String password = (String) credentials.get(EmailConstants.PASSWORD);
Session emailSession = Session.getDefaultInstance(properties);
Store store = emailSession.getStore("pop3"); -- This is where it is failing
System.out.println("Step0");
store.connect(pop3Host, userName, password);
System.out.println("Step1");
Exception:
javax.mail.NoSuchProviderException: pop3
at javax.mail.Session.getService(Session.java:806)
at javax.mail.Session.getStore(Session.java:586)
at javax.mail.Session.getStore(Session.java:548)
at javax.mail.Session.getStore(Session.java:527)
at com.botw.wmg.plugins.smartServices.FetchEmails.run(FetchEmails.java:77)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:131)
at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:52)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:131)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:125)
at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:25)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:125)
at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:83)
at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
at com.appiancorp.process.engine.ContinuationRequest.executeOuter(ContinuationRequest.java:71)
at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:100)
at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:35)
at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:84)
at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:239)
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)
2020-07-09 22:43:35,599 [Appian Work Item - 2357 - execution00 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=72034, classname=com.botw.wmg.plugins.smartServices.FetchEmails
com.appiancorp.suiteapi.process.exceptions.SmartServiceException: java.lang.Exception: pop3
at com.appiancorp.suiteapi.process.exceptions.SmartServiceException$Builder.build(SmartServiceException.java:145)
at com.botw.wmg.plugins.utils.ExceptionHandler.createException(ExceptionHandler.java:8)
at com.botw.wmg.plugins.smartServices.FetchEmails.run(FetchEmails.java:128)
Caused by: java.lang.Exception: pop3
Discussion posts and replies are publicly visible
Mike Cichy requesting your directions.