Hi Gian, try using aries:services instead of osgi:service for jndi lookup. This will avoid creating a proxy around. (https://aries.apache.org/modules/jndiproject.html)
Regards, Benjamin On 17.07.2020 10:28, Giamma wrote: > Hi, > > I have an application that tries to access a JavaMail session over JNDI. > > To make it run in Karaf I tried the following without luck: > > 1. I created a blueprint file which creates and configures the Java Mail > session > 2. I configured the application to lookup the mail session as an OSGi > service using JNDI name osgi:service/<mail-session-name> > > The mail session shows up in the jndi:names table: > > JNDI Name │ Class Name > ─────────────────────────┼─────────────────────────────────────────────── > osgi:service/jndi │ org.apache.karaf.jndi.internal.JndiServiceImpl > osgi:service/mailSession │ javax.mail.Session > > but it is not usable because when I try to look it up, the blueprint > container tries to proxy it, which is not possible because > javax.mail.Session is a final class. > > Is there a better way to make a javax.mail.Session available over JNDI in > Karaf? Something that does not require to write dedicated code that will > use the JNDI API to bind the Session instance in the JNDI context? Ideally > I would like the session configuration to be easily editable, and the above > approach looked good in principle, because I just had to drop a blueprint > file in the /deploy folder with all parameters, therefore easily editable. > > Thanks in advance. >
signature.asc
Description: OpenPGP digital signature
