Hi all,

Yesterday myself and Dilan tried with the above code snippet. We first
tried creating the jaggery app manually inside
repository/deployment/server/jaggeryapps and it worked.We invoked it
serveral times and worked without any issue. After that we created an
archive of the same jaggerapp and upload it through the management
console.App got unzipped in the right manner.But invocation of that failed
with the above exception that Dilan has mentioned.

After several retries, I got a mail from google with the subject "Google
Account: sign-in attempt blocked", which says that the mail sending has
been identified as a suspicious activity and google has blocked it.

Then again I tried with a yahoo account by uploading the archive and it
worked fine.

So the issue is, after several attempts, google identify the access to the
sender's account as a suspicious activity and blocked sending mails from
sender's account. Therefore there is no issue with the jaggery email host
object.

Thanks,
Tanya


On Tue, Oct 28, 2014 at 5:01 PM, Harshan Liyanage <[email protected]> wrote:

> Hi Tanya,
>
> I've tried the same code snippet & I'm getting the same issue Dilan has
> encountered. However this email sending feature was already tested &
> verified feature. I'm wondering what causes this exception.
>
> Thanks,
>
> Best Regards,
>
> Lakshitha Harshan
> Software Engineer
> Mobile: *+94724423048*
> Email: [email protected]
> Blog : http://harshanliyanage.blogspot.com/
> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
> lean.enterprise.middleware.
>
> On Tue, Oct 28, 2014 at 4:28 PM, Tanya Madurapperuma <[email protected]>
> wrote:
>
>>
>>
>> On Tue, Oct 28, 2014 at 4:18 PM, Dilan Udara Ariyaratne <[email protected]>
>> wrote:
>>
>>> Hi Tanya,
>>>
>>> This is exactly as same as what I tested. The only difference is that I
>>> checked this on a standalone emm server (EMM 1.1.0) and
>>> then on a standalone Jaggery Server (Jaggery 1.0.0-SNAPSHOT_ALPHA3).
>>>
>>> So, if this works fine for you when tested on top of an AS, well, what
>>> is the Jaggery version that you are dealing with?
>>>
>>
>> 0.9.0ALPHA4
>>
>>>
>>> Thanks for your feedback.
>>>
>>>
>>>
>>> *Dilan U. Ariyaratne*
>>> Software Engineer
>>> WSO2 Inc. <http://wso2.com/>
>>> Mobile: +94775149066
>>> lean . enterprise . middleware
>>>
>>> On Tue, Oct 28, 2014 at 3:30 PM, Tanya Madurapperuma <[email protected]>
>>> wrote:
>>>
>>>> Hi Dilan,
>>>>
>>>> As the error itself explains, your error is due to incorrect
>>>> credentials of the sender. Following code snippet works for me.(Tested with
>>>> AS 5.2.1) But when I change the password to an incorrect value, I can
>>>> reproduce the same error you get.
>>>>
>>>> <%
>>>>     var to = "[email protected]";
>>>>     var from = "[email protected]"
>>>>     var subject = "Test Subject";
>>>>     var content = "Test Content";
>>>>
>>>>     var msg = require('email');
>>>>     var email = new msg.Sender("smtp.gmail.com", "25", "[email protected]",
>>>> "xxxxxx", "tls");
>>>>
>>>>     email.from = from;
>>>>     email.to = to;
>>>>     email.subject = subject;
>>>>     email.text = content;
>>>>     email.send();
>>>>
>>>>     print("email successfully sent");
>>>>
>>>> %>
>>>>
>>>> Thanks,
>>>> Tanya
>>>>
>>>> On Tue, Oct 28, 2014 at 2:36 PM, Dilan Udara Ariyaratne <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Inosh,
>>>>>
>>>>> I used the same configuration as provided in the documentation
>>>>> and it didn't work at all.
>>>>>
>>>>>
>>>>> *Dilan U. Ariyaratne*
>>>>> Software Engineer
>>>>> WSO2 Inc. <http://wso2.com/>
>>>>> Mobile: +94775149066
>>>>> lean . enterprise . middleware
>>>>>
>>>>> On Tue, Oct 28, 2014 at 2:27 PM, Inosh Perera <[email protected]> wrote:
>>>>>
>>>>>> Hi Dilan,
>>>>>> It would be easier, if you can provide the configurations(parameters)
>>>>>> you provided to this function can also be included here. Is it the same 
>>>>>> as,
>>>>>> var sender = new email.Sender("smtp.gmail.com", "25", "username",
>>>>>> "password", "tls");
>>>>>>
>>>>>> Regards,
>>>>>> Inosh
>>>>>>
>>>>>> On Tue, Oct 28, 2014 at 2:23 PM, Dilan Udara Ariyaratne <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi All,
>>>>>>>
>>>>>>> I am currently working on an EMM Issue that is directly associated
>>>>>>> with Jaggery Sender Object [1].
>>>>>>> When I run the email sending function that wraps up the Jaggery
>>>>>>> Sender.send() function, that results in an AuthenticationFailedException
>>>>>>> as follows.
>>>>>>>
>>>>>>> ERROR {JAGGERY.modules.user:js} -
>>>>>>> org.mozilla.javascript.WrappedException: Wrapped
>>>>>>> org.jaggeryjs.scriptengine.exceptions.ScriptException:
>>>>>>> javax.mail.AuthenticationFailedException (/emm/modules/user.js#893)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
>>>>>>>     at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.FunctionObject.call(FunctionObject.java:449)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.modules.c7._c_anonymous_39(/emm/modules/user.js:893)
>>>>>>>     at org.jaggeryjs.rhino.emm.modules.c7.call(/emm/modules/user.js)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.api.c0._c_anonymous_17(/emm/api/userRouter.js:192)
>>>>>>>     at org.jaggeryjs.rhino.emm.api.c0.call(/emm/api/userRouter.js)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.modules.c5._c_anonymous_13(/emm/modules/goose.js:174)
>>>>>>>     at org.jaggeryjs.rhino.emm.modules.c5.call(/emm/modules/goose.js)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.modules.c3._c_callAPI_12(/emm/modules/absolute.js:171)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.modules.c3.call(/emm/modules/absolute.js)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.modules.c3._c_anonymous_15(/emm/modules/absolute.js:228)
>>>>>>>     at
>>>>>>> org.jaggeryjs.rhino.emm.modules.c3.call(/emm/modules/absolute.js)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
>>>>>>>     at org.jaggeryjs.rhino.emm.c0._c_script_0(/emm//index.jag:189)
>>>>>>>     at org.jaggeryjs.rhino.emm.c0.call(/emm//index.jag)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
>>>>>>>     at
>>>>>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
>>>>>>>     at org.jaggeryjs.rhino.emm.c0.call(/emm//index.jag)
>>>>>>>     at org.jaggeryjs.rhino.emm.c0.exec(/emm//index.jag)
>>>>>>>     at
>>>>>>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
>>>>>>>     at
>>>>>>> org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
>>>>>>>     at
>>>>>>> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:447)
>>>>>>>     at
>>>>>>> org.jaggeryjs.jaggery.core.JaggeryServlet.doPut(JaggeryServlet.java:39)
>>>>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:758)
>>>>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
>>>>>>>     at
>>>>>>> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>>>>>>>     at
>>>>>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>>>>>>>     at
>>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>>>>>>>     at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
>>>>>>>     at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.apimgt.interceptor.valve.APIManagerInterceptorValve.invoke(APIManagerInterceptorValve.java:75)
>>>>>>>     at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
>>>>>>>     at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
>>>>>>>     at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
>>>>>>>     at
>>>>>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
>>>>>>>     at
>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
>>>>>>>     at
>>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>>>>>>>     at
>>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>>>>>>>     at
>>>>>>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
>>>>>>>     at
>>>>>>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>>>>>>>     at
>>>>>>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
>>>>>>>     at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>>>>>>>     at
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>>>>>>>     at java.lang.Thread.run(Thread.java:662)
>>>>>>> Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException:
>>>>>>> javax.mail.AuthenticationFailedException
>>>>>>>     at
>>>>>>> org.jaggeryjs.hostobjects.email.SenderHostObject.jsFunction_send(SenderHostObject.java:406)
>>>>>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>     at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>     at
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>     at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
>>>>>>>     ... 97 more
>>>>>>> Caused by: javax.mail.AuthenticationFailedException
>>>>>>>     at javax.mail.Service.connect(Service.java:306)
>>>>>>>     at javax.mail.Service.connect(Service.java:156)
>>>>>>>     at javax.mail.Service.connect(Service.java:105)
>>>>>>>     at javax.mail.Transport.send0(Transport.java:168)
>>>>>>>     at javax.mail.Transport.send(Transport.java:98)
>>>>>>>     at
>>>>>>> org.jaggeryjs.hostobjects.email.SenderHostObject.jsFunction_send(SenderHostObject.java:404)
>>>>>>>     ... 102 more
>>>>>>>
>>>>>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>>>>>> -
>>>>>>>
>>>>>>> Then I tested the same use-case with Jaggery Sender Object demo
>>>>>>> code, as mentioned on its documentation [1]
>>>>>>> and ended up with the same exception.
>>>>>>>
>>>>>>> Any idea on why this error pops up?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> [1] http://jaggeryjs.org/documentation.jag?api=sender
>>>>>>>
>>>>>>>
>>>>>>> *Dilan U. Ariyaratne*
>>>>>>> Software Engineer
>>>>>>> WSO2 Inc. <http://wso2.com/>
>>>>>>> Mobile: +94775149066
>>>>>>> lean . enterprise . middleware
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> [email protected]
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Inosh Perera
>>>>>> Software Engineer, WSO2 Inc.
>>>>>> Tel: 0785293686
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> [email protected]
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Tanya Madurapperuma
>>>>
>>>> Software Engineer,
>>>> WSO2 Inc. : wso2.com
>>>> Mobile : +94718184439
>>>> Blog : http://tanyamadurapperuma.blogspot.com
>>>>
>>>
>>>
>>
>>
>> --
>> Tanya Madurapperuma
>>
>> Software Engineer,
>> WSO2 Inc. : wso2.com
>> Mobile : +94718184439
>> Blog : http://tanyamadurapperuma.blogspot.com
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
Tanya Madurapperuma

Software Engineer,
WSO2 Inc. : wso2.com
Mobile : +94718184439
Blog : http://tanyamadurapperuma.blogspot.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to