You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Rene Perschon <Ch...@gmx.net> on 2014/02/17 13:44:22 UTC

TomEE auto-links email resources incorrectly

Hi!

I have 2 mail resources in tomee.xml:

<Resource id="mail/mail1" type="javax.mail.Session">
    mail.host=host1
    mail.transport.protocol=smtps
    mail.smtps.auth=true
    mail.smtps.port=465
    mail.smtps.ssl.trust=host1
    mail.smtps.from=mail@host1
    mail.smtps.user=mail@host1
    password=pw
</Resource>

<Resource id="mail/mail2" type="javax.mail.Session">
    mail.host=host2
    mail.transport.protocol=smtps
    mail.smtps.auth=true
    mail.smtps.port=465
    mail.smtps.ssl.trust=host2
    mail.smtps.from=mail@host2
    mail.smtps.user=mail@host2
    password=pw
</Resource>

i reference them in the application's context.xml:

<Context>
  <resource-ref>
    <res-ref-name>mail/mail1</res-ref-name>
    <res-type>javax.mail.Session</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
  <resource-ref>
    <res-ref-name>mail/mail2</res-ref-name>
    <res-type>javax.mail.Session</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
</Context>

But when the application is deployed, the auto-linking just goes to the mail1 resource and the mail2 resource is not used at all:

Feb 17, 2014 1:24:07 PM org.apache.openejb.config.AutoConfig processResourceRef
Information: Auto-linking resource-ref 'java:app/mail/mail2' in bean MyBean to Resource(id=mail/mail1)


Can anybody tell me what's wrong here?

Thanks!
René

Re: TomEE auto-links email resources incorrectly

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

not sure these resources are correctly handled in context.xml, maybe
try web.xml or share a project reproducing the issue.
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-02-17 13:44 GMT+01:00 Rene Perschon <Ch...@gmx.net>:
> Hi!
>
> I have 2 mail resources in tomee.xml:
>
> <Resource id="mail/mail1" type="javax.mail.Session">
>     mail.host=host1
>     mail.transport.protocol=smtps
>     mail.smtps.auth=true
>     mail.smtps.port=465
>     mail.smtps.ssl.trust=host1
>     mail.smtps.from=mail@host1
>     mail.smtps.user=mail@host1
>     password=pw
> </Resource>
>
> <Resource id="mail/mail2" type="javax.mail.Session">
>     mail.host=host2
>     mail.transport.protocol=smtps
>     mail.smtps.auth=true
>     mail.smtps.port=465
>     mail.smtps.ssl.trust=host2
>     mail.smtps.from=mail@host2
>     mail.smtps.user=mail@host2
>     password=pw
> </Resource>
>
> i reference them in the application's context.xml:
>
> <Context>
>   <resource-ref>
>     <res-ref-name>mail/mail1</res-ref-name>
>     <res-type>javax.mail.Session</res-type>
>     <res-auth>Container</res-auth>
>   </resource-ref>
>   <resource-ref>
>     <res-ref-name>mail/mail2</res-ref-name>
>     <res-type>javax.mail.Session</res-type>
>     <res-auth>Container</res-auth>
>   </resource-ref>
> </Context>
>
> But when the application is deployed, the auto-linking just goes to the mail1 resource and the mail2 resource is not used at all:
>
> Feb 17, 2014 1:24:07 PM org.apache.openejb.config.AutoConfig processResourceRef
> Information: Auto-linking resource-ref 'java:app/mail/mail2' in bean MyBean to Resource(id=mail/mail1)
>
>
> Can anybody tell me what's wrong here?
>
> Thanks!
> René