ナレッジベース
公開されました Oct. 9, 2025

How to Resolve JNDI Mail Session java.lang.NoClassDefFoundError: javax/mail/Authenticator Tomcat errors

written-by

Debora Vita

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Issue

How can I resolve this exception observed during initialization of global JNDI resources during Liferay startup on Tomcat? 

org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans Exception processing global JNDI Resources javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.NoClassDefFoundError: javax/mail/Authenticator] at org.apache.naming.factory.ResourceFactory.getDefaultFactory(ResourceFactory.java:74) 
... 
Caused by: java.lang.NoClassDefFoundError: javax/mail/Authenticator

Environment

  • DXP 7.4+

Resolution

Though an official solution is being explored on LPD-64152, you can follow the below steps to resolve these JNDI Mail Session errors on Tomcat:

  1. Shutdown Liferay

  2. Move the following libraries from [TOMCAT_HOME]/webapps/ROOT/WEB-INF/shielded-container-lib to [TOMCAT_HOME]/lib:

    • activation.jar

    • com.sun.mail.jakarta.mail.jar

  3. Modify your portal-ext.properties accordingly:

    • Include the package: org.apache.naming.java in the module.framework.properties.org.osgi.framework.bootdelegation portal property.

    • If you already have customizations for this property, you would include the package in your customized property.

    • If not, you can copy and modify the default property from your current Liferay version's portal.properties file. As an example, for 2025.Q1.3:

      module.framework.properties.org.osgi.framework.bootdelegation=\ 
      __redirected,\ 
      com.liferay.expando.kernel.model,\
      com.liferay.glowroot.plugin.*,\
      com.liferay.portal.servlet.delegate,\
      com.liferay.portal.servlet.delegate*,\
      com.sun.ccpp,\ 
      com.sun.ccpp.*,\
      com.sun.crypto.*,\ 
      com.sun.image.*,\
      com.sun.imageio.plugins.*,\ 
      com.sun.jmx.*,\
      com.sun.jndi.*,\ 
      com.sun.mail.*,\
      com.sun.management.*,\ 
      com.sun.media.*,\
      com.sun.msv.*,\ 
      com.sun.org.*,\
      com.sun.tools.*,\ 
      com.sun.xml.*,\ 
      com.yourkit.*,\ 
      jdk.*,\ 
      org.apache.el,\ 
      org.apache.el.*,\ 
      org.apache.naming.java,\ 
      org.glowroot.agent,\ 
      org.glowroot.agent.*,\ 
      sun.*,\ 
      weblogic.jndi,\ 
      weblogic.jndi.*
      

      Note: The package org.apache.naming.java is now included in the list 

  4. Start Liferay.

You can validate the fix by performing an action that generates an email, such as triggering an account validation email by logging in as a new user.

 

Additional Information

The above workaround solution assumes that steps similar to the following were used to configure the JNDI mail session in Tomcat:

  1. This configuration or similar within Tomcat's server.xml file:

    <Resource name="mail/MailSession" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost" mail.smtp.port="25"/>
    
  2. This resource configuration within the LIFERAY_HOME/tomcat/conf/Catalina/localhost/ROOT.xml file:

    <ResourceLink global="mail/MailSession" name="mail/MailSession" type="javax.mail.Session"/>
    
  3. The following lines within the portal-ext.properties file:

    mail.session.jndi.name=mail/MailSession mail.session.mail=false
    
did-this-article-resolve-your-issue

ナレッジベース