Bug 34001 - NamingException
Summary: NamingException
Status: RESOLVED DUPLICATE of bug 34131
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.7
Hardware: PC Windows 2000
: P2 blocker (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: ErrorMessage
Depends on:
Blocks:
 
Reported: 2005-03-14 09:04 UTC by tony
Modified: 2005-03-22 08:02 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***