cancel
Showing results for 
Search instead for 
Did you mean: 

java.io.UnsupportedEncodingException with sending mail

johan1974
Champ in-the-making
Champ in-the-making
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!
2 REPLIES 2

steve
Champ in-the-making
Champ in-the-making
Hi,

What mail encoding are you using - I didn't see that in your list of config values?

E.g.
# Set this value to UTF-8 or similar for encoding of email messages as required
mail.encoding=UTF-8

Steve

vibhutewary
Champ in-the-making
Champ in-the-making
Hi, I have the same problem, that is i can't send out e-mails on invite.

I have two installations of Alfresco 2.1. Both have identical settings (with no firewall).

However, server we are using refuses to send out invite emails.

The error log is as below for:

catalina.out

CompilerOracle: exclude org/apache/lucene/index/IndexReader$1.doBody
CompilerOracle: exclude org/alfresco/repo/search/impl/lucene/index/IndexInfo$Merger.mergeIndexes
CompilerOracle: exclude org/alfresco/repo/search/impl/lucene/index/IndexInfo$Merger.mergeDeletions
Sep 4, 2008 4:44:23 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 4, 2008 4:44:23 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1182 ms
Sep 4, 2008 4:44:23 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 4, 2008 4:44:23 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
Sep 4, 2008 4:44:23 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 4, 2008 4:44:24 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive alfresco.war
16:44:50,983 WARN  [remoting.rmi.RmiRegistryFactoryBean] Could not detect RMI registry - creating new one
16:44:53,443 WARN  [alfresco.util.OpenOfficeConnectionTester] A connection to OpenOffice could not be established.
16:44:57,706 INFO  [domain.schema.SchemaBootstrap] Schema managed by database dialect org.hibernate.dialect.MySQLInnoDBDialect.
16:44:59,873 INFO  [domain.schema.SchemaBootstrap] No changes were made to the schema.
16:45:02,169 INFO  [repo.admin.ConfigurationChecker] The Alfresco root data directory ('dir.root') is: /opt/alfresco/alf_data
16:45:02,432 INFO  [admin.patch.PatchExecuter] Checking for patches to apply …
16:45:02,589 INFO  [repo.module.ModuleServiceImpl] Found 0 module(s).
16:45:02,785 ERROR [alfresco.smb.protocol] Failed to get local domain/workgroup name, using default of WORKGROUP
16:45:02,786 ERROR [alfresco.smb.protocol] (This may be due to firewall settings or incorrect <broadcast> setting)
16:45:02,873 INFO  [service.descriptor.DescriptorService] Alfresco JVM - v1.6.0_04-b12; maximum heap size 506.313MB
16:45:02,874 INFO  [service.descriptor.DescriptorService] Alfresco started (Community Network): Current version 2.1.0 (484) schema 64 - Installed version 2.1.0 (484) schema 64
Sep 4, 2008 4:45:08 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 4, 2008 4:45:08 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 4, 2008 4:45:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 44908 ms
16:45:43,296 ERROR [web.bean.TemplateMailHelperBean] Failed to send email to vibhu@triumphindia.com
org.springframework.mail.MailSendException; nested exceptions (0) are:
Caused by:
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
  nested exception is:
   java.net.ConnectException: Connection refused
   at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1213)
   at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:311)
   at javax.mail.Service.connect(Service.java:233)
   at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:382)
   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:149)
   at org.alfresco.web.bean.wizard.InviteUsersWizard.finishImpl(InviteUsersWizard.java:221)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:118)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:115)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:225)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:155)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:124)
   at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:520)
   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)

I have tried changing the custom-repository.properties in /<alf_dir>/tomcat/shared/classes/alfresco/extension with the lines below but it does not help, the email is not sent and the page does not re-direct upon clicking "Finish" in the invite procedure.

mail.host=smtp.bizmail.yahoo.com
mail.port=25
mail.username=xxxx@xxx.com
mail.password=xxx


My "custom-repository.properties" without the above reads:

###############################

## Common Alfresco Properties #

###############################



#

# Sample custom content and index data location

#

dir.root=/opt/alfresco/alf_data

#dir.indexes=



#

# Sample database connection properties

#

#db.username=alfresco

#db.password=alfresco

#db.pool.initial=10

#db.pool.max=100



#

# Property to control whether schema updates are performed automatically.

# Updates must be enabled during upgrades as, apart from the static upgrade scripts,

# there are also auto-generated update scripts that will need to be executed.  After

# upgrading to a new version, this can be disabled.

#

#db.schema.update=true



#

# HSQL connection

#

# db.driver=org.hsqldb.jdbcDriver

# db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;



#

# MySQL connection (This is default and requires mysql-connector-java-5.0.3-bin.jar, which ships with the Alfresco server)

#

db.driver=org.gjt.mm.mysql.Driver

db.url=jdbc:mysql://localhost/alfresco



#

# Oracle connection (requires ojdbc14_g.jar or equivalent jar in shared libraries location)

#

#db.driver=oracle.jdbc.OracleDriver

#db.url=jdbc:oracle:thin:@localhost:1521:alfresco



#

# Sybase connection (requires jconn2d.jar or equivalent jar in shared libraries location)

#

#db.driver=com.sybase.jdbc2.jdbc.SybDriver

#db.url=jdbc:sybase:Tds:localhost:2638/alfresco



#

# SQLServer connection (requires jdts-1.2.jar or equivalent - http://jtds.sourceforge.net/)

#

#db.driver=net.sourceforge.jtds.jdbc.Driver

#db.url=jdbc:jtds:sqlserver://localhost/alfresco



#

# SQLServer connection using Microsoft JDDB driver

#

#db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver

#db.url=jdbc:sqlserver://localhost;DatabaseName=alfresco



#

# PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)

#

#db.driver=org.postgresql.Driver

#db.url=jdbc:postgresql://localhost:5432/alfresco



My "repository.properties" in the /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco
folder in tomcat reads as below:

# Directory configuration



dir.root=/opt/alfresco/alf_data



dir.contentstore=${dir.root}/contentstore

dir.contentstore.deleted=${dir.root}/contentstore.deleted



dir.auditcontentstore=${dir.root}/audit.contentstore



# The location for lucene index files

dir.indexes=${dir.root}/lucene-indexes



# The location for lucene index locks

dir.indexes.lock=${dir.indexes}/locks



# The index recovery mode (NONE, VALIDATE, AUTO, FULL)

index.recovery.mode=VALIDATE



# Change the failure behaviour of the configuration checker

system.bootstrap.config_check.strict=true



#

# Properties to limit resources spent on individual searches

#

# The maximum time spent pruning results

system.acl.maxPermissionCheckTimeMillis=10000

# The maximum number of results to perform permission checks against

system.acl.maxPermissionChecks=1000



# #################### #

# Lucene configuration #

# #################### #

#

# Millisecond threshold for text transformations

# Slower transformers will force the text extraction to be asynchronous

#

lucene.maxAtomicTransformationTime=20

#

# The maximum number of clauses that are allowed in a lucene query

#

lucene.query.maxClauses=10000

#

# The size of the queue of nodes waiting for index

# Events are generated as nodes are changed, this is the maximum size of the queue used to coalesce event

# When this size is reached the lists of nodes will be indexed

#

# http://issues.alfresco.com/browse/AR-1280:  Setting this high is the workaround as of 1.4.3.

#

lucene.indexer.batchSize=1000000

#

# Lucene index min merge docs - the in memory size of the index

#

lucene.indexer.minMergeDocs=1000

#

# When lucene index files are merged together - it will try to keep this number of segments/files in 

#

lucene.indexer.mergeFactor=10

#

# Roughly the maximum number of nodes indexed in one file/segment

#

lucene.indexer.maxMergeDocs=100000

#

# The number of terms from a document that will be indexed

#

lucene.indexer.maxFieldLength=10000



lucene.write.lock.timeout=10000

lucene.commit.lock.timeout=100000

lucene.lock.poll.interval=100



# Database configuration

db.schema.update=true

db.driver=org.gjt.mm.mysql.Driver

db.name=alfresco

db.url=jdbc:mysql:///${db.name}

db.username=alfresco

db.password=alfresco

db.pool.initial=10

db.pool.max=20



# Email configuration


mail.host=

mail.port=25

mail.username=anonymous

mail.password=

# Set this value to UTF-8 or similar for encoding of email messages as required

#mail.encoding=UTF-8

# Set this value to 7bit or similar for Asian encoding of email headers as required

mail.header=

mail.from.default=alfresco@alfresco.org



# System Configuration

system.store=system://system

system.descriptor.childname=sys:descriptor

system.descriptor.current.childname=sys:descriptor-current



# User config

alfresco_user_store.store=user://alfrescoUserStore

alfresco_user_store.system_container.childname=sys:system

alfresco_user_store.user_container.childname=sys:people

alfresco_user_store.authorities_container.childname=sys:authorities



# Spaces Archive Configuration

spaces.archive.store=archive://SpacesStore



# Spaces Configuration

spaces.store=workspace://SpacesStore

spaces.company_home.childname=app:company_home

spaces.guest_home.childname=app:guest_home

spaces.dictionary.childname=app:dictionary

spaces.templates.childname=app:space_templates

spaces.templates.content.childname=app:content_templates

spaces.templates.email.childname=app:email_templates

spaces.templates.rss.childname=app:rss_templates

spaces.savedsearches.childname=app:saved_searches

spaces.scripts.childname=app:scripts

spaces.wcm.childname=app:wcm

spaces.content_forms.childname=app:wcm_forms

spaces.user_homes.childname=app:user_homes



# Folders for storing people

system.system_container.childname=sys:system

system.people_container.childname=sys:people



# Folders for storing workflow related info

system.workflow_container.childname=sys:workflow



# Are user names case sensitive?

# ==============================

#

# NOTE: If you are using mysql you must have case sensitive collation

#

# You can do this when creating the alfresco database at the start

# CREATE DATABASE alfresco CHARACTER SET utf8 COLLATION utf8_bin;

# If you want to do this later this is a dump and load fix as it is done when the database, tables and columns are created.

#

# Must other databases are case sensitive by default.

#

user.name.caseSensitive=false



# AVM Specific properties.

avm.remote.idlestream.timeout=30000


Please help.

Regards,
Vibhu.