Sending email from application does not work as expected
Hello team,
we are having problem sending emails from our application. We implement email sending mechanism inside java application that we built, then we import our code as a jar to our Talend job using a routine. When we test this talend job in studio - everything works perfectly, email is being sent. When we promote this very same job to talend runtime environment, this email sending usually gets broken. I am saying usually because sometimes it works. I could not figure what exactly makes it work but it does work sometimes, and this tells me that all configuration files required by this application are in place. Then after a while it stops working correctly. Email still goes out but this is how we receive it: ------=_Part_0_1656723917.1461069744527--
Any suggestions what can it be and how to fix this?
Talend version that we use:
Talend ESB
Version: 6.0.1
Build id: 20150908_1633
This could be a number of things, unfortunately not likely directly caused by Talend. The Talend Runtime (Apache Karaf) is an Osgi container. This has many advantages, but can also cause problems for apps not written to run inside an Osgi container. Without more information it is going to be really hard to identify this issue.
To provide more info, try the following.
1) Load your Karaf client and remove the bundles related to your route (bundles:stop #routenumber)
2) Go to you deploy folder (in a location similar to this ..\Runtime_ESBSE\container\deploy) and delete the kars related to your route.
3) Redeploy your route
4) Wait for it to fail (or send rubbish emails)
5) Go to you log folder (in a folder similar to this ..\Runtime_ESBSE\container\log) and take a look at the tesb.log file (the latest one). This should have any errors associated to your route.
If you can post this, it may help us point to your issue. It would also be good to know a bit more about your app.
Hi rhall_2.0
Thank you for your reply.
I am using enterprise version of ESB, so I dont deploy via deploy folder. My deploy folder is empty. This application in question does not depend on any other bundle in Caraf container, the only dependency that it has is configuration files and email templates that I placed in etc folder (and it finds them without any issues). When it sends rubbish email there are no errors in log file, unfortunately nothing! What puzzles me the most is that it works sometimes and then it stops working for no apparent reason - no changes to the container, no changes to the application.
We also cannot send email by a separate component simply because sending email is a part of application logic. It involves multiple steps on application side to figure out when to send it, how to compose it and what to do if it fails. It was written by the application team, maybe it could have been done somewhat differently but this is what I have right now and have to figure out how to make it work
Your error looks like a multipart mime boundary. This is more Java than ESB, but it could be caused by Jars that are used in the Karaf. The Studio and the Karaf are very slightly different. A good development paradigm is to build in the Studio first. Get it right there. Then export to a local Karaf (on your machine) that is configured as your Prod Karaf. Once you have proven it works there (where you can tinker and tweak the Karaf settings) you can then replicate those on the Prod Karaf.
I know this is a bit of a pain, but unfortunately it is needed to avoid situations where "it worked in Studio but not when deployed". When it comes to investigating the Karaf, you can start looking here
http://karaf.apache.org/
In Eclipse, in it's standalone state, and even in Talend Studio to some extent, you are in complete control of the Jars it depends on. Do you even know which Jars are in Apache by default or which versions? There are loads. You also have feature sets which can be switched on and off. When I said that the problem was Java, I was referring to the problem being caused by the classes in the classpath available to your app when it is inside the Karaf. My suggestion on how to get round this (and mitigate problems similar to this in the future) is from a lot of experience in getting issues like this. Ultimately you either end up changing the required Jars you build with or changing the Jars that the Karaf uses (hoping not to break something else). But it is a Java issue. The Karaf doesn't change how your app works, but it might be providing an incorrect version of a Jar for it to use.