Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • MailSessionFactory problems in 5.5.9

    1 answers - 8466 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Here is an example from what I do:
    server.xml:
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
    <Listener className=""/>
    <Listener className=""/>
    <GlobalNamingResources>
    <Environment description="" name="com.skillsoft.mgs.sso.TL" type="java.lang.Boolean" value="true"/>
    <Environment description="Hibernate dialect: net.sf.Hibernate.dialect.[SQLServerDialect|Dialect|Dialect]" name="hibernate.dialect" override="false" type="java.lang.String" value=""/>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type=""/>
    <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></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>;useCursors=true;useLBs=false</value>
    </parameter>
    <parameter>
    <name>validationQuery</name>
    <value>SELECT TP 1 iltVersion FRM iltVersion</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>50</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>100</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value></value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>factory</name>
    <value></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="" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" jvmRoute="dkoesxp8009" name="Catalina">
    <Host appBase="webapps" name="localhost">
    <Logger className="" prefix="localhost_log." suffix=".txt" timestamp="true"/>
    </Host>
    <Logger className="" prefix="catalina_log." suffix=".txt" timestamp="true"/>
    <Realm className=""/>
    </Engine>
    </Service>
    </Server>
    context.xml:
    <?xml version='1.0' encoding='utf-8'?>
    <Context crossContext="true" displayName="SkillPort ILT A (Unofficial Version)" docBase="D:/Projects/ILT" path="/ilt" reloadable="true" workDir="D:/Projects/ILT/work">
    <Valve className=""/>
    <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>
    Message
    From: Brian Bonner [mailto:brian.bonner (AT) paraware (DOT) com]
    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
    in 5.5.9 with Spring's
    JFactoryBean 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=""
    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 can't I get to the original global resource? Is there a
    switch I forgot to throw?
    Thanks.
    To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org
    To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org
  • No.1 | | 9802 bytes | |

    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=""/>
    <Listener className=""/>
    <GlobalNamingResources>
    <Environment description="" name="com.skillsoft.mgs.sso.TL" type="java.lang.Boolean" value="true"/>
    <Environment description="Hibernate dialect: net.sf.Hibernate.dialect.[SQLServerDialect|Dialect|Dialect]" name="hibernate.dialect" override="false" type="java.lang.String" value=""/>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type=""/>
    <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></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>;useCursors=true;useLBs=false</value>
    </parameter>
    <parameter>
    <name>validationQuery</name>
    <value>SELECT TP 1 iltVersion FRM iltVersion</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>50</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>100</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value></value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>factory</name>
    <value></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="" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" jvmRoute="dkoesxp8009" name="Catalina">
    <Host appBase="webapps" name="localhost">
    <Logger className="" prefix="localhost_log." suffix=".txt" timestamp="true"/>
    </Host>
    <Logger className="" prefix="catalina_log." suffix=".txt" timestamp="true"/>
    <Realm className=""/>
    </Engine>
    </Service>
    ></Server>
    >
    >context.xml:
    >
    ><?xml version='1.0' encoding='utf-8'?>
    ><Context crossContext="true" displayName="SkillPort ILT A (Unofficial Version)" docBase="D:/Projects/ILT" path="/ilt" reloadable="true" workDir="D:/Projects/ILT/work">
    ><Valve className=""/>

    <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>
    >

    Message
    >From: Brian Bonner [mailto:brian.bonner (AT) paraware (DOT) com]
    >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

    >in 5.5.9 with Spring's
    >>JFactoryBean 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=""
    >>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 can't I get to the original global resource? Is there a
    >>switch I forgot to throw?
    >>
    >>Thanks.
    >>

    >
    >>

    >
    >
    >
    >To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
    >For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org
    >
    >
    >
    >
    >To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
    >For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org
    >


    To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
    For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org

Re: MailSessionFactory problems in 5.5.9


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 0 =
QUESTION ON "Java"

EMSDN.COM