Null Pointer Exception when Sending Email

I am attempting to send email using cfmail through our mailserver that resides on the same physical box as our Lucee server. I have dozens of websites currently running on the same server, each in their own context. All of them are able to use cfmail with no problem, except for one. On this one particular website, every time an email is attempted, the following error is generated:

java.lang.NullPointerException
java.lang.NullPointerException
at lucee.commons.io.log.log4j.Log4jEngine.getAppender(Log4jEngine.java:310)
at lucee.commons.io.log.LoggerAndSourceData.getLog(LoggerAndSourceData.java:130)
at lucee.runtime.config.ConfigImpl.getLog(ConfigImpl.java:3610)
at lucee.runtime.config.ConfigImpl.getLog(ConfigImpl.java:3604)
at lucee.runtime.net.smtp.SMTPClient._send(SMTPClient.java:754)
at lucee.runtime.spooler.mail.MailSpoolerTask.execute(MailSpoolerTask.java:115)
at lucee.runtime.spooler.SpoolerTaskSupport._execute(SpoolerTaskSupport.java:107)
at lucee.runtime.spooler.SpoolerEngineImpl.execute(SpoolerEngineImpl.java:590)
at lucee.runtime.spooler.SpoolerEngineImpl$TaskThread.run(SpoolerEngineImpl.java:528)

This website (code unchanged) was previously able to send emails without problem on an older server running Railo prior to updating in February to a new server with Lucee 5.3.4.80. Also, the same code currently works fine on my development server also running Lucee 5.3.4.80. For these reasons, I am virtually certain this is not a coding issue.

I believe something may have happened relative to the way this one website is attempting to connect to our mailserver. Currently, the website is set to use the default mail server settings as configured in the Lucee Administrator. As a workaround, I have tried adding a secondary entry in the web administrator for this site, as well as using the server and port attributes in the cfmail tag to specify the server. All attempts result in the same error.

I have spent a great deal of time searching for a solution to this problem, but have found nothing that directly addresses this issue. I would really, really appreciate any help you all could provide!

Thanks in advance!

Hi biggiantjohn!!! Welcome!!!

I had some null java.lang.NullPointerException today on a Windows Box, and it turned out JAVA wasn’t able to write into a certain folder because of WRITE permissions. This is just an idea, but is it possible that your cfmail logging is writing to a location in which lucee has no write permissions? I would check location where cfmail of that web context is writing its log files and crosscheck writing permissions.

log4j errors can also be caused by a different conflicting version of log4j being included via additional jars which include a different version of log4j.

there have also been a lot of class loader tweaks since 5.3.4, are you able to try the latest stable release 5.3.6.61?

Thank you both for your suggestions! While waiting for your responses, I continued my own effort to fix the problem and achieved success. Unfortunately I was in a hurry to resolve the problem, so I was not properly documenting my steps, but something I did (before either of your replies) corrected the problem.

I think the initial configuration for this specific website may have been corrupted, if that’s even possible. All other sites on this server were/are working properly, and even this site was exhibiting no other problems other than an inability to send emails. I think the problem was resolved when I deleted this website from IIS (also deleting the Tomcat config xml files), and then set the whole thing up again using a different site name (but same domain name). I rebooted the server, but it still didn’t work until I subsequently restarted Lucee manually using the services window. All of this is to the best of my recollection, though, because I wasn’t documenting my steps. My apologies to anyone else finding this thread looking for an exact solution!!

@Zac_Spitzer FYI - I have subsequently upgraded to 5.3.6.61 per your suggestion!

Thanks again for your suggestions!

1 Like