Labels

Monday, April 20, 2015

ERROR - MailTransportSender Error creating mail message or sending it to the configured server + wso2

Hi Friends,

If you are getting the below error, when trying to send a mail. This occurs due to a simple issue :)
I got this issue while configuring WSO2 ESB to send mails.

 ERROR - MailTransportSender Error creating mail message or sending it to the configured server  
 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.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:489)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMessage(MailTransportSender.java:175)  
 at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)  
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)  
 at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)  
 at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)  
 at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)  
 at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)  
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)  
 at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)  
 at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)  
 at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)  
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)  
 at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:85)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)  
 at org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:640)  
 at org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:475)  
 at org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:252)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)  
 at org.apache.synapse.transport.passthru.TargetErrorHandler$1.run(TargetErrorHandler.java:134)  
 at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)  
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
 at java.lang.Thread.run(Thread.java:745)  
 [2015-04-20 16:28:31,370] ERROR - MailTransportSender Error generating mail message  
 org.apache.axis2.AxisFault: Error creating mail message or sending it to the configured server  
 at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:226)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:500)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMessage(MailTransportSender.java:175)  
 at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)  
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)  
 at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)  
 at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)  
 at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)  
 at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)  
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)  
 at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)  
 at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)  
 at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)  
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)  
 at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:85)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)  
 at org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:640)  
 at org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:475)  
 at org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:252)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)  
 at org.apache.synapse.transport.passthru.TargetErrorHandler$1.run(TargetErrorHandler.java:134)  
 at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)  
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
 at java.lang.Thread.run(Thread.java:745)  
 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.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:489)  
 ... 27 more  

First thing you should do is check if you have configure the MailTransportSender property correctly in the axis2.xml file
which is in $Carbon.Home/repository/conf/axis2/axis2.xml

   <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">  
     <parameter name="mail.smtp.from">vinurip1@gmail.com</parameter>  
     <parameter name="mail.smtp.user">vinurip1</parameter>  
     <parameter name="mail.smtp.password">mypassword</parameter>  
     <parameter name="mail.smtp.host">smtp.gmail.com</parameter>c  
     <parameter name="mail.smtp.port">587</parameter>  
     <parameter name="mail.smtp.starttls.enable">true</parameter>  
     <parameter name="mail.smtp.auth">true</parameter>  
   </transportSender>  


If all you details are correct but still get the issue go to you mail account and check for the permission. In Gmail they send a mail saying "blocked a sign-in attempt" or similar.

If this is also not working feel free to put a comment and ask questions :)

Best Regards,
~Vinu~

Friday, April 17, 2015

How to Edit the Contents of a .Jar File Without Extracting on a Mac

Hi friends,

Well this post will show you how to edit the content of a jar file without extracting the jar file in 4 simple steps. Works most of the time and it will save time to extract jar and back aging creating so on.

You cannot edit the class files ONLY the config files like xmls

STEP 1

Go to the file location from the terminal and open it from the vi /vim editor

STEP 2

You will get a list of files in the jar after doing Step 1. Select the file you want to edit by using up and down keys and press ENTER

STEP 3

After completing the Step 2 you will be able to  open the file you chose. edit the content as you prefer and press "esc" escape key and ":wq!" to save and quit (Normal vi commands)

STEP 4 

You will be direct to the same screen in Step 2 after saving the content. press "esc" escape key and ":q!" to quit (Normal vi commands)


That is it. so you don't have to extract to edit the content and save the time :)
let me know if this works or you found much simpler way to do it

Thank you
Best Regards,
~Vinu~