You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kaj Kandler <Ka...@Conficio.com> on 2006/06/27 03:52:04 UTC
loading a "configured" component in flow-script
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there,
I'm stuck and look for the magic touch of a master here.
I try to access a component in flow-script like
- ---
var mailSender = cocoon.getComponent("org.apache.cocoon.mail.MailSender");
// mailSender.initialize();
try {
mailSender.setFrom(form.getChild("email").getValue());
mailSender.setTo(recepientAddress);
mailSender.setSubject("Plan-B4OOo: question from
"+form.getChild("name").getValue());
mailSender.setBody(form.getChild("question").getValue());
mailSender.send();
} finally {
cocoon.releaseComponent(mailSender);
}
- ---
I would expect the component to be configured with the values defined in
cocoon.xconf
- ---
<component class="org.apache.cocoon.mail.MailMessageSender"
logger="core.mail.MailSender" role="org.apache.cocoon.mail.MailSender">
<!--+
| SMTP host name, user name, and password.
<smtp-host>svn</smtp-host>
<smtp-user>myUser</smtp-user>
<smtp-password>secretPasswd</smtp-password>
+-->
</component>
- ---
However, my connection does fail with
- ---
...
Caused by: javax.mail.MessagingException: Could not connect to SMTP
host: 127.0.0.1, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at
org.apache.cocoon.mail.MailMessageSender.doSend(MailMessageSender.java:446)
at
org.apache.cocoon.mail.MailMessageSender.send(MailMessageSender.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
- ---
Any idea what goes wrong?
Do I have the wrong expectation to get the Component pre-configured? If
this is not the case, how would I go about configuring it?
Thanks
Kaj
- --
KajKandler@Conficio.com
http://conficio.blogspot.com/
================================================
| We teach software one screencast at a time |
================================================
http://www.conficio.com/
Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
Conficio
P.O.Box 761062, Melrose,
MA 02176
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
iD8DBQFEoI9ERDUvrJRNjTARApKRAJ9hVRzAnTposcf8IARqDuYZH5PeJQCeK4Hc
695hi71zO73Lka9RY4Or+Tw=
=Quu5
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: loading a "configured" component in flow-script
Posted by Kaj Kandler <Ka...@Conficio.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Oops,
that is it. How embarrassing! Gee, I should take more breaks to relax
the eyes.
Thanks a lot Jason!
K<o>
Jason Johnston wrote:
> Kaj Kandler wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi there,
>> I'm stuck and look for the magic touch of a master here.
>>
>> I try to access a component in flow-script like
>> - ---
>> var mailSender =
>> cocoon.getComponent("org.apache.cocoon.mail.MailSender");
>> // mailSender.initialize();
>> try {
>> mailSender.setFrom(form.getChild("email").getValue());
>> mailSender.setTo(recepientAddress);
>> mailSender.setSubject("Plan-B4OOo: question from
>> "+form.getChild("name").getValue());
>> mailSender.setBody(form.getChild("question").getValue());
>> mailSender.send();
>> } finally {
>> cocoon.releaseComponent(mailSender);
>> }
>> - ---
>> I would expect the component to be configured with the values defined in
>> cocoon.xconf
>> - ---
>> <component class="org.apache.cocoon.mail.MailMessageSender"
>> logger="core.mail.MailSender" role="org.apache.cocoon.mail.MailSender">
>> <!--+
>> | SMTP host name, user name, and password.
>> <smtp-host>svn</smtp-host>
>> <smtp-user>myUser</smtp-user>
>> <smtp-password>secretPasswd</smtp-password>
>> +-->
>> </component>
>
> The configuration is commented out... or is that just a copy-paste
> error? :-)
>
> It should work as you describe, as I'm doing the exact same thing
> successfully.
>
> --Jason
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
- --
KajKandler@Conficio.com
http://conficio.blogspot.com/
================================================
| We teach software one screencast at a time |
================================================
http://www.conficio.com/
Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
Conficio
P.O.Box 761062, Melrose,
MA 02176
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
iD8DBQFEoS97RDUvrJRNjTARAiMeAJ9I3B0BYgP0EGOjxVN/1HNs44X8lwCfSZla
kCHtz7/iuVl6oApmSiJYIKE=
=B90/
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: loading a "configured" component in flow-script
Posted by Jason Johnston <co...@lojjic.net>.
Kaj Kandler wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi there,
> I'm stuck and look for the magic touch of a master here.
>
> I try to access a component in flow-script like
> - ---
> var mailSender = cocoon.getComponent("org.apache.cocoon.mail.MailSender");
> // mailSender.initialize();
> try {
> mailSender.setFrom(form.getChild("email").getValue());
> mailSender.setTo(recepientAddress);
> mailSender.setSubject("Plan-B4OOo: question from
> "+form.getChild("name").getValue());
> mailSender.setBody(form.getChild("question").getValue());
> mailSender.send();
> } finally {
> cocoon.releaseComponent(mailSender);
> }
> - ---
> I would expect the component to be configured with the values defined in
> cocoon.xconf
> - ---
> <component class="org.apache.cocoon.mail.MailMessageSender"
> logger="core.mail.MailSender" role="org.apache.cocoon.mail.MailSender">
> <!--+
> | SMTP host name, user name, and password.
> <smtp-host>svn</smtp-host>
> <smtp-user>myUser</smtp-user>
> <smtp-password>secretPasswd</smtp-password>
> +-->
> </component>
The configuration is commented out... or is that just a copy-paste
error? :-)
It should work as you describe, as I'm doing the exact same thing
successfully.
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org