Download Mail.jar

0 views
Skip to first unread message

Gaylene Merganthaler

unread,
Aug 5, 2024, 12:51:38 PM8/5/24
to mahrememic
Secondquestion is: What happens if an unmonitored app includes these jars in its own lib? (it seems this breaks the log4j emails for Tomcat. I'm confused why Tomcat doesn't find and use the classses in its own lib rather than throwing a smtp mail provider exception (presumably due to the multiple occurances of the same mail.jar in the classpath).

Those jars have to be on Tomcat's classpath if Tomcat uses them. Even if some webapp includes them too, every webapp has its own class loader and these jars are not visible to the lower level tomcat. The WebbappClassLoader implements the child-first delegation model in contrast to the Java default parent-first model.


I am following -jira-s-smtp-mail-server-to-send-notifications-938847638.html to set up outgoing email on JIRA 7.7.1 after in-place upgrading from 7.6.1 on 64-bit Suse Linux. I am using Gmail and JNDI. I am getting error "java.lang.NoClassDefFoundError: javax/mail/Authenticator" when doing a connection.


The solution described in the document is to "move the mail-1.4.1.jar and activation-1.1.1.jar from the /WEB-INF/lib/ subdirectory of the JIRA application installation directory into the the lib/ subdirectory of the JIRA installation directory". However, file mail-1.4.1.jar doesn't exist in any of the JIRA directories (activation-1.1.1.jar does, though).


Hi @Thomas Deiler, as to why I used the "old" jar file: according to the document I followed, the aim was to get mail-1.4.1 working in /usr/JIRA/lib. It did after removing the duplicate javax library.


I downloaded the 1.4.1 version from Oracle and put the executable mail.jar into the /usr/JIRA/lib directory as mail-1.4.1.jar together with the activation-1.1.1.jar file as per the documentation. I also made sure that no other mail-*.jar or activation-1.1.1.jar files exist in other directories.


that sound's odd. The file is part of the Jira installation, you removed. The methods of mail-1.4.1 get overwritten by javax-mail. But why does Jira request for the old jar file? Or why is this recommended?


I am going to verify tomorrow but actually it should work because this is the Tomcat demo setup supplied with the distribution, or not?



I think it is a javax.mail or Tomcat issue. How do I get javax.mail to be a bit more verbose? Searching with Google showed up people having the same problem but most of them could see a cause for the exception.


Not sure how much was tested on Tomcat. Jobscheduler probably was, just like the core, but not sure if mail was included. I'd hope so, but it just might have been forgotten.



I have no idea how to get javax.mail more verbose. Maybe running it in a debug mode (e.g. from eclipse) might help.


Afaik Joram has done the integration work for Tomcat, right? Maybe I am lucky and he is going to give a statement on this. :) I searched around with Google and there are different proposals what to do. I am going to try some more things tomorrow and I'll keep you up to date here.


Good morning,



I was out of luck and I did not find a solution. According to my Google search the exception javax.mailNoSuchProviderException: smtp can be thrown in a various cases:



* There is no mail.jar on the classpath or no smtp.jar. But this is not the case because mail.jar is on the classpath. Furthermore according to the javamail documentation mail.jar includes smtp.jar normally and you either use mail.jar packed with all the stuff needed or single jars like mailapi.jar and smtp.jar.



* There are several copies of the files described above in the classpath and they are of different versions. But I could not find more than one mail.jar.



To verify there are no problems with the jars and Tomcat I created a web application which just sends out an email using javamail and I deployed it to the server. This worked without a problem.



I don't know jBPM sends e-mails from mail tasks. The javamail tutorial looks up a JavaMail Session via JDNI. For my test I just used Session.getDefaultInstance(). So maybe it is something related with this?



Any hints?



I think I am going to report this as a bug or not, Ronald?




I tried to find a work-around for this and decided to send mails directly in a java task using javamail. I used the same code as in the web application mentioned above and I got the same exception which shows up when trying to use mail tasks. So I suppose it's a classpath issue. But which one exactly?


Yes, I am aware of it and it looks like this. In build.xml you can specify the property mail.smtp.host and it is taken into account. Manually I also changed mail.from. As I said this works fine in a unit test with the same jbpm.mail.properties used.






The Angus Mail project is a compatible implementation ofthe Jakarta Mail Specification 2.1+ providing a platform-independent andprotocol-independent framework to build mail and messaging applications.It is available for use with theJava SE platformand in the Jakarta EE platform.


To break tight integration between Jakarta Mail Specification API and the implementation,sources of the implementation were moved to this project and further development continues here.Angus Mail is the direct successor of JavaMail/JakartaMail.


The following table provides easy access to the latest release. Mostpeople will only need the main Angus Mail implementation in theangus-mail.jar and jakarta.mail-api.jar files togetherwith the Angus Activationon the module path or on the class path.


Alternatively, jakarta.mail.jar, which includes Jakarta Mail APIs with Angus Mail runtime as a default provider in onejar file, can be used, ie to limit the length of the classpath or number of dependencies:


From time to time snapshot releases of the next version of Angus Mailunder development are published to theJakarta Sonatype OSS repository.These snapshot releases have received only minimal testing, but mayprovide previews of bug fixes or new features under development.


See Build Instructions for instructions on how todownload and build the most recent Angus Mail source code. You can alsofind a bundle of the source code for the most recent Angus Mail releasein the Releases area ofthis project.


I'm trying to send an email notification using JavaMail API. I've copied the mail.jar and activation.jar in my PORTAL-INF/lib folder. Initially I was getting an SMTP error. After much dabbling, I figured that the problem was with the "javamail.default.properties" file (under META-INF directory) which has entry for SMTP. It was pointing to a SAP SMTPTransport class. I changed that to point to SUN's SMTPTransport class. And I restarted the server. But my changes were over-written upon deployment. I want to know where does the J2EE Engine look to deploy mail.jar (because the property file is in that jar). My suspicion is that at the point of deployment, it is looking into some mail.jar to copy the property file to META-INF. Any help is appreciated.


the J2EE Engine contains its own JavaMail provider (represented at runtime as the JavaMail Client Service, and defines APIs by the Mail library). Having that said, I don't think you have to the mail.jar in the PORTAL-INF/lib folder; instead, you can declare a reference to the Mail library in the portalapp.xml as described here. However, this is just a suggestion from a person, who's not an expert in portal development => not 100% sure if it works!


Now back to the configuration of the J2EE Engine's mail provider... The separate protocol providers configuration is kept centrally in the javamail.default.providers file located under the \usr\sap\\\j2ee\cluster\server0\META-INF directory. You can change the SMTP provider to the SUN's implementation there. This is the case up to SP10 of the J2EE Engine. With SP11 on, the Sun's implmentation of the SMTP protocol is used by default.


I actually did not give you the full solution in my first post. Just wanted to see if this works first. The reason the settings get reset upon restart of the server is because the J2EE Engine keeps it's configuration data in the database. So, you have edited the JavaMail configuration file in the local file system, whereas the J2EE Engine synchronizes the old version of the file from the DB upon startup.. and that causes the "reset" of the changes.


I want to send an mail through ANT. For this, I have copied mail.jar and activation.jar in ANT-Installation-Dir/lib folder and also basedir/lib folder. I have downloaded javamail-1_3_3_01.zip (which contains mail.jar), jaf-1_0_2-upd2.zip (which contains activation.jar), and copying the two jar files into the lib directory of Apache Ant.


Progress, Telerik, Ipswitch and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.


in the java code i am taking the reference of some externam APIs, say [color=red]mail.jar [/color]i am using.

on the UNIX system when i am setting the classpath, compiling and running is fine for the

java code.

But when the same script is been run from the Asterisk, it gives error as follows:


Ya things are working fine at my end as you have directed. But the thing

is i am already able to call the program from the UNIX successfully and it

sends the mail successfully (as i am able to receive the mail as well)


So when i make a call from xlite at 1300, then the AGI server calls the

script and gives the error. My sample Hellow AGI script is working fine.

Problem is only with the mail sending program as the server fails to get

the mail.jar file.


The examples/mail project contains an example of the email support in action. It demonstrates proper packaging, and it contains a number of example that demonstrate the key features currently supported.


The tag wraps the whole message, and tells Seam to start rendering an email. Inside the tag we use an tag to set who the message is from, a tag tospecify a sender (notice how we use EL as we would in a normal facelet), and a tag.

3a8082e126
Reply all
Reply to author
Forward
0 new messages