cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hideki tihiri <hideki.tih...@gmail.com>
Subject Cocoon 2.1.11: Using org.apache.commons.mail in xsp
Date Wed, 10 Jun 2009 11:32:47 GMT
Hi,

I would like to use the org.apache.commons.mail package so I can easily send
HTML Emails.

Therefore I made an xsp with following code (snippets):
 <?xml version="1.0" encoding="UTF-8"?>
<xsp:page language="java" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:xsp="http://apache.org/xsp"
          xmlns:log="http://apache.org/xsp/log/2.0"
          xmlns:esql="http://apache.org/cocoon/SQL/v2"
          xmlns:xsp-request="http://apache.org/xsp/request/2.0"
          xmlns:xsp-session="http://apache.org/xsp/session/2.0"
          create-session="true"
          xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0"
          xmlns:util="http://apache.org/xsp/util/2.0">
<xsp:structure>
  <xsp:include>org.apache.commons.mail.*</xsp:include>
</xsp:structure>

and also:

 try {
    org.apache.commons.mail.HtmlEmail he = new HtmlEmail();
  } catch (org.apache.commons.mail.EmailException e) {
     throw new ProcessingException(e.getMessage());
  }


I added to the WEB-INF/lib the needed jars:
- activation-1.1.jar
- commons-email-1.1.jar

When the xsp is executed (via a cronjob) I get following error:

10 jun 2009 13:30:00,023 [INFO ] cron {QuartzJobExecutor.java:71} -
Executing cron job named 'send-pressrelease'
10 jun 2009 13:30:00,320 [ERROR] cron {QuartzJobExecutor.java:110} - Cron
job name 'send-pressrelease' died.
org.apache.avalon.framework.CascadingRuntimeException:
CocoonPipelineCronJob: send-pressrelease, raised an exception:
 at
org.apache.cocoon.components.cron.CocoonPipelineCronJob.execute(CocoonPipelineCronJob.java:86)
 at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at
org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143)
 at $Proxy28.execute(Unknown Source)
 at
org.apache.cocoon.components.cron.QuartzJobExecutor.execute(QuartzJobExecutor.java:103)
 at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
 at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
 at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.excalibur.source.SourceException: Cannot get input
stream for cocoon://send-pressrelease
 at
org.apache.cocoon.components.source.impl.SitemapSource.getInputStream(SitemapSource.java:253)
 at
org.apache.cocoon.components.cron.CocoonPipelineCronJob.execute(CocoonPipelineCronJob.java:70)
 ... 9 more
Caused by: org.apache.cocoon.ProcessingException: Language Exception
 at <map:serialize> -
file:///C:/Data/Apache/webapps/betrust_internet/xmlmill/sitemap.xmap:203:24
 at <map:generate type="serverpages"> -
file:///C:/Data/Apache/webapps/betrust_internet/xmlmill/sitemap.xmap:198:79
 at
org.apache.cocoon.components.source.impl.SitemapSource.init(SitemapSource.java:380)
 at
org.apache.cocoon.components.source.impl.SitemapSource.<init>(SitemapSource.java:215)
 at
org.apache.cocoon.components.source.impl.SitemapSourceFactory.getSource(SitemapSourceFactory.java:65)
 at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at
org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143)
 at $Proxy3.getSource(Unknown Source)
 at
org.apache.excalibur.source.impl.AbstractSourceResolver.resolveURI(AbstractSourceResolver.java:146)
 at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at
org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143)
 at $Proxy9.resolveURI(Unknown Source)
 at
org.apache.cocoon.components.CocoonComponentManager.resolveURI(CocoonComponentManager.java:558)
 at
org.apache.cocoon.components.CocoonComponentManager.resolveURI(CocoonComponentManager.java:541)
 at
org.apache.cocoon.components.cron.CocoonPipelineCronJob.execute(CocoonPipelineCronJob.java:68)
 ... 9 more

When I remove the code

 try {
    org.apache.commons.mail.HtmlEmail he = new HtmlEmail();
  } catch (org.apache.commons.mail.EmailException e) {
     throw new ProcessingException(e.getMessage());
  }

the xsp is correctly compiled.


Anyone any idea ?

Did I understand well that with the xmlns:sendmail I can only send regular
(text) emails ?

Regards,

H.

Mime
View raw message