You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by sithmein <th...@knime.com> on 2014/09/18 21:31:06 UTC

OpenEJB messes with InitialContext

Hi,

I have a normal web application (no EJB stuff yet) that uses a mail session
resource as described in
http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JavaMail_Sessions.
This works perfectly if the webapp is deployed in a vanilla Tomcat 7. If I
use the very same webapp and deploy it in TomEE (1.6.0.2) then the object
registered in JNDI is not a javax.mail.Session any more, but an IvmContext.
This causes a class cast exception and the webapp doesn't work any more. I
have two question regarding this issue: 1) why does OpenEJB mess with the
context? 2) How do I access the mail session now in non-EJB classes?

Thanks,

Thorsten



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenEJB messes with InitialContext

Posted by sithmein <th...@knime.com>.
Am 21.09.2014 14:51, schrieb Romain Manni-Bucau [via TomEE & OpenEJB]:
> that's actually a bug.
> 
> you can still use tomee resource declaration for your session and it
> will work. The issue comes from tomcat resource integration
Yes, I can confirm that configuring the mail session via tomee.xml works.

Thorsten
-- 
Dr.-Ing. Thorsten Meinl
KNIME.com AG
Technoparkstr. 1
8005 Zurich, Switzerland




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869p4671895.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenEJB messes with InitialContext

Posted by Romain Manni-Bucau <rm...@gmail.com>.
PS: https://issues.apache.org/jira/browse/TOMEE-1356


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-21 14:51 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> that's actually a bug.
>
> you can still use tomee resource declaration for your session and it
> will work. The issue comes from tomcat resource integration
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-21 14:03 GMT+02:00 sithmein <th...@knime.com>:
>> Am 18.09.2014 21:51, schrieb Romain Manni-Bucau [via TomEE & OpenEJB]:
>>> 1) which jndi name? maybe a conflict with standard jndi naming
>>> 2) new InitialContext().lookup(name)
>>> 3) maybe test on 1.7.1 as well
>> Just tested with 1.7.1 and the problem persists.
>> How do I access the mail session now?
>>
>>
>> Thorsten
>>
>> --
>> Dr.-Ing. Thorsten Meinl
>> KNIME.com AG
>> Technoparkstr. 1
>> 8005 Zurich, Switzerland
>>
>>
>>
>>
>> --
>> View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869p4671892.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenEJB messes with InitialContext

Posted by Romain Manni-Bucau <rm...@gmail.com>.
that's actually a bug.

you can still use tomee resource declaration for your session and it
will work. The issue comes from tomcat resource integration


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-21 14:03 GMT+02:00 sithmein <th...@knime.com>:
> Am 18.09.2014 21:51, schrieb Romain Manni-Bucau [via TomEE & OpenEJB]:
>> 1) which jndi name? maybe a conflict with standard jndi naming
>> 2) new InitialContext().lookup(name)
>> 3) maybe test on 1.7.1 as well
> Just tested with 1.7.1 and the problem persists.
> How do I access the mail session now?
>
>
> Thorsten
>
> --
> Dr.-Ing. Thorsten Meinl
> KNIME.com AG
> Technoparkstr. 1
> 8005 Zurich, Switzerland
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869p4671892.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenEJB messes with InitialContext

Posted by sithmein <th...@knime.com>.
Am 18.09.2014 21:51, schrieb Romain Manni-Bucau [via TomEE & OpenEJB]:
> 1) which jndi name? maybe a conflict with standard jndi naming
> 2) new InitialContext().lookup(name)
> 3) maybe test on 1.7.1 as well
Just tested with 1.7.1 and the problem persists.
How do I access the mail session now?


Thorsten

-- 
Dr.-Ing. Thorsten Meinl
KNIME.com AG
Technoparkstr. 1
8005 Zurich, Switzerland




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869p4671892.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenEJB messes with InitialContext

Posted by sithmein <th...@knime.com>.
Hi,

Thanks for the fast reply!

Am 18.09.2014 21:51, schrieb Romain Manni-Bucau [via TomEE & OpenEJB]:
> 1) which jndi name? maybe a conflict with standard jndi naming
It's "mail/knime", so very likely no clash.

> 2) new InitialContext().lookup(name)
Nope same effect. I also tried several other names, as I see some
OpenEJB messages during startup with "mail/knime" (e.g.
"com.knime.enterprise/mail/knime" or "openejb/Resource/mail/knime"), but
all return an IvmContext instead of the Session.

> 3) maybe test on 1.7.1 as well
I will try tomorrow.

Cheers,

Thorsten

-- 
Dr.-Ing. Thorsten Meinl
KNIME.com AG
Technoparkstr. 1
8005 Zurich, Switzerland






--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869p4671874.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: OpenEJB messes with InitialContext

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

1) which jndi name? maybe a conflict with standard jndi naming
2) new InitialContext().lookup(name)
3) maybe test on 1.7.1 as well


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-18 21:31 GMT+02:00 sithmein <th...@knime.com>:
> Hi,
>
> I have a normal web application (no EJB stuff yet) that uses a mail session
> resource as described in
> http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JavaMail_Sessions.
> This works perfectly if the webapp is deployed in a vanilla Tomcat 7. If I
> use the very same webapp and deploy it in TomEE (1.6.0.2) then the object
> registered in JNDI is not a javax.mail.Session any more, but an IvmContext.
> This causes a class cast exception and the webapp doesn't work any more. I
> have two question regarding this issue: 1) why does OpenEJB mess with the
> context? 2) How do I access the mail session now in non-EJB classes?
>
> Thanks,
>
> Thorsten
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/OpenEJB-messes-with-InitialContext-tp4671869.html
> Sent from the TomEE Users mailing list archive at Nabble.com.