You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Nicola Cisternino <nc...@cointa.it> on 2020/12/23 10:35:50 UTC
Apache Sling Commons Messaging Mail
Hi all
I'm trying to compose and send emails (Sling 12) using Apache Sling
Commons Messaging Mail Bundle.
Can someone help me define a complete setup ?
All web examples refer to the use of AEM (CQ Mail service) :-(
I've already:
1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
2) solved bundle dependencies installing:
- javax.mail-1.6.2.jar
- org.apache.sling.commons.crypto-1.0.0.jar
- org.apache.sling.commons.messaging-1.0.0.jar
4) created and saved a "Simple mail service" configuration (configMgr)
3) created a component using documentation example
(https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
I don't see any log error ... but ...
@Reference
MailService mailService;
.... is always null ....
Thanks a lot.
Nicola.
Re: Apache Sling Commons Messaging Mail
Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Monday, December 28, 2020 9:46:09 AM CET Nicola Cisternino wrote:
> Hi Dan
Hi Nicola,
> and thank you for replay ...
> ... excuse me ... but ...
> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/fea
> ture/src/main/features/site.json link is broken :-(
Please also have a look at the integration tests:
https://github.com/apache/sling-org-apache-sling-commons-messaging-mail/blob/
master/src/test/java/org/apache/sling/commons/messaging/mail/it/tests/
SimpleMailServiceIT.java#L152
Commons Messaging Mail requires a CryptoService which decrypts the SMTP
password. You could also create your own.
Regards,
O.
> Il 12/26/20 5:19 PM, Daniel Klco ha scritto:
> > Hey Nicola,
> >
> > The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
> > encrypt the password for the SMTP server. You'll need to provide the
> >
> > configuration for Commons Crypto including:
> > -
> > org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGenerato
> > rRegistrar -
> > org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGenera
> > torRegistrar -
> > org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStrin
> > gCryptoService -
> > org.apache.sling.commons.crypto.internal.FilePasswordProvider
> >
> > You can see the configuration (sans secrets) I use on my personal website
> > here:
> > https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/f
> > eature/src/main/features/site.json
> >
> > Once that's set up correctly you should see an option under the 'Available
> > crypto service' here:
> > [serverhost:port]/system/console/sling-commons-crypto-encrypt
> >
> > From there you can enter your password to encrypt it and use it in
> >
> > the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
> > configuration.
> >
> > Hope that helps!
> > -Dan
> >
> > On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino <nc...@cointa.it>
wrote:
> >> Hi all
> >>
> >> I'm trying to compose and send emails (Sling 12) using Apache Sling
> >> Commons Messaging Mail Bundle.
> >> Can someone help me define a complete setup ?
> >> All web examples refer to the use of AEM (CQ Mail service) :-(
> >> I've already:
> >> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
> >> 2) solved bundle dependencies installing:
> >> - javax.mail-1.6.2.jar
> >> - org.apache.sling.commons.crypto-1.0.0.jar
> >> - org.apache.sling.commons.messaging-1.0.0.jar
> >> 4) created and saved a "Simple mail service" configuration (configMgr)
> >> 3) created a component using documentation example
> >> (https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
> >>
> >> I don't see any log error ... but ...
> >>
> >> @Reference
> >> MailService mailService;
> >>
> >> .... is always null ....
> >>
> >> Thanks a lot.
> >> Nicola.
Re: Apache Sling Commons Messaging Mail
Posted by Nicola Cisternino <nc...@cointa.it>.
OK, the problem was solved after a global Sling reboot ... (!?)
Now I'm taking a look to some other conf error ...
Il 1/5/21 2:01 PM, Nicola Cisternino ha scritto:
> Hi Daniel ant thank you for example.
>
> Your configs are similar to mine ...
> ... but it seems to be a further (strange) problem
> Looking in the org.apache.sling.commons.crypto pom.xml I've noticed
> the *jasypt* dependency ...
> So I've installed and started the
> *org.apache.servicemix.bundles.jasypt* bundle.
>
> ... but observing the log, a NoClassDefFoundError exception occurs:
>
> 05.01.2021 10:23:29.335 *ERROR* [FelixLogListener]
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
> bundle org.apache.sling.commons.crypto:1.0.0
> (228)[org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar(1139)]
> : The activate method has thrown an exception
> (java.lang.NoClassDefFoundError: *org/jasypt/iv/RandomIvGenerator*)
> java.lang.NoClassDefFoundError: org/jasypt/iv/RandomIvGenerator
> at
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar.activate(JasyptRandomIvGeneratorRegistrar.java:60)
> [org.apache.sling.commons.crypto:1.0.0]
>
> Also accessing to web console (...system/console/bundles) it can be
> verified that the jasypt bundle correctly exports the "org.jasypt.iv"
> package and, therefore, the RandomIvGenerator class ...
>
> Nicola.
>
>
> Il 12/28/20 3:07 PM, Daniel Klco ha scritto:
>> My mistake, I forgot that I made that repo private. I've copied the
>> relevant configurations here:
>>
>> https://gist.github.com/klcodanr/41bf7c0e97a9b80b8547684ed0f72444
>>
>> On Mon, Dec 28, 2020 at 3:46 AM Nicola Cisternino <nc...@cointa.it>
>> wrote:
>>
>>> Hi Dan
>>> and thank you for replay ...
>>> ... excuse me ... but ...
>>>
>>> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
>>>
>>> link is broken :-(
>>>
>>> Il 12/26/20 5:19 PM, Daniel Klco ha scritto:
>>>> Hey Nicola,
>>>>
>>>> The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
>>>> encrypt the password for the SMTP server. You'll need to provide the
>>>> configuration for Commons Crypto including:
>>>>
>>>> -
>>>>
>>> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
>>>> -
>>>>
>>> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
>>>> -
>>>>
>>> org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
>>>> - org.apache.sling.commons.crypto.internal.FilePasswordProvider
>>>>
>>>> You can see the configuration (sans secrets) I use on my personal
>>>> website
>>>> here:
>>>>
>>> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
>>>
>>>> Once that's set up correctly you should see an option under the
>>> 'Available
>>>> crypto service' here:
>>>> [serverhost:port]/system/console/sling-commons-crypto-encrypt
>>>>
>>>> From there you can enter your password to encrypt it and use it in
>>>> the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
>>>> configuration.
>>>>
>>>> Hope that helps!
>>>> -Dan
>>>>
>>>> On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino <nc...@cointa.it>
>>> wrote:
>>>>> Hi all
>>>>>
>>>>> I'm trying to compose and send emails (Sling 12) using Apache Sling
>>>>> Commons Messaging Mail Bundle.
>>>>> Can someone help me define a complete setup ?
>>>>> All web examples refer to the use of AEM (CQ Mail service) :-(
>>>>> I've already:
>>>>> 1) installed bundle
>>>>> (org.apache.sling.commons.messaging.mail-1.0.0.jar)
>>>>> 2) solved bundle dependencies installing:
>>>>> - javax.mail-1.6.2.jar
>>>>> - org.apache.sling.commons.crypto-1.0.0.jar
>>>>> - org.apache.sling.commons.messaging-1.0.0.jar
>>>>> 4) created and saved a "Simple mail service" configuration
>>>>> (configMgr)
>>>>> 3) created a component using documentation example
>>>>> (
>>> https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
>>>
>>>>> I don't see any log error ... but ...
>>>>>
>>>>> @Reference
>>>>> MailService mailService;
>>>>>
>>>>> .... is always null ....
>>>>>
>>>>> Thanks a lot.
>>>>> Nicola.
>>>>>
>>>
>>> --
>>> Nicola Cisternino
>>> CTO - Ergon Project Manager - IT Architect
>>> Cointa s.r.l.
>>> Tel. +39 080 9371015
>>> ncister@cointa.it
>>> http://www.cointa.it
>>>
>
Re: Apache Sling Commons Messaging Mail
Posted by Nicola Cisternino <nc...@cointa.it>.
Hi Daniel ant thank you for example.
Your configs are similar to mine ...
... but it seems to be a further (strange) problem
Looking in the org.apache.sling.commons.crypto pom.xml I've noticed the
*jasypt* dependency ...
So I've installed and started the *org.apache.servicemix.bundles.jasypt*
bundle.
... but observing the log, a NoClassDefFoundError exception occurs:
05.01.2021 10:23:29.335 *ERROR* [FelixLogListener]
org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
bundle org.apache.sling.commons.crypto:1.0.0
(228)[org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar(1139)]
: The activate method has thrown an exception
(java.lang.NoClassDefFoundError: *org/jasypt/iv/RandomIvGenerator*)
java.lang.NoClassDefFoundError: org/jasypt/iv/RandomIvGenerator
at
org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar.activate(JasyptRandomIvGeneratorRegistrar.java:60)
[org.apache.sling.commons.crypto:1.0.0]
Also accessing to web console (...system/console/bundles) it can be
verified that the jasypt bundle correctly exports the "org.jasypt.iv"
package and, therefore, the RandomIvGenerator class ...
Nicola.
Il 12/28/20 3:07 PM, Daniel Klco ha scritto:
> My mistake, I forgot that I made that repo private. I've copied the
> relevant configurations here:
>
> https://gist.github.com/klcodanr/41bf7c0e97a9b80b8547684ed0f72444
>
> On Mon, Dec 28, 2020 at 3:46 AM Nicola Cisternino <nc...@cointa.it> wrote:
>
>> Hi Dan
>> and thank you for replay ...
>> ... excuse me ... but ...
>>
>> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
>> link is broken :-(
>>
>> Il 12/26/20 5:19 PM, Daniel Klco ha scritto:
>>> Hey Nicola,
>>>
>>> The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
>>> encrypt the password for the SMTP server. You'll need to provide the
>>> configuration for Commons Crypto including:
>>>
>>> -
>>>
>> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
>>> -
>>>
>> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
>>> -
>>>
>> org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
>>> - org.apache.sling.commons.crypto.internal.FilePasswordProvider
>>>
>>> You can see the configuration (sans secrets) I use on my personal website
>>> here:
>>>
>> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
>>> Once that's set up correctly you should see an option under the
>> 'Available
>>> crypto service' here:
>>> [serverhost:port]/system/console/sling-commons-crypto-encrypt
>>>
>>> From there you can enter your password to encrypt it and use it in
>>> the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
>>> configuration.
>>>
>>> Hope that helps!
>>> -Dan
>>>
>>> On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino <nc...@cointa.it>
>> wrote:
>>>> Hi all
>>>>
>>>> I'm trying to compose and send emails (Sling 12) using Apache Sling
>>>> Commons Messaging Mail Bundle.
>>>> Can someone help me define a complete setup ?
>>>> All web examples refer to the use of AEM (CQ Mail service) :-(
>>>> I've already:
>>>> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
>>>> 2) solved bundle dependencies installing:
>>>> - javax.mail-1.6.2.jar
>>>> - org.apache.sling.commons.crypto-1.0.0.jar
>>>> - org.apache.sling.commons.messaging-1.0.0.jar
>>>> 4) created and saved a "Simple mail service" configuration (configMgr)
>>>> 3) created a component using documentation example
>>>> (
>> https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
>>>> I don't see any log error ... but ...
>>>>
>>>> @Reference
>>>> MailService mailService;
>>>>
>>>> .... is always null ....
>>>>
>>>> Thanks a lot.
>>>> Nicola.
>>>>
>>
>> --
>> Nicola Cisternino
>> CTO - Ergon Project Manager - IT Architect
>> Cointa s.r.l.
>> Tel. +39 080 9371015
>> ncister@cointa.it
>> http://www.cointa.it
>>
Re: Apache Sling Commons Messaging Mail
Posted by Daniel Klco <dk...@apache.org>.
My mistake, I forgot that I made that repo private. I've copied the
relevant configurations here:
https://gist.github.com/klcodanr/41bf7c0e97a9b80b8547684ed0f72444
On Mon, Dec 28, 2020 at 3:46 AM Nicola Cisternino <nc...@cointa.it> wrote:
> Hi Dan
> and thank you for replay ...
> ... excuse me ... but ...
>
> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
> link is broken :-(
>
> Il 12/26/20 5:19 PM, Daniel Klco ha scritto:
> > Hey Nicola,
> >
> > The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
> > encrypt the password for the SMTP server. You'll need to provide the
> > configuration for Commons Crypto including:
> >
> > -
> >
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
> > -
> >
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
> > -
> >
> org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
> > - org.apache.sling.commons.crypto.internal.FilePasswordProvider
> >
> > You can see the configuration (sans secrets) I use on my personal website
> > here:
> >
> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
> >
> > Once that's set up correctly you should see an option under the
> 'Available
> > crypto service' here:
> > [serverhost:port]/system/console/sling-commons-crypto-encrypt
> >
> > From there you can enter your password to encrypt it and use it in
> > the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
> > configuration.
> >
> > Hope that helps!
> > -Dan
> >
> > On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino <nc...@cointa.it>
> wrote:
> >
> >> Hi all
> >>
> >> I'm trying to compose and send emails (Sling 12) using Apache Sling
> >> Commons Messaging Mail Bundle.
> >> Can someone help me define a complete setup ?
> >> All web examples refer to the use of AEM (CQ Mail service) :-(
> >> I've already:
> >> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
> >> 2) solved bundle dependencies installing:
> >> - javax.mail-1.6.2.jar
> >> - org.apache.sling.commons.crypto-1.0.0.jar
> >> - org.apache.sling.commons.messaging-1.0.0.jar
> >> 4) created and saved a "Simple mail service" configuration (configMgr)
> >> 3) created a component using documentation example
> >> (
> https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
> >>
> >> I don't see any log error ... but ...
> >>
> >> @Reference
> >> MailService mailService;
> >>
> >> .... is always null ....
> >>
> >> Thanks a lot.
> >> Nicola.
> >>
>
>
> --
> Nicola Cisternino
> CTO - Ergon Project Manager - IT Architect
> Cointa s.r.l.
> Tel. +39 080 9371015
> ncister@cointa.it
> http://www.cointa.it
>
Re: Apache Sling Commons Messaging Mail
Posted by Nicola Cisternino <nc...@cointa.it>.
Hi Dan
and thank you for replay ...
... excuse me ... but ...
https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
link is broken :-(
Il 12/26/20 5:19 PM, Daniel Klco ha scritto:
> Hey Nicola,
>
> The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
> encrypt the password for the SMTP server. You'll need to provide the
> configuration for Commons Crypto including:
>
> -
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
> -
> org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
> -
> org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
> - org.apache.sling.commons.crypto.internal.FilePasswordProvider
>
> You can see the configuration (sans secrets) I use on my personal website
> here:
> https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
>
> Once that's set up correctly you should see an option under the 'Available
> crypto service' here:
> [serverhost:port]/system/console/sling-commons-crypto-encrypt
>
> From there you can enter your password to encrypt it and use it in
> the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
> configuration.
>
> Hope that helps!
> -Dan
>
> On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino <nc...@cointa.it> wrote:
>
>> Hi all
>>
>> I'm trying to compose and send emails (Sling 12) using Apache Sling
>> Commons Messaging Mail Bundle.
>> Can someone help me define a complete setup ?
>> All web examples refer to the use of AEM (CQ Mail service) :-(
>> I've already:
>> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
>> 2) solved bundle dependencies installing:
>> - javax.mail-1.6.2.jar
>> - org.apache.sling.commons.crypto-1.0.0.jar
>> - org.apache.sling.commons.messaging-1.0.0.jar
>> 4) created and saved a "Simple mail service" configuration (configMgr)
>> 3) created a component using documentation example
>> (https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
>>
>> I don't see any log error ... but ...
>>
>> @Reference
>> MailService mailService;
>>
>> .... is always null ....
>>
>> Thanks a lot.
>> Nicola.
>>
--
Nicola Cisternino
CTO - Ergon Project Manager - IT Architect
Cointa s.r.l.
Tel. +39 080 9371015
ncister@cointa.it
http://www.cointa.it
Re: Apache Sling Commons Messaging Mail
Posted by Daniel Klco <dk...@apache.org>.
Hey Nicola,
The Apache Sling Commons Messaging Mail bundle uses Commons Crypto to
encrypt the password for the SMTP server. You'll need to provide the
configuration for Commons Crypto including:
-
org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomIvGeneratorRegistrar
-
org.apache.sling.commons.crypto.jasypt.internal.JasyptRandomSaltGeneratorRegistrar
-
org.apache.sling.commons.crypto.jasypt.internal.JasyptStandardPBEStringCryptoService
- org.apache.sling.commons.crypto.internal.FilePasswordProvider
You can see the configuration (sans secrets) I use on my personal website
here:
https://github.com/klcodanr/danklco.com-site-cna/blob/cloud-native-sling/feature/src/main/features/site.json
Once that's set up correctly you should see an option under the 'Available
crypto service' here:
[serverhost:port]/system/console/sling-commons-crypto-encrypt
From there you can enter your password to encrypt it and use it in
the org.apache.sling.commons.messaging.mail.internal.SimpleMailService
configuration.
Hope that helps!
-Dan
On Wed, Dec 23, 2020 at 5:36 AM Nicola Cisternino <nc...@cointa.it> wrote:
> Hi all
>
> I'm trying to compose and send emails (Sling 12) using Apache Sling
> Commons Messaging Mail Bundle.
> Can someone help me define a complete setup ?
> All web examples refer to the use of AEM (CQ Mail service) :-(
> I've already:
> 1) installed bundle (org.apache.sling.commons.messaging.mail-1.0.0.jar)
> 2) solved bundle dependencies installing:
> - javax.mail-1.6.2.jar
> - org.apache.sling.commons.crypto-1.0.0.jar
> - org.apache.sling.commons.messaging-1.0.0.jar
> 4) created and saved a "Simple mail service" configuration (configMgr)
> 3) created a component using documentation example
> (https://github.com/apache/sling-org-apache-sling-commons-messaging-mail)
>
> I don't see any log error ... but ...
>
> @Reference
> MailService mailService;
>
> .... is always null ....
>
> Thanks a lot.
> Nicola.
>