Nope, 5.0.28 -----Original Message----- From: Brian Bonner [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 09, 2005 4:50 PM To: Tomcat Users List Subject: Re: MailSessionFactory problems in 5.5.9
Thanks, Derrick, that's how I used to have it in 4.1.29. Are you using 5.5.x? Brian Derrick Koes wrote: >Here is an example from what I do: > >server.xml: > > <?xml version='1.0' encoding='utf-8'?> <Server> > <Listener >className="org.apache.catalina.mbeans.ServerLifecycleListener"/> > <Listener >className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" >/> > <GlobalNamingResources> > <Environment description="" name="com.skillsoft.mgs.sso.TL" > type="java.lang.Boolean" value="true"/> > <Environment description="Hibernate dialect: > net.sf.Hibernate.dialect.[SQLServerDialect|OracleDialect|Oracle9Dialect]" > name="hibernate.dialect" override="false" type="java.lang.String" > value="net.sf.hibernate.dialect.SQLServerDialect"/> > <Environment name="simpleValue" type="java.lang.Integer" value="30"/> > <Resource auth="Container" description="User database that can be updated > and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/> > <Resource name="com/skillsoft/ilt/jdbc" type="javax.sql.DataSource"/> > <Resource name="com/skillsoft/mgs/mail/session" type="javax.mail.Session"/> > <ResourceParams name="UserDatabase"> > <parameter> > <name>factory</name> > <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value> > </parameter> > <parameter> > <name>pathname</name> > <value>conf/tomcat-users.xml</value> > </parameter> > </ResourceParams> > <ResourceParams name="com/skillsoft/ilt/jdbc"> > <parameter> > <name>url</name> > > <value>jdbc:jtds:sqlserver://localhost:1433;useCursors=true;useLOBs=false</value> > </parameter> > <parameter> > <name>validationQuery</name> > <value>SELECT TOP 1 iltVersion FROM iltVersion</value> > </parameter> > <parameter> > <name>maxIdle</name> > <value>50</value> > </parameter> > <parameter> > <name>maxActive</name> > <value>100</value> > </parameter> > <parameter> > <name>driverClassName</name> > <value>net.sourceforge.jtds.jdbc.Driver</value> > </parameter> > <parameter> > <name>maxWait</name> > <value>5000</value> > </parameter> > <parameter> > <name>username</name> > <value>sa</value> > </parameter> > <parameter> > <name>factory</name> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> > </parameter> > <parameter> > <name>password</name> > <value></value> > </parameter> > <parameter> > <name>defaultCatalog</name> > <value>sp62107Master</value> > </parameter> > <parameter> > <name>initialSize</name> > <value>25</value> > </parameter> > </ResourceParams> > <ResourceParams name="com/skillsoft/mgs/mail/session"> > <parameter> > <name>mail.smtp.port</name> > <value>25</value> > </parameter> > <parameter> > <name>mail.smtp.host</name> > <value>10.20.30.40</value> <!-- Changed to protect the innocent. --> > </parameter> > <parameter> > <name>mail.smtp.sendpartial</name> > <value>true</value> > </parameter> > </ResourceParams> > </GlobalNamingResources> > <Service name="Catalina"> > <Connector URIEncoding="UTF-8" acceptCount="100" connectionTimeout="20000" > disableUploadTimeout="true" port="8080" redirectPort="8443"> > </Connector> > <Connector URIEncoding="UTF-8" debug="9" disableUploadTimeout="true" > maxProcessors="0" port="8009" protocol="AJP/1.3" > protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" > redirectPort="8443"> > </Connector> > <Engine defaultHost="localhost" jvmRoute="dkoesxp8009" name="Catalina"> > <Host appBase="webapps" name="localhost"> > <Logger className="org.apache.catalina.logger.FileLogger" > prefix="localhost_log." suffix=".txt" timestamp="true"/> > </Host> > <Logger className="org.apache.catalina.logger.FileLogger" > prefix="catalina_log." suffix=".txt" timestamp="true"/> > <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/> > </Engine> > </Service> ></Server> > >context.xml: > ><?xml version='1.0' encoding='utf-8'?> ><Context crossContext="true" displayName="SkillPort ILT Add-On >(Unofficial Version)" docBase="D:/Projects/ILT" path="/ilt" >reloadable="true" workDir="D:/Projects/ILT/work"> <Valve >className="org.apache.catalina.valves.RequestDumperValve"/> > <Environment description="" name="com.skillsoft.mgs.sso.TL" >type="java.lang.Boolean" value="true"/> > <ResourceLink global="hibernate.dialect" name="hibernate.dialect" >type="java.lang.String"/> > <ResourceLink global="com/skillsoft/ilt/jdbc" >name="com/skillsoft/ilt/jdbc" type="javax.sql.DataSource"/> > <ResourceLink global="com/skillsoft/mgs/mail/session" >name="com/skillsoft/mgs/mail/session" type="javax.mail.Session"/> ></Context> > >-----Original Message----- >From: Brian Bonner [mailto:[EMAIL PROTECTED] >Sent: Tuesday, August 09, 2005 4:25 PM >To: Tomcat Users List >Subject: Re: MailSessionFactory problems in 5.5.9 > >P.S. I'm using jdk 1.5.0_04 with Eclipse 3.1 and WTP 0.7 with Spring >1.2.2 as my dev environment. > >Brian > > > >Brian Bonner wrote: > > > >>Hello, I'm trying to use the >>org.apache.naming.factory.MailSessionFactory in 5.5.9 with Spring's >>JndiObjectFactoryBean and I'm experiencing problems. I want to >>configure a global mail configuration and then use a resource-link to >>link one or more apps to the resource. >> >>i.e. >> >><Resource name="GlobalMailSession" auth="Container" >> type="javax.mail.Session" description="Global Mail Session" >>mail.smtp.user="xyz" password="dummy" > >> </Resource> >> >>The GlobalLifecycleListener creates these MBeans (and the appropriate >>javax.mail.Authenticator) >> >>Unfortunately, however, I can't specify the smtp.mail.host, port, >>protocol or localhost with this resource definition. smtp.mail.host >>defaults to localhost. >>When I want to access the mailSession using Spring, doing a lookup >>causes a new MailSession to be created with the settings of the >>ResourceReference (i.e. the Authenticator is null). >> >> <bean id="mailSession" >> class="org.springframework.jndi.JndiObjectFactoryBean" >>singleton="true"> >> <property name="jndiName"> >> <value>mail/MailSession</value> >> </property> >> <property name="resourceRef"> >> <value>true</value> >> </property> >> <property name="javaMailProperties"> >> <props> >> <prop key="mail.smtp.port">25</prop> >> <prop key="mail.transport.protocol">smtp</prop> >> <prop key="mail.smtp.host">mymailhost</prop> >> </props> >> </property> >> </bean> >> >>My Web.xml's resource-ref is as follows: >> >> <resource-ref> >> <description>Mail Session</description> >> <res-ref-name>mail/MailSession</res-ref-name> >> <res-type>javax.mail.Session</res-type> >> <res-auth>Container</res-auth> >> <res-sharing-scope>Shareable</res-sharing-scope> >> </resource-ref> >> >>My context.xml (that I'm definining in the META-INF directory) includes: >> >><ResourceLink name="mail/Session" >> global="GlobalMailSession" >> type="javax.mail.Session" /> >> >>So, I have the properties for port, protocol, and localhost, but the >>Authenticator is gone. Argh! >> >>I've seen other folks have problems with this in 5.5. Looking at the >>source suggests that this Factory needs some work. I looked at the >>5.5.10 changelog and it doesn't show any changes to this code AFAIK. >> >>So my quick questions are: >> >>1. The ResourceParams tag doesn't appear to be supported any longer >>in Tomcat 5.5.x. (they were supported in 4.1.x, but I can't even find >>reference to them). How do I define the localhost as well as >>authentication for a global MailSessionFactory resource? >> >>2. How do I prevent a new resource being created in 5.5.x each >>time--why can't I get to the original global resource? Is there a >>switch I forgot to throw? >> >>Thanks. >> >> >> > > >--------------------------------------------------------------------- >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]
