AnsweredAssumed Answered

java.io.UnsupportedEncodingException with sending mail

Question asked by johan1974 on Apr 18, 2008
Latest reply on Sep 4, 2008 by vibhutewary
When i send an invitation to a user i get a java error "java.io.UnsupportedEncodingException"

Here is the complete log

11:39:26,734 INFO  [org.alfresco.mbeans.VirtServerRegistry] Creating VirtServerRegistry MBean
11:39:27,750 WARN  [org.springframework.remoting.rmi.RmiRegistryFactoryBean] Could not detect RMI registry - creating new one
11:39:27,875 INFO  [org.alfresco.mbeans.VirtServerRegistry] Created JMX serverConnector
11:39:32,015 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] Schema managed by database dialect org.hibernate.dialect.HSQLDialect.
11:39:32,031 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] Alfresco is using the HSQL default database. Please only use this while evaluating Alfresco, it is NOT recommended for production or deployment!
11:39:32,484 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] No changes were made to the schema.
11:39:35,015 WARN  [org.alfresco.repo.admin.ConfigurationChecker] The Alfresco 'dir.root' property is set to a relative path './alf_data'.  'dir.root' should be overridden to point to a specific folder.
11:39:35,015 INFO  [org.alfresco.repo.admin.ConfigurationChecker] The Alfresco root data directory ('dir.root') is: .\alf_data
11:39:35,062 INFO  [org.alfresco.repo.admin.patch.PatchExecuter] Checking for patches to apply …
11:39:35,312 INFO  [org.alfresco.repo.module.ModuleServiceImpl] Found 0 module(s).
11:39:36,609 WARN  [org.alfresco.util.OpenOfficeConnectionTester] An initial OpenOffice connection could not be established.
11:39:36,609 INFO  [org.alfresco.service.descriptor.DescriptorService] Alfresco JVM - v1.6.0_06-b02; maximum heap size 506,313MB
11:39:36,750 INFO  [org.alfresco.service.descriptor.DescriptorService] Alfresco license: Enterprise Network granted to Trial User limited to 30 days expiring Sun May 18 00:00:00 CEST 2008 (30 days remaining)
11:39:36,750 INFO  [org.alfresco.service.descriptor.DescriptorService] Alfresco started (Enterprise Network): Current version 2.2.0 (159) schema 89 - Installed version 2.2.0 (159) schema 89
11:41:20,890 ERROR [org.alfresco.web.bean.TemplateMailHelperBean] Failed to send email to <mymailadres>
org.springframework.mail.MailSendException; nested exception details (1) are:
Failed message 1:
javax.mail.MessagingException: IOException while sending message;
  nested exception is:
   java.io.UnsupportedEncodingException: ${mail.encoding}
   at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:566)
   at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:391)
   at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:335)
   at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:350)
   at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:339)
   at org.alfresco.web.bean.TemplateMailHelperBean.notifyUser(TemplateMailHelperBean.java:178)
   at org.alfresco.web.bean.wizard.InviteUsersWizard.finishImpl(InviteUsersWizard.java:264)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:122)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:119)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:241)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:171)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:128)
   at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:540)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
   at java.lang.Thread.run(Thread.java:619)


In the repository.properties i have the following:

# Email configuration
mail.host = smtp.gmail.com
mail.port = 465
mail.transport.protocol = smtp
mail.username = username
mail.password= password
mail.smtp.auth = true
mail.smtp.socketFactory.port = 465
mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback = false
mail.smtp.timeout = 25000
mail.smtp.starttls.enable = true


And in the core-services-context

<!–                      –>
   <!– MAIL SERVICE –>
   <!–                       –>

   
<bean id="mailService" class="org.springframework.mail.javamail.JavaMailSenderImpl">
  <property name="host">
    <value>${mail.host}</value>
  </property>
  <property name="port">
    <value>${mail.port}</value>
  </property>                                         
  <property name="protocol">                           
    <value>${mail.transport.protocol}</value>
  </property>
  <property name="username">
    <value>${mail.username}</value>
  </property>
  <property name="password">
    <value>${mail.password}</value>
  </property>
  <property name="defaultEncoding">
    <value>${mail.encoding}</value>
  </property>

  <property name="javaMailProperties">
    <props>
      <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
      <prop key="mail.smtp.socketFactory.port">${mail.smtp.socketFactory.port}</prop>
      <prop key="mail.smtp.socketFactory.class">${mail.smtp.socketFactory.class}</prop>
      <prop key="mail.smtp.socketFactory.fallback">${mail.smtp.socketFactory.fallback}</prop>
      <prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop>
    </props>
  </property>
</bean>

What can be the problem?

Thnx!

Outcomes