Custom Smart Service : Javax.mail : Email Reader

I am trying to create a custom smart service to read emails and its attachments from POP3 server. As part of that, I am using mailapi.jar and pop3.jar. When the smart service gets invoked in a Process model, I am getting the below error. The same code is working fine in eclipse. Code identical between the smart service and the unit testing code in Eclipse (except Appian specific API calls). Any help is appreciated 

Code that I use: 

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");

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)

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)

Caused by: java.lang.Exception: pop3

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data