You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Dave Wolf (JIRA)" <ji...@apache.org> on 2007/12/12 22:43:43 UTC

[jira] Created: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
-----------------------------------------------------------------------------------------------

                 Key: JSPWIKI-102
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
             Project: JSPWiki
          Issue Type: Bug
          Components: Core & storage
    Affects Versions: 2.6.0
         Environment: Tomcat 5.5, JRE 1.6, WinXP
            Reporter: Dave Wolf


For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.

In my jspwiki.properties file, I have:

#  JNDI resource name. The commented-out value is the default
jspwiki.mail.jndiname = mail/Session

#  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
#
#  Your SMTP host (i.e. the one which sends email)
# mail.smtp.host = 127.0.0.1

# If for some reason the standard smtp port (25) is blocked, you can change it here
# mail.smtp.port = 25

#  The address from which the email appears to come
mail.from =JSPWiki <jspwiki@************.com>

# If you are using a webserver that is publically accessible it usually
# doesn't allow you to send mail anonymously
# (because then this mailserver would become an open relay).
# Therefore you can indicate your account information here...
#
# mail.smtp.account =
# mail.smtp.password =

# The properties below control connection timeouts and TLS (encryption)
# if the mailserver supports it. The commented-out values are the defaults.
# mail.smtp.timeout = 5000
# mail.smtp.connectiontimeout = 5000
# mail.smtp.starttls.enable = tru

Currently, in server.xml I have:

 <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
    <ResourceParams name="mail/Session">
    <parameter>
             <name>factory</name>
            <value>org.apache.naming.factory.MailSessionFactory </value>
        </parameter>
    <parameter>
            <name>mail.smtp.host</name>
            <value>smtp-********.com</value>
        </parameter>
    <parameter>
            <name>mail.smtp.port</name>
            <value>6225</value>
        </parameter>
    <parameter>
            <name>mail.smtp.account</name>
            <value>************</value>
        </parameter>
    <parameter>
            <name>mail.smtp.password</name>
            <value>**********</value>
        </parameter>
    <parameter>
            <name>mail.smtp.timeout</name>
            <value>5000</value>
        </parameter>
    <parameter>
            <name>mail.smtp.connectiontimeout</name>
            <value>5000</value>
        </parameter>
    <parameter>
            <name>mail.smtp.starttls.enable</name>
            <value>true</value>
        </parameter>
    </ResourceParams>

Previously, I tried this instead:

    <Resource name="mail/Session" auth="Container"
        type="javax.mail.Session"
        mail.smtp.host= "smtp-*******.com"
        mail.smtp.port="6225"
        mail.smtp.account="***************"
        mail.smtp.password="**************"
        mail.smtp.timeout="5000"
        mail.smtp.connectiontimeout="5000"
        mail.smtp.starttls.enable="true"/>

Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:

 12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]

 12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)

 12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles

 12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5

 12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
  nested exception is:
    java.net.ConnectException : Connection refused: connect

 12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560798#action_12560798 ] 

Janne Jalkanen commented on JSPWIKI-102:
----------------------------------------

Any news on this?  Propose we close this if this cannot be replicated.

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551128 ] 

Andrew Jaquith commented on JSPWIKI-102:
----------------------------------------

Dave, a few questions:

- It's not clear what mail factory JSPWiki is actually using (the stand-alone factory, or the container-managed mail factory). Please turn logging to DEBUG mode and tell me what you see. You'll see a message in the log that looks like this: "JavaMail session obtained from standalone mail factory" or "JavaMail session obtained from JNDI mail factory."

- It looks like you are trying to use the JNDI factory, but have you tried using the standalone mail factory (configured through JSPWiki.properties)? Does that produce a different result?

- It's also possible that your remote mail server won't let you send mail. Can you SSH or telnet into the box and try to send mail from the command-line (e.g., sendmail). For example: sendmail -f testsender@mywiki.org testreceiver@mywiki.org (enter) test message! (control-D to end...). This will tell you whether your SMTP server is even accepting connections.

Short term, though: try turning on DEBUGIng and we'll take it from there.  
 

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561867#action_12561867 ] 

Andrew Jaquith commented on JSPWIKI-102:
----------------------------------------

This bug appears to have been introduced by the checkin on 12/25/07 by Janne. (**cough**). That checkin does, indeed, guarantee that JNDI mail resources are never used.

However, I am not sure that the patch, as submitted, includes everything we need.  This block is the one that sets up the connection:

if (useJndi)
        {
            // Try getting the Session from the JNDI factory first
            try
            {
                session = getJNDIMailSession(jndiName);
                useJndi = true;
            }
            catch (NamingException e)
            {
                // Oops! JNDI factory must not be set up
            }
        }

It seems to me that in the catch{} block we would probably want to set useJndi = false to prevent future connection attempts if JNDI fails. Or, we could simply remove the enclosing if(useJndi) block and the member field. 

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>         Attachments: MailUtilJNDIPatch
>
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561999#action_12561999 ] 

Janne Jalkanen commented on JSPWIKI-102:
----------------------------------------

But that patch was not introduced until 2.6.1-cvs-5 - how could it possibly affect 2.6.0 [which is what this bug is about]?

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>         Attachments: JSPWiki-102.patch, MailUtilJNDIPatch
>
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Florian Holeczek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562007#action_12562007 ] 

Florian Holeczek commented on JSPWIKI-102:
------------------------------------------

Janne: That's why I wrote "That was the bug part of the solution to Dave's problem."... I'm quite sure there are other configuration mistakes, but since these are no bug, I didn't post the possible solutions here but on the mailing list ("teaching mailing to JSPWiki").

BTW: It would be nice to modify the standard (not debugging - there it is already) logging messages in a way to be able to see which mail factory is in use. Since the code will be modified to check for a JNDI mail factory once and if it's not successful, leave it until the next restart, it would be nice to know:
"INFO: check for JNDI mail factory unsuccessful, will be using custom mail factory at least until next restart."
At the moment, this is only visible indirectly: When you see an error (couldn't send mail via 127.0.0.1 for example) because custom mailing hasn't been configured.

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>         Attachments: JSPWiki-102.patch, MailUtilJNDIPatch
>
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Florian Holeczek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561858#action_12561858 ] 

Florian Holeczek commented on JSPWIKI-102:
------------------------------------------

At the moment, the usage of JNDI mail factories isn't possible due to a small bug in MailUtil.

A private boolean useJndi is initialized with false and never set to true. However, the code for JNDI lookup only gets executed when useJndi is set to true. A Patch for this single line is attached. (Silly, I know, but I just wanted to test this patch feature ;-))

I'm already running JSPWiki with JNDI mailing now. According to the code, the fallback function should continue working fine.

That was the bug part of the solution to Dave's problem.

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Janne Jalkanen resolved JSPWIKI-102.
------------------------------------

    Resolution: Fixed

Added Harry's patch in 2.6.1-cvs-10.  Please reopen if it does not work!

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>             Fix For: 2.6.1
>
>         Attachments: JSPWiki-102.patch, MailUtilJNDIPatch
>
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Dave Wolf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560818#action_12560818 ] 

Dave Wolf commented on JSPWIKI-102:
-----------------------------------

Hi Janne,

I've been busy with work and haven't had a chance to look into this further since coming back from holiday. I'll see if It works with the latest version.

Dave

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552075 ] 

Janne Jalkanen commented on JSPWIKI-102:
----------------------------------------

Works for me using my ISP's SMTP host.

However, it's critical to notice that JSPWiki always defaults to TLS connections (i.e. it issues STARTTLS as the first command in an SMTP session, even when connected to the regular TLS port).  Therefore, you should also try it with

mail.smtp.starttls.enable=false

Also, make sure that this is not a firewall issue.  Many firewalls block connections to port 25 from unknown computers in an attempt to stop zombie computers from sending spam.

(BTW, the settings I am using are in jspwiki.properties as follows:

mail.smtp.host=smtp.welho.com
mail.from=JSPWiki@ecyrd.com

Everything else is defaults.  But my mail provider does support TLS.)

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562066#action_12562066 ] 

Janne Jalkanen commented on JSPWIKI-102:
----------------------------------------

Patches welcome :)

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>         Attachments: JSPWiki-102.patch, MailUtilJNDIPatch
>
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-102) Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562671#action_12562671 ] 

Janne Jalkanen commented on JSPWIKI-102:
----------------------------------------

Soo... Which one of the patches is now correct and does it fix the whole issue?

> Unable to configure Container Mail / Session factory with custom Host, Port, User, and Password
> -----------------------------------------------------------------------------------------------
>
>                 Key: JSPWIKI-102
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.6.0
>         Environment: Tomcat 5.5, JRE 1.6, WinXP
>            Reporter: Dave Wolf
>             Fix For: 2.6.1
>
>         Attachments: JSPWiki-102.patch, MailUtilJNDIPatch
>
>
> For weeks, I've been attempting to get the Mail session factory working in Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP host and port. Since I'm running JRE 1.6, I've removed the activation.jar from the WEB-INF/lib and moved the most recent version of the mail.jar to <CATALINA_HOME>/commons/lib.
> In my jspwiki.properties file, I have:
> #  JNDI resource name. The commented-out value is the default
> jspwiki.mail.jndiname = mail/Session
> #  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
> #
> #  Your SMTP host (i.e. the one which sends email)
> # mail.smtp.host = 127.0.0.1
> # If for some reason the standard smtp port (25) is blocked, you can change it here
> # mail.smtp.port = 25
> #  The address from which the email appears to come
> mail.from =JSPWiki <jspwiki@************.com>
> # If you are using a webserver that is publically accessible it usually
> # doesn't allow you to send mail anonymously
> # (because then this mailserver would become an open relay).
> # Therefore you can indicate your account information here...
> #
> # mail.smtp.account =
> # mail.smtp.password =
> # The properties below control connection timeouts and TLS (encryption)
> # if the mailserver supports it. The commented-out values are the defaults.
> # mail.smtp.timeout = 5000
> # mail.smtp.connectiontimeout = 5000
> # mail.smtp.starttls.enable = tru
> Currently, in server.xml I have:
>  <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
>     <ResourceParams name="mail/Session">
>     <parameter>
>              <name>factory</name>
>             <value>org.apache.naming.factory.MailSessionFactory </value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.host</name>
>             <value>smtp-********.com</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.port</name>
>             <value>6225</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.account</name>
>             <value>************</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.password</name>
>             <value>**********</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.timeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.connectiontimeout</name>
>             <value>5000</value>
>         </parameter>
>     <parameter>
>             <name>mail.smtp.starttls.enable</name>
>             <value>true</value>
>         </parameter>
>     </ResourceParams>
> Previously, I tried this instead:
>     <Resource name="mail/Session" auth="Container"
>         type="javax.mail.Session"
>         mail.smtp.host= "smtp-*******.com"
>         mail.smtp.port="6225"
>         mail.smtp.account="***************"
>         mail.smtp.password="**************"
>         mail.smtp.timeout="5000"
>         mail.smtp.connectiontimeout="5000"
>         mail.smtp.starttls.enable="true"/>
> Neither configuration works, I'm getting the messages from JSPWiki in the jspwiki.log:
>  12-06@11:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - WikiSecurityEvent.LOGIN_AUTHENTICATED [source=com.ecyrd.jspwiki.auth.AuthenticationManager@c00025 , princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, target=com.ecyrd.jspwiki.WikiSession@1e13a2c]
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user dave.wolf (custom auth)
>  12-06@11:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles
>  12-06@11:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating new user test5
>  12-06@11:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
>   nested exception is:
>     java.net.ConnectException : Connection refused: connect
>  12-06@11:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.