Chaitanya Desai [http://community.jboss.org/people/chaitanya1987] created the 
discussion

"Exception when trying eastablish connection and send emails using jBPM 5.1"

To view the discussion, visit: http://community.jboss.org/message/620008#620008

--------------------------------------------------------------
Hello,
         I am trying to use EmailWorkItemHandler from the jBPM Work Items jar 
and using the following code snippet, I am trying to send an email :
It fails at trying to eastablish connection. 
I have a seperate email service to send emails which I used previously to send 
the emails using the same credentials and it works however the same credentials 
when I use it with EmailWorkItemHandler it fails:

EmailWorkItemHandler emailHandler = new 
EmailWorkItemHandler("smtp.gmail.com","465"," mailto:u...@domain.com 
u...@domain.com","password");

                        WorkItemImpl workItem = new WorkItemImpl();
                  workItem.setParameter( "To", " mailto:us...@domain.com 
us...@domain.com" );
                  workItem.setParameter( "Cc", " mailto:us...@domain.com 
us...@domain.com" );
                  workItem.setParameter( "Bcc", " mailto:us...@domain.com 
us...@domain.com" );
                  workItem.setParameter( "From", " mailto:u...@domain.com 
u...@domain.com" );
                  workItem.setParameter( "Reply-To", " mailto:us...@domain.com 
us...@domain.com" );
                  workItem.setParameter( "Subject", "Time pass" );
                  workItem.setParameter( "Body", "Body" );

                  WorkItemManager manager = new DefaultWorkItemManager(null);
(Also tried instead of above statement) : WorkItemManager manager = 
ksession.getWorkItemManager();
(where ksession is a valid active session to the knowledgeBase currently)

                  emailHandler.executeWorkItem( workItem, manager );

Am I trying the correct approach with above code snippet to send emails or is 
there any other approach

Mail and activation jars (provided by jbpm installer) are in the classpath 

Exception :

.08.2011 16:45:39 ERROR [STDERR] java.lang.RuntimeException: Unable to send 
email
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:103)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jbpm.process.workitem.email.EmailWorkItemHandler.executeWorkItem(EmailWorkItemHandler.java:110)
08.08.2011 16:45:39 ERROR [STDERR]           at 
us.secureall.device.sessionBean.ManagerBean.initiateWorkflow(ManagerBean.java:10857)
08.08.2011 16:45:39 ERROR [STDERR]           at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
08.08.2011 16:45:39 ERROR [STDERR]           at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
08.08.2011 16:45:39 ERROR [STDERR]           at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
08.08.2011 16:45:39 ERROR [STDERR]           at 
java.lang.reflect.Method.invoke(Method.java:597)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
08.08.2011 16:45:39 ERROR [STDERR]           at 
sun.reflect.GeneratedMethodAccessor301.invoke(Unknown Source)
08.08.2011 16:45:39 ERROR [STDERR]           at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
08.08.2011 16:45:39 ERROR [STDERR]           at 
java.lang.reflect.Method.invoke(Method.java:597)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_24638698.invoke(InvocationContextInterceptor_z_fillMethod_24638698.java)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_24638698.invoke(InvocationContextInterceptor_z_setup_24638698.java)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.security.RunAsSecurityInterceptorv2.invoke(RunAsSecurityInterceptorv2.java:94)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
08.08.2011 16:45:39 ERROR [STDERR] Caused by: java.lang.RuntimeException: 
Connection failure
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:97)
08.08.2011 16:45:39 ERROR [STDERR]           ... 58 more
08.08.2011 16:45:39 ERROR [STDERR] Caused by: javax.mail.MessagingException: 
Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
08.08.2011 16:45:39 ERROR [STDERR]           at 
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1270)
08.08.2011 16:45:39 ERROR [STDERR]           at 
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
08.08.2011 16:45:39 ERROR [STDERR]           at 
javax.mail.Service.connect(Service.java:275)
08.08.2011 16:45:39 ERROR [STDERR]           at 
javax.mail.Service.connect(Service.java:156)
08.08.2011 16:45:39 ERROR [STDERR]           at 
org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:94)
08.08.2011 16:45:39 ERROR [STDERR]           ... 58 more
08.08.2011 16:45:39 WARN  [arjLoggerI18N] [com.arjun
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/620008#620008]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to