You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mikolaj Rydzewski <mi...@ceti.pl> on 2006/12/01 02:11:00 UTC

JNDI bound mail.Session and Spring's JavaMailSender

Hi,

I thought it'd be a simple task:  to send emails from Spring 2.0 webapp 
using JNDI bound mail Session, everything on Tomcat 5.5.20. I've copied 
mail.jar and activation.jar to common/lib.

I've got global resource in server.xml:

<Resource name="mail/Session"
        auth="Container"
        type="javax.mail.Session"
        mail.smtp.host="localhost"/>

I've got resource link in META-INF/context.xml:

    <ResourceLink name="mail/Session"
            global="mail/Session"
            type="javax.mail.Session"
            />

The same link in web.xml:

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

And the Spring beans:

    <bean id="mailSession" 
class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>java:comp/env/mail/Session</value>
        </property>
    </bean>

So everything should 'just work'. Unfortunately not:

org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 'mailSession' defined in ServletContext resource 
[/WEB-INF/applicationContext.xml]: Invocation of init method failed; 
nested exception is javax.naming.NamingException: Could not create 
resource factory instance [Root exception is 
java.lang.ClassNotFoundException: 
org.apache.naming.factory.MailSessionFactory]

Can somebody confirm that similiar setup works for him? Or where is the 
mistake?

Regards

-- 
Mikolaj Rydzewski      <mi...@ceti.pl>        http://ceti.pl/~miki/
                    PGP KeyID: 8b12ab02
There are three kinds of people: men, women and unix.


Re: JNDI bound mail.Session and Spring's JavaMailSender

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
Mark Thomas wrote:
>> Thanks. There should be some kind of errata on Tomcat website. To help
>> people not to loose few hours to dig through google and mail archives.
>>
>>     
> http://issues.apache.org/bugzilla/query.cgi?product=Tomcat%205
>   
I don't expect such problems when I follow official documentation step 
by step.

Anyway, thanks for the link. Hope others will easier find the solution ;-)

-- 
Mikolaj Rydzewski <mi...@ceti.pl>


Re: JNDI bound mail.Session and Spring's JavaMailSender

Posted by Mark Thomas <ma...@apache.org>.
Mikolaj Rydzewski wrote:
> Mark Thomas wrote:
>>> Can somebody confirm that similiar setup works for him? Or where is the
>>> mistake?
>>>     
>> No mistake, it is http://issues.apache.org/bugzilla/show_bug.cgi?id=40668
>>   
> Thanks. There should be some kind of errata on Tomcat website. To help
> people not to loose few hours to dig through google and mail archives.
> 
http://issues.apache.org/bugzilla/query.cgi?product=Tomcat%205

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JNDI bound mail.Session and Spring's JavaMailSender

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
Mark Thomas wrote:
>> Can somebody confirm that similiar setup works for him? Or where is the
>> mistake?
>>     
> No mistake, it is http://issues.apache.org/bugzilla/show_bug.cgi?id=40668
>   
Thanks. There should be some kind of errata on Tomcat website. To help 
people not to loose few hours to dig through google and mail archives.

-- 
Mikolaj Rydzewski <mi...@ceti.pl>


Re: JNDI bound mail.Session and Spring's JavaMailSender

Posted by Mark Thomas <ma...@apache.org>.
Mikolaj Rydzewski wrote:
> Hi,
> 
> I thought it'd be a simple task:  to send emails from Spring 2.0 webapp
> using JNDI bound mail Session, everything on Tomcat 5.5.20. I've copied
> mail.jar and activation.jar to common/lib.
>
> Can somebody confirm that similiar setup works for him? Or where is the
> mistake?
No mistake, it is http://issues.apache.org/bugzilla/show_bug.cgi?id=40668

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org