Okay, I made sure I have the jakarta.mail packages in ${catalina.home}/lib, I've modified the context.xml from javax.mail.Session to jakarta.mail.Session and I'm receiving this:
[Time: 23 Mar 2023 20:44:04,203][Thread: main][Log: org.springframework.web.context.support.XmlWebApplicationContext][Level: WARN ] - [File: AbstractApplicationContext.java:591] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailSession': Invocation of init method failed; nested exception is org.springframework.jndi.TypeMismatchNamingException: Object of type [class jakarta.mail.Session] available at JNDI location [java:comp/env/mail/MailSession] is not assignable to [jakarta.mail.Session] [Time: 23 Mar 2023 20:44:04,211][Thread: main][Log: org.springframework.web.servlet.DispatcherServlet][Level: ERROR] - [File: FrameworkServlet.java:534] - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailSession': Invocation of init method failed; nested exception is org.springframework.jndi.TypeMismatchNamingException: Object of type [class jakarta.mail.Session] available at JNDI location [java:comp/env/mail/MailSession] is not assignable to [jakarta.mail.Session] ________________________________________________ Kevin Huntly Email: kmhun...@gmail.com Cell: 716/424-3311 ________________________________________________ -----BEGIN GEEK CODE BLOCK----- Version: 1.0 GCS/IT d+ s a C++ UL+++$ P+(++) L+++ E--- W+++ N+ o K(+) w--- O- M-- V-- PS+ PE Y(+) PGP++(+++) t+ 5-- X-- R+ tv+ b++ DI++ D++ G++ e(+) h--- r+++ y+++* ------END GEEK CODE BLOCK------ On Thu, Mar 23, 2023 at 8:29 PM Konstantin Kolinko <knst.koli...@gmail.com> wrote: > пт, 24 мар. 2023 г. в 03:09, Konstantin Kolinko <knst.koli...@gmail.com>: > > > > чт, 23 мар. 2023 г. в 18:38, Kevin Huntly <kmhun...@gmail.com>: > > > > > > Hi Everyone, > > > > > > I just migrated one of my apps off javax.servlet and onto > jakarta.servlet. > > > I am getting the following exception: > > > > > > <code> > > > [Time: 23 Mar 2023 11:31:44,134][Thread: main][Log: > > > > org.springframework.web.context.support.XmlWebApplicationContext][Level: > > > WARN ] - [File: AbstractApplicationContext.java:591] - Exception > > > encountered during context initialization - cancelling refresh attempt: > > > org.springframework.beans.factory.BeanCreationException: Error creating > > > bean with name 'mailSession': Invocation of init method failed; nested > > > exception is javax.naming.NamingException: Could not create resource > > > instance > > > [Time: 23 Mar 2023 11:31:44,139][Thread: main][Log: > > > org.springframework.web.servlet.DispatcherServlet][Level: ERROR] - > [File: > > > FrameworkServlet.java:534] - Context initialization failed > > > org.springframework.beans.factory.BeanCreationException: Error creating > > > bean with name 'mailSession': Invocation of init method failed; nested > > > exception is javax.naming.NamingException: Could not create resource > > > instance > > > at > > > [...] > > > ... 59 more > > > </code> > > > > > > I've never seen this exception before, and the same code/configuration > > > works on Tomcat 9.0.73. This is coming from 10.1.7 on RHEL 8.7 with > SELinux > > > enabled. I know the exception is coming from Spring, but it is > definitely > > > related to the JNDI configuration for my mailsession. > > > > > > The base context.xml is largely unchanged, with the exception of this > > > addition: > > > > (You say "the base context.xml." If you were editing the default > > conf/context.xml file shared by all web applications, instead of the > > one that belongs to our own web application, that is a usual > > misunderstanding / misconfiguration. Though not relevant to your > > error.) > > > > Documentation: > > > https://tomcat.apache.org/tomcat-10.1-doc/config/context.html#Defining_a_context > > > > > <code> > > > <Resource name="mail/MailSession" auth="Container" > > > type="javax.mail.Session" description="E-Mail Resource" > > > mail.debug="true" mail.transport.protocol="smtp" > > > mail.smtp.host="localhost" mail.smtp.auth="false" /> > > > </code> > > > > > > Anyone have any ideas? > > > > Have you read the docs on configuring the mail session factory? > > > https://tomcat.apache.org/tomcat-10.1-doc/jndi-resources-howto.html#JavaMail_Sessions > > > > Note that > > "4" an implementation library for Mail API is not bundled with Tomcat > > (you have to provide the needed library), Do you have one? > > > > "3" If the documentation is correct, the name of the package in > > Jakarta EE is "jakarta.mail.", not "javax.mail." (as used in your > > configuration), > > Regarding Mail API links in the documentation, see > https://bz.apache.org/bugzilla/show_bug.cgi?id=66542 > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >