You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by luca-vercelli <lu...@alkeinformatica.com> on 2016/10/18 08:58:36 UTC

Migrating mail-service from JBoss to TomEE

Hello,
I am migrating an application from JBoss to TomEE.
It uses a feature of JBoss that allows sending mails easily.
In JBoss, there is a configuration file:

<jbossfolder>/server/default/deploy/mail-service.xml

that contains all SMTP parameters. At startup, JBoss creates a
ConnectionFactory based on these parameters, and publishes it via JNDI.
At runtime, this ConnectionFactory is retrieved via JNDI:

ConnectionFactory connectionFactory = (ConnectionFactory)
ctx.lookup("QueueConnectionFactory");

Is there anything similar in TomEE?
Thank you.




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Migrating-mail-service-from-JBoss-to-TomEE-tp4680367.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Migrating mail-service from JBoss to TomEE

Posted by luca-vercelli <lu...@alkeinformatica.com>.
Thank you very much.

You are right, this app contains two different layers: a jms queue and a
mail Session. There is a message-driven bean that, whenever receives a
message, can send emails.

So, I still have to properly configure a new queue. I'll search for it. 




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Migrating-mail-service-from-JBoss-to-TomEE-tp4680367p4680369.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Migrating mail-service from JBoss to TomEE

Posted by Gurkan Erdogdu <ge...@managecat.com>.
Hi

For email configuration:

Open conf/tomee.xml

<Resource id=“mail/mymail" type="javax.mail.Session">
mail.transport.protocol=smtp 
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory 
mail.smtp.socketFactory.fallback=false 
mail.smtp.host=mail host 
mail.smtp.port=mail port 
mail.smtp.auth=true 
mail.smtp.user=usernanme
password=password
</Resource>
Inject it using

 @Resource(name = “mail/mymail")
 private Session mailSession;
See http://tomee.apache.org/configuring-javamail.html <http://tomee.apache.org/configuring-javamail.html> more information
As in your email, ConnectionFactory and QueueConnectionFactory are used for sending JMS messages not emails.


Gurkan-
http://twitter.com/gerdogdu <http://twitter.com/gerdogdu>
http://managecat.com <http://managecat.com/>

> On 18 Oct 2016, at 11:58, luca-vercelli <lu...@alkeinformatica.com> wrote:
> 
> Hello,
> I am migrating an application from JBoss to TomEE.
> It uses a feature of JBoss that allows sending mails easily.
> In JBoss, there is a configuration file:
> 
> <jbossfolder>/server/default/deploy/mail-service.xml
> 
> that contains all SMTP parameters. At startup, JBoss creates a
> ConnectionFactory based on these parameters, and publishes it via JNDI.
> At runtime, this ConnectionFactory is retrieved via JNDI:
> 
> ConnectionFactory connectionFactory = (ConnectionFactory)
> ctx.lookup("QueueConnectionFactory");
> 
> Is there anything similar in TomEE?
> Thank you.
> 
> 
> 
> 
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Migrating-mail-service-from-JBoss-to-TomEE-tp4680367.html
> Sent from the TomEE Users mailing list archive at Nabble.com.