I'm using Jetty 12.1.1 and I'm trying to add a MailSession with JNDI. I added a JNDI Datasource and it was simple, like the documentation said. Tried the MailSession and I haven't been able to make it work.
--- First problem ---
I thought that adding the ee10-jndi module was supposed to add the factories (jetty-ee10-jndi-12.1.1.jar). For some reason it is not adding it.
When I do list-config the jar does not show up and when I start it gives me a ClassNotFoundException which is understandable since its not adding the jar. Don't know what I'm doing wrong.
I tried adding the jar manually to the lib/ext directory and it creates the JNDI resource.
-- Second problem ---
After creating the JNDI resource I cant get a jakarta.mail.Session it returns the MailSessionReference. The only difference from the example is that I'm creating the session in the server, not the webapp.
The documentation says:
"The web application performs a lookup for java:comp/env/mail/Session at runtime and obtains a jakarta.mail.Session that has the correct configuration to permit it to send email via SMTP."
I'm getting the MailSessionReference instead of a jakarta.mail.Session like the documentation says. Hope someone can tell me what I'm doing wrong.
My JNDI config looks like this:
<New class="org.eclipse.jetty.plus.jndi.Resource"> <Arg></Arg> <Arg>mail/Session</Arg> <Arg> <New class="org.eclipse.jetty.ee10.jndi.factories.MailSessionReference"> <Set name="user">???</Set> <Set name="password">???</Set> <Set name="properties"> <New class="java.util.Properties"> <Put name="mail.smtp.host">???</Put> <Put name="mail.from">???</Put> <Put name="mail.debug">true</Put> </New> </Set> </New> </Arg> </New>
|