title: Gerrit Register New Email 500 Error
body: <p>I have just setup gerrit 2.12.4 on a turnkey revision control 14.1 and when I try the Register New Email feature I receive a 500 Internal Error.
  I receive the following error message in the error_log and don't know how to interpret it.</p>
  
  <p>Here is the config:</p>
  
  <pre><code>[gerrit]                                                                                                                                                                                                           
          basePath = /srv/repos/git/gerrit2/                                                                                                                                                                         
          canonicalWebUrl = http://revision-control:7900/                                                                                                                                                            
  [database]                                                                                                                                                                                                         
          type = mysql                                                                                                                                                                                               
          hostname = localhost                                                                                                                                                                                       
          database = reviewdb                                                                                                                                                                                        
          username = gerrit2                                                                                                                                                                                         
  [index]                                                                                                                                                                                                            
          type = LUCENE                                                                                                                                                                                              
  [auth]                                                                                                                                                                                                             
          type = OPENID                                                                                                                                                                                              
  [receive]                                                                                                                                                                                                          
          enableSignedPush = false                                                                                                                                                                                   
  [sendemail]                                                                                                                                                                                                        
          enable = true                                                                                                                                                                                              
          smtpServer = smtp.office365.com                                                                                                                                                                            
          smtpServerPort = 587                                                                                                                                                                                       
          smtpUser = email@email.com                                                                                                                                                                             
          smtpEncryption = ssl                                                                                                                                                                                       
          sslVerify = false                                                                                                                                                                                          
  [container]                                                                                                                                                                                                        
          user = gerrit2
          javaHome =  /usr/lib/jvm/java-7-openjdk-amd64/jre                                                                                                                                                          
  [sshd]                                                                                                                                                                                                             
          listenAddress = *:29418                                                                                                                                                                                    
  [httpd]                                                                                                                                                                                                            
          listenUrl = http://*:7900/                                                                                                                                                                                 
  [cache]                                                                                                                                                                                                            
          directory = cache  
  </code></pre>
  
  <p>I suspect the process fails way before the smtp authentication.
  I have checked the java path and it seems to be in order.</p>
  
  <p>I have also given full permission to gerrit2 on both the java folder and the gerrit folder.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <pre><code>[2016-09-07 20:55:23,439] [main] INFO  org.eclipse.jetty.server.ServerConnector : Started ServerConnector@4a9829f1{HTTP/1.1}{0.0.0.0:7900}                                                                         
  [2016-09-07 20:55:23,440] [main] INFO  org.eclipse.jetty.server.Server : Started @20499ms                                                                                                                          
  [2016-09-07 20:55:23,442] [main] INFO  com.google.gerrit.pgm.Daemon : Gerrit Code Review 2.12.4 ready                                                                                                              
  [2016-09-07 20:56:54,864] [HTTP-50] WARN  org.eclipse.jetty.servlet.ServletHandler : Error for /accounts/self/emails/test@email.com                                                                  
  java.lang.ExceptionInInitializerError                                                                                                                                                                              
          at com.google.gerrit.server.mail.OutgoingEmail.add(OutgoingEmail.java:384)                                                                                                                                 
          at com.google.gerrit.server.mail.RegisterNewEmailSender.init(RegisterNewEmailSender.java:49)                                                                                                               
          at com.google.gerrit.server.mail.OutgoingEmail.send(OutgoingEmail.java:92)                                                                                                                                 
          at com.google.gerrit.server.account.CreateEmail.apply(CreateEmail.java:134)                                                                                                                                
          at com.google.gerrit.server.account.CreateEmail.apply(CreateEmail.java:101)                                                                                                                                
          at com.google.gerrit.server.account.CreateEmail.apply(CreateEmail.java:42)                                                                                                                                 
          at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:328)                                                                                                                         
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)                                                                                                                                            
          at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:287)                                                                                                                   
          at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:277)                                                                                                                       
          at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:182)                                                                                                                         
          at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)                                                                                                                
          at com.google.gerrit.httpd.GetUserFilter.doFilter(GetUserFilter.java:82)                                                                                                                                   
          at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:73)                                                                                                                      
          at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:117)                                                                                                                                      
          at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:136)                                                                                                              
          at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:105)                                                                                                                
          at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:75)                                                                                                                     
          at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119)                                                                                                                
          at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)                                                                                                                                      
          at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)                                                                                                                                      
          at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)                                                                                                                                
          at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)                                                                                                                                    
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)                                                                                                                 
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)                                                                                                                              
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)                                                                                                                       
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)                                                                                                                      
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)                                                                                                                               
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)                                                                                                                        
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)                                                                                                                       
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)                                                                                                                           
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)                                                                                                                          
          at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95)                                                                                                                    
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)                                                                                                                          
          at org.eclipse.jetty.server.Server.handle(Server.java:499)                                                                                                                                                 
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)                                                                                                                                       
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)                                                                                                                             
          at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)                                                                                                                              
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)                                                                                                                        
          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)                                                                                                                         
          at java.lang.Thread.run(Thread.java:745)                                                                                                                                                                   
  Caused by: java.lang.IllegalStateException: Can only invoke this method before calling getInstance                                                                                                                 
          at org.apache.commons.validator.routines.DomainValidator.updateTLDOverride(DomainValidator.java:1680)                                                                                                      
          at com.google.gerrit.server.mail.OutgoingEmailValidator.&lt;clinit&gt;(OutgoingEmailValidator.java:24)                                                                                                           
          ... 41 more        
  [2016-09-07 20:56:54,866] [HTTP-50] ERROR com.google.gerrit.pgm.http.jetty.HiddenErrorHandler : Error in PUT /accounts/self/emails/test@email.com                                                     
  java.lang.ExceptionInInitializerError                                                                                                                                                                              
          at com.google.gerrit.server.mail.OutgoingEmail.add(OutgoingEmail.java:384)                                                                                                                                 
          at com.google.gerrit.server.mail.RegisterNewEmailSender.init(RegisterNewEmailSender.java:49)                                                                                                               
          at com.google.gerrit.server.mail.OutgoingEmail.send(OutgoingEmail.java:92)                                                                                                                                 
          at com.google.gerrit.server.account.CreateEmail.apply(CreateEmail.java:134)                                                                                                                                
          at com.google.gerrit.server.account.CreateEmail.apply(CreateEmail.java:101)                                                                                                                                
          at com.google.gerrit.server.account.CreateEmail.apply(CreateEmail.java:42)                                                                                                                                 
          at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:328)                                                                                                                         
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)                                                                                                                                            
          at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:287)                                                                                                                   
          at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:277)                                                                                                                       
          at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:182)                                                                                                                         
          at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)                                                                                                                
          at com.google.gerrit.httpd.GetUserFilter.doFilter(GetUserFilter.java:82)                                                                                                                                   
          at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:73)                                                                                                                      
          at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:117)                                                                                                                                      
          at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:136)                                                                                                              
          at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:105)                                                                                                                
          at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:75)                                                                                                                     
          at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119)                                                                                                                
          at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)                                                                                                                                      
          at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)                                                                                                                                      
          at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)                                                                                                                                
          at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)                                                                                                                                    
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)                                                                                                                 
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)                                                                                                                              
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)                                                                                                                       
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)                                                                                                                      
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)                                                                                                                               
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)                                                                                                                        
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)                                                                                                                       
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)                                                                                                                           
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)                                                                                                                          
          at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95)                                                                                                                    
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)                                                                                                                          
          at org.eclipse.jetty.server.Server.handle(Server.java:499)                                                                                                                                                 
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)                                                                                                                                       
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)                                                                                                                             
          at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)                                                                                                                              
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)                                                                                                                        
          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)                                                                                                                         
          at java.lang.Thread.run(Thread.java:745)                                                                                                                                                                   
  Caused by: java.lang.IllegalStateException: Can only invoke this method before calling getInstance                                                                                                                 
          at org.apache.commons.validator.routines.DomainValidator.updateTLDOverride(DomainValidator.java:1680)                                                                                                      
          at com.google.gerrit.server.mail.OutgoingEmailValidator.&lt;clinit&gt;(OutgoingEmailValidator.java:24)                                                                                                           
          ... 41 more  
  </code></pre>