DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34131>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34131

           Summary: Regression: cannot create JavaMail sessions with
                    MailSessionFactory in Tomcat 5.5.8
           Product: Tomcat 5
           Version: 5.5.7
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


This is a regression: no such error occurs with Tomcat 5.5.4 (or earlier).  It
occurs on Tomcat 5.5.8, maybe on other versions after 5.5.4 too.

Whenever I attempt to access a JavaMail session, an exception occurs.  The
application in question follows the technique described in:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html

...and yes, I have ensured that the "activation" and "javamail" JARs are ONLY
present in "%CATALINA_HOME%\common\lib" (and not in the application's
"/WEB-INF/lib" folder or anything else like that).  I use the same version of
JavaMail with Tomcat 5.5.4 and 5.5.8 (that's JavaMail 1.3.2).

Anyway, here's the stacktrace.

javax.naming.NamingException: Cannot create resource instance
        at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:132)
        at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        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:152)
        at
fr.reflexe.commons.api.j2ee.StandardWebAppContainer.getMailSession(StandardWebAppContainer.java:182)
        at ...

The web application is called "open", deployed as a directory in
"%CATALINA_HOME%\webapps".  In "%CATALINA_HOME%\conf\Catalina\localhost", I've
placed the file "open.xml", which is read in.  Here's the document content:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<Context unpackWARs="false" docBase="open">

 <Environment name="someKey" type="java.lang.String" value="someValue" />

 <Resource name="jdbc/OpenAGE" auth="Container" type="javax.sql.DataSource"
  maxActive="10"
  maxIdle="5"
  maxWait="10000"
  username="OPENAGE"
  password="OPENAGE"
  driverClassName="com.mysql.jdbc.Driver"
  url="jdbc:mysql://localhost/OPENAGE"
 
connectionProperties="autoReconnect=true;useUnicode=true;characterEncoding=utf8;profileSql=false;useServerPrepStmts=false"
 />

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

</Context>

The environment entries are readable, the datasource is too.  It's only the
JavaMail Session factory that isn't working.  An appropriate resource reference
is defined in /WEB-INF/web.xml (and worked fine with Tomcat 5.5.4).

I looked into this a little further.  It appears that Tomcat does indeed bind
SOMETHING to:

  java:comp/env/mail/OpenAGE

...but Tomcat's ResourceFactory throws "javax.naming.NamingException: Cannot
create resource instance" when any attempt is made to access it.  If I call
Context.list("") on the context "java:comp/env/mail", the returned
NamingEnumeration lists "OpenAGE" as a NameClassPair, but throws an exception
when attempting to perform the lookup() to get access to the mail session.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to