| 
 |  
Hi, 
 
we have to deploy an application as a tomcat 9 servlet. My current task is to define the JavaMail session via JNDI contexts. 
 
 
When setting the property er.javamail.sessionConfigViaJNDI=true  the container wasn't able to start correctly any more.   
I had to restart the tomcat in order to proceed :-( 
 
It turned out, the ERJavaMail initialization stuck at  
 
	finishInitialization() -> initializeFrameworkFromSystemProperties() -> setDefaultSession(null) 
 
 
My first step was to implement a lazy initialization of the ERJavaMail.defaultSession. 
 
Now the app started, but the first attempt to send a mail results in the following exception: 
 
.... - failed to send mail: javax.mail.Session cannot be cast to javax.mail.Session 
 
WTF? 
 
It turned out, that the javax.mail-1.6.0.jar was present in $CATALINA_HOME/lib _AND_ in MYApp/WEB-INF/lib 
instead of being only in in $CATALINA_HOME/lib. 
 
 
Even if placing the jars at the correct location fixes the root cause of not starting the container, I would opt for an  
lazy initialisation of the defaultSession (see https://github.com/wocommunity/wonder/pull/960) 
 
 
Regards 
 
	René 
 
 
 
 
Best regards 
 
René Bock 
 
-- 
salient GmbH, Lindleystraße 12, 60314 Frankfurt 
Main: +49 69 65 00 96 0  |  http://www.salient-doremus.de 
 
 |  
 
 |