Re: Tomcat 5.0 and JavaMail - solved? not quite
My lookup still fails (stack trace at end of this email) with JasperException: Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup (java:comp/env); Session mailSession = (Session) envContext.lookup (mail/Session); // fails Is anyone successfully using JavaMail with JNDI lookup on Tomcat 5.0.27 ? Should I report it as a bug? - Original Message - From: e-Denton Subscriber [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, July 08, 2004 9:10 AM Subject: Re: Tomcat 5.0 and JavaMail - solved? You're right! Thanks! My Tomcat 5.0.25 common/lib/naming-factory.jar doesn't contain a org.apache.naming.factory.MailSessionFactory I'll try your solution. Thanks to the other posters as well. (I did forget activation.jar, even though I hadn't hit that problem yet). - Original Message - From: David Smith [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, July 08, 2004 8:34 AM Subject: Re: Tomcat 5.0 and JavaMail opinion Don't get in the habit of putting jars in java_home/jre/lib/ext. Those jars get loaded before everything and ugly version conflicts among other problems show up. /opinion I have a different take on your problem. Are you using Tomcat 5.0.25? If so, you may want to consider upgrading or just stealing common/lib/naming-factory.jar from a 5.0.24 version of Tomcat. org.apache.naming.factory.MailSessionFactory is missing from tomcat 5.0.25. See this message from the archives: http://www.mail-archive.com/[EMAIL PROTECTED]/msg128258.html --David Aris Javier wrote: you don't need to put activation.jar and mail.jar inside catalina_home\common\lib\ you need to put them inside java_home\jre\lib\ext... regards... aris -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 11:23 PM To: Tomcat Users List; e-Denton Subscriber Subject: RE: Tomcat 5.0 and JavaMail I've found that you also need activation.jar for JavaMail, do you have this in common/lib too? Ta Matt -Original Message- From: e-Denton Subscriber [mailto:[EMAIL PROTECTED] Sent: 07 July 2004 15:49 To: Tomcat Users List Subject: Tomcat 5.0 and JavaMail I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I know it's something simple, perhaps you can see the problem. Mail.jar is in Tomcat 5.0\common\lib. I am getting this error: javax.naming.NamingException: Cannot create resource instance: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml Context displayName=Portal Application debug=5 docBase=e-Denton path=/e-Denton reloadable=true useNaming=true Loader checkInterval=1 / Resource name=mail/Session auth=Container type=javax.mail.Session / ResourceParams name=mail/Session parameter namemail.smtp.host/name valuemars.webappcabaret.net/value /parameter /ResourceParams ... And this web.xml: !-- JavaMail Resource -- resource-ref description Resource reference to a factory for javax.mail.Session preconfigured to connect to the appropriate SMTP server. /description res-ref-namemail/Session/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref Accessed like this: try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); Session session = (Session) envContext.lookup(mail/Session); } catch (javax.naming.NamingException ne) Nested Exception: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRunt imeLibrary.java:355) at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibra ry.java:306) at org.apache.jsp.Test_005fJavaMail_jsp._jspService(Test_005fJavaMail_jsp.java: 81) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 24) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802
Re: Tomcat 5.0 and JavaMail
opinion Don't get in the habit of putting jars in java_home/jre/lib/ext. Those jars get loaded before everything and ugly version conflicts among other problems show up. /opinion I have a different take on your problem. Are you using Tomcat 5.0.25? If so, you may want to consider upgrading or just stealing common/lib/naming-factory.jar from a 5.0.24 version of Tomcat. org.apache.naming.factory.MailSessionFactory is missing from tomcat 5.0.25. See this message from the archives: http://www.mail-archive.com/[EMAIL PROTECTED]/msg128258.html --David Aris Javier wrote: you don't need to put activation.jar and mail.jar inside catalina_home\common\lib\ you need to put them inside java_home\jre\lib\ext... regards... aris -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 11:23 PM To: Tomcat Users List; e-Denton Subscriber Subject: RE: Tomcat 5.0 and JavaMail I've found that you also need activation.jar for JavaMail, do you have this in common/lib too? Ta Matt -Original Message- From: e-Denton Subscriber [mailto:[EMAIL PROTECTED] Sent: 07 July 2004 15:49 To: Tomcat Users List Subject: Tomcat 5.0 and JavaMail I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I know it's something simple, perhaps you can see the problem. Mail.jar is in Tomcat 5.0\common\lib. I am getting this error: javax.naming.NamingException: Cannot create resource instance: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml Context displayName=Portal Application debug=5 docBase=e-Denton path=/e-Denton reloadable=true useNaming=true Loader checkInterval=1 / Resource name=mail/Session auth=Container type=javax.mail.Session / ResourceParams name=mail/Session parameter namemail.smtp.host/name valuemars.webappcabaret.net/value /parameter /ResourceParams ... And this web.xml: !-- JavaMail Resource -- resource-ref description Resource reference to a factory for javax.mail.Session preconfigured to connect to the appropriate SMTP server. /description res-ref-namemail/Session/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref Accessed like this: try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); Session session = (Session) envContext.lookup(mail/Session); } catch (javax.naming.NamingException ne) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.0 and JavaMail - solved?
You're right! Thanks! My Tomcat 5.0.25 common/lib/naming-factory.jar doesn't contain a org.apache.naming.factory.MailSessionFactory I'll try your solution. Thanks to the other posters as well. (I did forget activation.jar, even though I hadn't hit that problem yet). - Original Message - From: David Smith [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, July 08, 2004 8:34 AM Subject: Re: Tomcat 5.0 and JavaMail opinion Don't get in the habit of putting jars in java_home/jre/lib/ext. Those jars get loaded before everything and ugly version conflicts among other problems show up. /opinion I have a different take on your problem. Are you using Tomcat 5.0.25? If so, you may want to consider upgrading or just stealing common/lib/naming-factory.jar from a 5.0.24 version of Tomcat. org.apache.naming.factory.MailSessionFactory is missing from tomcat 5.0.25. See this message from the archives: http://www.mail-archive.com/[EMAIL PROTECTED]/msg128258.html --David Aris Javier wrote: you don't need to put activation.jar and mail.jar inside catalina_home\common\lib\ you need to put them inside java_home\jre\lib\ext... regards... aris -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 11:23 PM To: Tomcat Users List; e-Denton Subscriber Subject: RE: Tomcat 5.0 and JavaMail I've found that you also need activation.jar for JavaMail, do you have this in common/lib too? Ta Matt -Original Message- From: e-Denton Subscriber [mailto:[EMAIL PROTECTED] Sent: 07 July 2004 15:49 To: Tomcat Users List Subject: Tomcat 5.0 and JavaMail I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I know it's something simple, perhaps you can see the problem. Mail.jar is in Tomcat 5.0\common\lib. I am getting this error: javax.naming.NamingException: Cannot create resource instance: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml Context displayName=Portal Application debug=5 docBase=e-Denton path=/e-Denton reloadable=true useNaming=true Loader checkInterval=1 / Resource name=mail/Session auth=Container type=javax.mail.Session / ResourceParams name=mail/Session parameter namemail.smtp.host/name valuemars.webappcabaret.net/value /parameter /ResourceParams ... And this web.xml: !-- JavaMail Resource -- resource-ref description Resource reference to a factory for javax.mail.Session preconfigured to connect to the appropriate SMTP server. /description res-ref-namemail/Session/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref Accessed like this: try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); Session session = (Session) envContext.lookup(mail/Session); } catch (javax.naming.NamingException ne) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 5.0 and JavaMail
I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I know it's something simple, perhaps you can see the problem. Mail.jar is in Tomcat 5.0\common\lib. I am getting this error: javax.naming.NamingException: Cannot create resource instance: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml Context displayName=Portal Application debug=5 docBase=e-Denton path=/e-Denton reloadable=true useNaming=true Loader checkInterval=1 / Resource name=mail/Session auth=Container type=javax.mail.Session / ResourceParams name=mail/Session parameter namemail.smtp.host/name valuemars.webappcabaret.net/value /parameter /ResourceParams ... And this web.xml: !-- JavaMail Resource -- resource-ref description Resource reference to a factory for javax.mail.Session preconfigured to connect to the appropriate SMTP server. /description res-ref-namemail/Session/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref Accessed like this: try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); Session session = (Session) envContext.lookup(mail/Session); } catch (javax.naming.NamingException ne) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.0 and JavaMail
I've found that you also need activation.jar for JavaMail, do you have this in common/lib too? Ta Matt -Original Message- From: e-Denton Subscriber [mailto:[EMAIL PROTECTED] Sent: 07 July 2004 15:49 To: Tomcat Users List Subject: Tomcat 5.0 and JavaMail I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I know it's something simple, perhaps you can see the problem. Mail.jar is in Tomcat 5.0\common\lib. I am getting this error: javax.naming.NamingException: Cannot create resource instance: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml Context displayName=Portal Application debug=5 docBase=e-Denton path=/e-Denton reloadable=true useNaming=true Loader checkInterval=1 / Resource name=mail/Session auth=Container type=javax.mail.Session / ResourceParams name=mail/Session parameter namemail.smtp.host/name valuemars.webappcabaret.net/value /parameter /ResourceParams ... And this web.xml: !-- JavaMail Resource -- resource-ref description Resource reference to a factory for javax.mail.Session preconfigured to connect to the appropriate SMTP server. /description res-ref-namemail/Session/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref Accessed like this: try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); Session session = (Session) envContext.lookup(mail/Session); } catch (javax.naming.NamingException ne) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Any opinions expressed in this E-mail may be those of the individual and not necessarily the company. This E-mail and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this E-mail in error and that any use or copying is strictly prohibited. If you have received this E-mail in error please notify the beCogent postmaster at [EMAIL PROTECTED] Unless expressly stated, opinions in this email are those of the individual sender and not beCogent Ltd. You must take full responsibility for virus checking this email and any attachments. Please note that the content of this email or any of its attachments may contain data that falls within the scope of the Data Protection Acts and that you must ensure that any handling or processing of such data by you is fully compliant with the terms and provisions of the Data Protection Act 1984 and 1998. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.0 and JavaMail
you don't need to put activation.jar and mail.jar inside catalina_home\common\lib\ you need to put them inside java_home\jre\lib\ext... regards... aris -Original Message- From: Dale, Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 11:23 PM To: Tomcat Users List; e-Denton Subscriber Subject: RE: Tomcat 5.0 and JavaMail I've found that you also need activation.jar for JavaMail, do you have this in common/lib too? Ta Matt -Original Message- From: e-Denton Subscriber [mailto:[EMAIL PROTECTED] Sent: 07 July 2004 15:49 To: Tomcat Users List Subject: Tomcat 5.0 and JavaMail I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having trouble. I know it's something simple, perhaps you can see the problem. Mail.jar is in Tomcat 5.0\common\lib. I am getting this error: javax.naming.NamingException: Cannot create resource instance: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml Context displayName=Portal Application debug=5 docBase=e-Denton path=/e-Denton reloadable=true useNaming=true Loader checkInterval=1 / Resource name=mail/Session auth=Container type=javax.mail.Session / ResourceParams name=mail/Session parameter namemail.smtp.host/name valuemars.webappcabaret.net/value /parameter /ResourceParams ... And this web.xml: !-- JavaMail Resource -- resource-ref description Resource reference to a factory for javax.mail.Session preconfigured to connect to the appropriate SMTP server. /description res-ref-namemail/Session/res-ref-name res-typejavax.mail.Session/res-type res-authContainer/res-auth /resource-ref Accessed like this: try { Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); Session session = (Session) envContext.lookup(mail/Session); } catch (javax.naming.NamingException ne) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.0 and JavaMail
I have never had problems when including mail.jar and activation.jar in my applications WEB-INF/lib/ I believe this makes it more portable to different hosts. Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Development.Multimedia.Branding emotionalize.conceptualize.visualize.realize Tel: +27125468436 Fax: +27125468436 email:[EMAIL PROTECTED] web: www.volume4.co.za This message contains information that is considered to be sensitive or confidential and may not be forwarded or disclosed to any other party without the permission of the sender. If you received this message in error, please notify me immediately so that I can correct and delete the original email. Thank you. :: -Original Message- :: From: Aris Javier [mailto:[EMAIL PROTECTED] :: Sent: Thursday, July 08, 2004 1:54 AM :: To: Tomcat Users List :: Subject: RE: Tomcat 5.0 and JavaMail :: :: you don't need to put activation.jar and mail.jar inside :: catalina_home\common\lib\ you need to put them inside :: java_home\jre\lib\ext... :: :: regards... :: aris :: :: -Original Message- :: From: Dale, Matt [mailto:[EMAIL PROTECTED] :: Sent: Wednesday, July 07, 2004 11:23 PM :: To: Tomcat Users List; e-Denton Subscriber :: Subject: RE: Tomcat 5.0 and JavaMail :: :: :: :: I've found that you also need activation.jar for JavaMail, do you have :: this in common/lib too? :: :: Ta :: Matt :: :: -Original Message- :: From: e-Denton Subscriber [mailto:[EMAIL PROTECTED] :: Sent: 07 July 2004 15:49 :: To: Tomcat Users List :: Subject: Tomcat 5.0 and JavaMail :: :: :: I had JavaMail working in Tomcat 4, but in Tomcat 5, I am having :: trouble. I know it's something simple, perhaps you can see the problem. :: Mail.jar is in Tomcat 5.0\common\lib. :: :: I am getting this error: :: :: javax.naming.NamingException: Cannot create resource instance: :: :: Using this context in Tomcat 5.0\conf\Catalina\localhost\e_Denton.xml :: :: Context displayName=Portal Application :: debug=5 :: docBase=e-Denton :: path=/e-Denton :: reloadable=true :: useNaming=true :: :: Loader checkInterval=1 / :: :: Resource name=mail/Session auth=Container :: type=javax.mail.Session / ResourceParams name=mail/Session :: parameter ::namemail.smtp.host/name ::valuemars.webappcabaret.net/value :: /parameter :: /ResourceParams :: ... :: :: And this web.xml: :: :: !-- JavaMail Resource -- :: resource-ref :: description :: Resource reference to a factory for javax.mail.Session :: preconfigured to connect to the appropriate SMTP server. :: /description :: res-ref-namemail/Session/res-ref-name :: res-typejavax.mail.Session/res-type :: res-authContainer/res-auth :: /resource-ref :: :: Accessed like this: :: :: try ::{ ::Context initContext = new InitialContext(); ::Context envContext = (Context) initContext.lookup(java:comp/env); ::Session session = (Session) envContext.lookup(mail/Session); ::} :: catch (javax.naming.NamingException ne) :: :: :: :: :: :: :: - :: To unsubscribe, e-mail: [EMAIL PROTECTED] :: For additional commands, e-mail: [EMAIL PROTECTED] :: :: :: - :: To unsubscribe, e-mail: [EMAIL PROTECTED] :: For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]