Bug 34001

Summary: NamingException
Product: Tomcat 5 Reporter: tony <tony>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: tony
Priority: P2 Keywords: ErrorMessage
Version: 5.5.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   

Description tony 2005-03-14 09:04:48 UTC
Hi,

I've discovered a new bug in Tomcat 5.5.

Calling a mail resource simply won't work.
Below a full example on when it fails.


The CATALINA/localhost/lio2.xml contains the following code:
------------------------------------------------------------
<Resource
    name="mail/session"
    type="javax.mail.Session"
    mail.smtp.host="localhost"/>


The Servlet contains following code inside the init():
--------------------------------------------------
mailSession = ( javax.mail.Session ) new InitialContext().lookup 
("java:comp/env/mail/session");


The outcome on the server shows:
---------------------------------------
SEVERE: Servlet /lio2 threw load() exception
javax.naming.NamingException: Cannot create resource instance
        at org.apache.naming.factory.ResourceFactory.getObjectInstance
(ResourceFactory.java:132)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at com.lio.servlet.CreateAdServlet.init(CreateAdServlet.java:66)


Interesting enough if you test this for a database connection then it works.
 
Cheers
 
Tony
Comment 1 Remy Maucherat 2005-03-22 17:02:46 UTC

*** This bug has been marked as a duplicate of 34131 ***