You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jspwiki.apache.org by Florian Holeczek <fl...@holeczek.de> on 2008/01/23 12:41:22 UTC

teaching mailing to JSPWiki

Hi all,

I'm trying to teach mailing to my local JSPWiki on Tomcat 6. Since I'm
using Apache Roller, too, I'd like to configure a global Mail
resource.
My JSPWiki is running with custom authentication via the
CookieAuthModule.

I added the following code to Tomcat's server.xml
<GlobalNamingResources> section:
---
    <Resource name="mail/Session" auth="Application"
              type="javax.mail.Session"
              mail.user="someuser@holeczek.de"
              mail.password="secret"
              mail.smtp.host="smtp.1und1.de"
              mail.smtp.starttls.enable="true"
              mail.smtp.auth="true"
              debug="true"
              description="some desc." />
---

Then I added this jspwiki.xml to Catalina/localhost to map the global
resource to JSPWiki's Context:
---
<Context path="/jspwiki" debug="0">
        <ResourceLink
                name="mail/Session"
                global="mail/Session"
                type="javax.mail.Session"
        />
</Context>
---

The next thing was modifying JSPWiki's web.xml:
---
   <resource-ref>
     <description>Resource reference to a application-managed JNDI JavaMail factory for sending e-mails.</description>
     <res-ref-name>mail/Session</res-ref-name>
     <res-type>javax.mail.Session</res-type>
     <res-auth>Application</res-auth>
   </resource-ref>
---

Well, mailing isn't working :-( I'm not sure if this log entry is
related to this issue:
23.01.2008 12:16:28 org.apache.catalina.core.ApplicationContext log
INFO: No jspwiki.propertyfile defined for this context, using default from /WEB-INF/jspwiki.properties

JSPWiki's log tells me that it falls back to its own settings. BTW,
when commenting out all custom mail settings, the log simply contains
a NullPointerException at this place.

I'm new to all this JNDI, JEE a.s.o. stuff and maybe I'm doing a basic
mistake?

Would appreciate any help!

Regards,
 Florian


Re: teaching mailing to JSPWiki

Posted by Dave Wolf <da...@gmail.com>.
Shortened the page name to JNDI Mail Configuration.

On Jan 26, 2008 8:38 PM, Dave Wolf <da...@gmail.com> wrote:

> BTW, I've created a page - "Mail Session Configuration And Example" to
> complete my part. I will be adding another issue to update the text within
> the Mail section of the jspwiki.properties file. In my testing tonight, I
> determined that regardless of which method JNDI or stand-alone factory the "
> mail.from" property is required. This is not apparent from the current
> text.
>
> Cheers,
>
> Dave
>
>
> On Jan 26, 2008 7:33 PM, Dave Wolf <da...@gmail.com> wrote:
>
> > Hi,
> >
> > I updated my source from CVS, added the username & password attributes,
> > and it works like a charm!
> >
> > Thank you Florian for tracking this down!
> >
> > On a Workflow process related note, I'd like to propose that we add an
> > enhancement so that when a user is denied access, an email with an
> > explanation is sent. Andrew, would you have any issues with such an
> > enhancement?
> >
> > Thanks all,
> >
> > Dave
> >
> >
> > On Jan 23, 2008 4:35 PM, Florian Holeczek <fl...@holeczek.de> wrote:
> >
> > > Now that I've posted the bug part of the solution to JIRA JSPWIKI-102,
> > > the rest follows here.
> > >
> > > My configuration now is:
> > >
> > > conf/server.xml in section GlobalNamingResources:
> > > ---
> > >    <Resource name="mail/Session" auth="Container"
> > >              type="javax.mail.Session"
> > >              username="xy@somewhere.de"
> > >              password="secret"
> > >              mail.user="xy@somewhere.de"
> > >               mail.password="secret"
> > >              mail.smtp.host="smtp.1und1.de"
> > >              mail.smtp.auth="true"
> > >               mail.smtp.starttls.enable="true"
> > >              description="globale Mailresource für meinen
> > > Tomcat-Server zum Verschicken über 1und1" />
> > > ---
> > > If anything goes wrong, you may want to add a line mail.debug="true"
> > > to this section.
> > > As you see, I'm using an SMTP mail server that requires authentication
> > > and supports TLS. The problem with this configuration is that it won't
> > > work if only the mail.user/password are set. These aren't
> > > automatically used for authentication, so authentication fails (an
> > > AuthenticationFailedException is thrown).
> > > Therefore, you have to set username/password to the same values (or
> > > values that authenticate you properly).
> > > I got this information from here:
> > >
> > > http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166
> > >
> > > Next you have to link this global resource into JSPWiki's Context.
> > > I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6), but
> > > there are several possibilities to do this. Additionally, these differ
> > > in different versions.
> > > ---
> > > <Context path="/jspwiki" debug="false">
> > >
> > >        <ResourceLink name="mail/Session"
> > >                global="mail/Session"
> > >                type="javax.mail.Session" />
> > >
> > > </Context>
> > > ---
> > >
> > > Then you'll have to uncomment the following section in JSPWiki's
> > > web.xml descriptor:
> > > ---
> > >   <resource-ref>
> > >     <description>Resource reference to a container-managed JNDI
> > > JavaMail factory for sending e-mails.</description>
> > >     <res-ref-name>mail/Session</res-ref-name>
> > >     <res-type>javax.mail.Session</res-type>
> > >      <res-auth>Container</res-auth>
> > >   </resource-ref>
> > > ---
> > >
> > > If your mail factory's resource name differs from "mail/Session",
> > > you'll have to set this name in jspwiki.properties:
> > > ---
> > > jspwiki.mail.jndiname=mail/Session
> > > ---
> > >
> > > As Dave already mentioned, depending on your configuration you may
> > > have to delete JSPWiki's activation.jar and mail.jar.
> > > activation.jar isn't needed if your servlet container runs with Java
> > > 1.6+. mail.jar isn't needed if it's already contained in the servlet
> > > container's library path.
> > >
> > > Dave, please give it another try with these hints. I'm quite sure it
> > > will work :-)
> > > Then, we can publish this on some wiki page.
> > > Janne, where to put it?
> > >
> > > Regards,
> > >  Florian
> > >
> > >
> >
> >
> > --
> > Dave Wolf
> > H: 303-377-9537
> > M: 303-956-9106
> >
> > "Our lives begin to end the day we become silent about things that
> > matter." --Dr. Martin Luther King Jr.
> >
>
>
>
> --
> Dave Wolf
> H: 303-377-9537
> M: 303-956-9106
>
> "Our lives begin to end the day we become silent about things that
> matter." --Dr. Martin Luther King Jr.
>



-- 
Dave Wolf
H: 303-377-9537
M: 303-956-9106

"Our lives begin to end the day we become silent about things that matter."
--Dr. Martin Luther King Jr.

Re: teaching mailing to JSPWiki

Posted by Florian Holeczek <fl...@holeczek.de>.
I've created a JIRA entry on this issue.

Regards,
 Florian

Ursprüngliche Nachricht vom 27.01.2008 um 10:34:
> Hallo Dave,

>> BTW, I've created a page - "Mail Session Configuration And Example"
>> to complete my part. I will be adding another issue to update the
>> text within the Mail section of the jspwiki.properties file. In my
>> testing tonight, I determined that regardless of which method JNDI
>> or stand-alone factory the "mail.from" property is required. This is
>> not apparent from the current text.

> that's true! Even worse is that it seems as if a NullPointerException
> is thrown in case this property is commented out. Aren't there
> internal default properties?

> Regards,
>  Florian


Re: teaching mailing to JSPWiki

Posted by Janne Jalkanen <Ja...@ecyrd.com>.
> that's true! Even worse is that it seems as if a NullPointerException
> is thrown in case this property is commented out. Aren't there
> internal default properties?

Sometimes yes and sometimes no.  Depends on the property.

However, there should never be an NPE because of a missing property -  
there should be either a default or a NoRequiredPropertyException.

/Janne

Re: teaching mailing to JSPWiki

Posted by Florian Holeczek <fl...@holeczek.de>.
I've created a JIRA entry on this issue.

Regards,
 Florian

Ursprüngliche Nachricht vom 27.01.2008 um 10:34:
> Hallo Dave,

>> BTW, I've created a page - "Mail Session Configuration And Example"
>> to complete my part. I will be adding another issue to update the
>> text within the Mail section of the jspwiki.properties file. In my
>> testing tonight, I determined that regardless of which method JNDI
>> or stand-alone factory the "mail.from" property is required. This is
>> not apparent from the current text.

> that's true! Even worse is that it seems as if a NullPointerException
> is thrown in case this property is commented out. Aren't there
> internal default properties?

> Regards,
>  Florian


Re: teaching mailing to JSPWiki

Posted by Florian Holeczek <fl...@holeczek.de>.
Hallo Dave,

> BTW, I've created a page - "Mail Session Configuration And Example"
> to complete my part. I will be adding another issue to update the
> text within the Mail section of the jspwiki.properties file. In my
> testing tonight, I determined that regardless of which method JNDI
> or stand-alone factory the "mail.from" property is required. This is
> not apparent from the current text.

that's true! Even worse is that it seems as if a NullPointerException
is thrown in case this property is commented out. Aren't there
internal default properties?

Regards,
 Florian


Re: teaching mailing to JSPWiki

Posted by Dave Wolf <da...@gmail.com>.
BTW, I've created a page - "Mail Session Configuration And Example" to
complete my part. I will be adding another issue to update the text within
the Mail section of the jspwiki.properties file. In my testing tonight, I
determined that regardless of which method JNDI or stand-alone factory the "
mail.from" property is required. This is not apparent from the current text.

Cheers,

Dave

On Jan 26, 2008 7:33 PM, Dave Wolf <da...@gmail.com> wrote:

> Hi,
>
> I updated my source from CVS, added the username & password attributes,
> and it works like a charm!
>
> Thank you Florian for tracking this down!
>
> On a Workflow process related note, I'd like to propose that we add an
> enhancement so that when a user is denied access, an email with an
> explanation is sent. Andrew, would you have any issues with such an
> enhancement?
>
> Thanks all,
>
> Dave
>
>
> On Jan 23, 2008 4:35 PM, Florian Holeczek <fl...@holeczek.de> wrote:
>
> > Now that I've posted the bug part of the solution to JIRA JSPWIKI-102,
> > the rest follows here.
> >
> > My configuration now is:
> >
> > conf/server.xml in section GlobalNamingResources:
> > ---
> >    <Resource name="mail/Session" auth="Container"
> >              type="javax.mail.Session"
> >              username="xy@somewhere.de"
> >              password="secret"
> >              mail.user="xy@somewhere.de"
> >               mail.password="secret"
> >              mail.smtp.host="smtp.1und1.de"
> >              mail.smtp.auth="true"
> >               mail.smtp.starttls.enable="true"
> >              description="globale Mailresource für meinen Tomcat-Server
> > zum Verschicken über 1und1" />
> > ---
> > If anything goes wrong, you may want to add a line mail.debug="true"
> > to this section.
> > As you see, I'm using an SMTP mail server that requires authentication
> > and supports TLS. The problem with this configuration is that it won't
> > work if only the mail.user/password are set. These aren't
> > automatically used for authentication, so authentication fails (an
> > AuthenticationFailedException is thrown).
> > Therefore, you have to set username/password to the same values (or
> > values that authenticate you properly).
> > I got this information from here:
> > http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166
> >
> > Next you have to link this global resource into JSPWiki's Context.
> > I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6), but
> > there are several possibilities to do this. Additionally, these differ
> > in different versions.
> > ---
> > <Context path="/jspwiki" debug="false">
> >
> >        <ResourceLink name="mail/Session"
> >                global="mail/Session"
> >                type="javax.mail.Session" />
> >
> > </Context>
> > ---
> >
> > Then you'll have to uncomment the following section in JSPWiki's
> > web.xml descriptor:
> > ---
> >   <resource-ref>
> >     <description>Resource reference to a container-managed JNDI JavaMail
> > factory for sending e-mails.</description>
> >     <res-ref-name>mail/Session</res-ref-name>
> >     <res-type>javax.mail.Session</res-type>
> >      <res-auth>Container</res-auth>
> >   </resource-ref>
> > ---
> >
> > If your mail factory's resource name differs from "mail/Session",
> > you'll have to set this name in jspwiki.properties:
> > ---
> > jspwiki.mail.jndiname=mail/Session
> > ---
> >
> > As Dave already mentioned, depending on your configuration you may
> > have to delete JSPWiki's activation.jar and mail.jar.
> > activation.jar isn't needed if your servlet container runs with Java
> > 1.6+. mail.jar isn't needed if it's already contained in the servlet
> > container's library path.
> >
> > Dave, please give it another try with these hints. I'm quite sure it
> > will work :-)
> > Then, we can publish this on some wiki page.
> > Janne, where to put it?
> >
> > Regards,
> >  Florian
> >
> >
>
>
> --
> Dave Wolf
> H: 303-377-9537
> M: 303-956-9106
>
> "Our lives begin to end the day we become silent about things that
> matter." --Dr. Martin Luther King Jr.
>



-- 
Dave Wolf
H: 303-377-9537
M: 303-956-9106

"Our lives begin to end the day we become silent about things that matter."
--Dr. Martin Luther King Jr.

Re: teaching mailing to JSPWiki

Posted by Andrew Jaquith <an...@mac.com>.
Ah. Yes, that is a very good idea. If you are in a patching mood, we'd  
love to get a patch for this. :)

Andrew

On Jan 26, 2008, at 10:42 PM, Dave Wolf wrote:

> Sorry, that was a bit obscure. I meant the "Approval Required For User
> Profiles" workflow. When the administrator denies the user creation,  
> then
> the user should likely get some sort of account denial message with an
> explanation.
>
> Dave
>
> On Jan 26, 2008 8:35 PM, Andrew Jaquith <an...@mac.com>  
> wrote:
>
>> Dave, glad things are working for you now!
>>
>> Not sure what you mean by your suggestion... denied access to what?
>> Depending on what it is, it's probably a good idea... the workflow
>> package is meant to be used for all sorts of creative things.
>>
>> Andrew
>>
>> On Jan 26, 2008, at 9:33 PM, Dave Wolf wrote:
>>
>>> Hi,
>>>
>>> I updated my source from CVS, added the username & password
>>> attributes, and
>>> it works like a charm!
>>>
>>> Thank you Florian for tracking this down!
>>>
>>> On a Workflow process related note, I'd like to propose that we  
>>> add an
>>> enhancement so that when a user is denied access, an email with an
>>> explanation is sent. Andrew, would you have any issues with such an
>>> enhancement?
>>>
>>> Thanks all,
>>>
>>> Dave
>>>
>>> On Jan 23, 2008 4:35 PM, Florian Holeczek <fl...@holeczek.de>  
>>> wrote:
>>>
>>>> Now that I've posted the bug part of the solution to JIRA
>>>> JSPWIKI-102,
>>>> the rest follows here.
>>>>
>>>> My configuration now is:
>>>>
>>>> conf/server.xml in section GlobalNamingResources:
>>>> ---
>>>>  <Resource name="mail/Session" auth="Container"
>>>>            type="javax.mail.Session"
>>>>            username="xy@somewhere.de"
>>>>            password="secret"
>>>>            mail.user="xy@somewhere.de"
>>>>             mail.password="secret"
>>>>            mail.smtp.host="smtp.1und1.de"
>>>>            mail.smtp.auth="true"
>>>>             mail.smtp.starttls.enable="true"
>>>>            description="globale Mailresource für meinen Tomcat-
>>>> Server
>>>> zum Verschicken über 1und1" />
>>>> ---
>>>> If anything goes wrong, you may want to add a line  
>>>> mail.debug="true"
>>>> to this section.
>>>> As you see, I'm using an SMTP mail server that requires
>>>> authentication
>>>> and supports TLS. The problem with this configuration is that it
>>>> won't
>>>> work if only the mail.user/password are set. These aren't
>>>> automatically used for authentication, so authentication fails (an
>>>> AuthenticationFailedException is thrown).
>>>> Therefore, you have to set username/password to the same values (or
>>>> values that authenticate you properly).
>>>> I got this information from here:
>>>> http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166
>>>>
>>>> Next you have to link this global resource into JSPWiki's Context.
>>>> I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6),  
>>>> but
>>>> there are several possibilities to do this. Additionally, these
>>>> differ
>>>> in different versions.
>>>> ---
>>>> <Context path="/jspwiki" debug="false">
>>>>
>>>>      <ResourceLink name="mail/Session"
>>>>              global="mail/Session"
>>>>              type="javax.mail.Session" />
>>>>
>>>> </Context>
>>>> ---
>>>>
>>>> Then you'll have to uncomment the following section in JSPWiki's
>>>> web.xml descriptor:
>>>> ---
>>>> <resource-ref>
>>>>   <description>Resource reference to a container-managed JNDI
>>>> JavaMail
>>>> factory for sending e-mails.</description>
>>>>   <res-ref-name>mail/Session</res-ref-name>
>>>>   <res-type>javax.mail.Session</res-type>
>>>>    <res-auth>Container</res-auth>
>>>> </resource-ref>
>>>> ---
>>>>
>>>> If your mail factory's resource name differs from "mail/Session",
>>>> you'll have to set this name in jspwiki.properties:
>>>> ---
>>>> jspwiki.mail.jndiname=mail/Session
>>>> ---
>>>>
>>>> As Dave already mentioned, depending on your configuration you may
>>>> have to delete JSPWiki's activation.jar and mail.jar.
>>>> activation.jar isn't needed if your servlet container runs with  
>>>> Java
>>>> 1.6+. mail.jar isn't needed if it's already contained in the  
>>>> servlet
>>>> container's library path.
>>>>
>>>> Dave, please give it another try with these hints. I'm quite sure  
>>>> it
>>>> will work :-)
>>>> Then, we can publish this on some wiki page.
>>>> Janne, where to put it?
>>>>
>>>> Regards,
>>>> Florian
>>>>
>>>>
>>>
>>>
>>> --
>>> Dave Wolf
>>> H: 303-377-9537
>>> M: 303-956-9106
>>>
>>> "Our lives begin to end the day we become silent about things that
>>> matter."
>>> --Dr. Martin Luther King Jr.
>>
>>
>
>
> -- 
> Dave Wolf
> H: 303-377-9537
> M: 303-956-9106
>
> "Our lives begin to end the day we become silent about things that  
> matter."
> --Dr. Martin Luther King Jr.


Re: teaching mailing to JSPWiki

Posted by Dave Wolf <da...@gmail.com>.
Sorry, that was a bit obscure. I meant the "Approval Required For User
Profiles" workflow. When the administrator denies the user creation, then
the user should likely get some sort of account denial message with an
explanation.

Dave

On Jan 26, 2008 8:35 PM, Andrew Jaquith <an...@mac.com> wrote:

> Dave, glad things are working for you now!
>
> Not sure what you mean by your suggestion... denied access to what?
> Depending on what it is, it's probably a good idea... the workflow
> package is meant to be used for all sorts of creative things.
>
> Andrew
>
> On Jan 26, 2008, at 9:33 PM, Dave Wolf wrote:
>
> > Hi,
> >
> > I updated my source from CVS, added the username & password
> > attributes, and
> > it works like a charm!
> >
> > Thank you Florian for tracking this down!
> >
> > On a Workflow process related note, I'd like to propose that we add an
> > enhancement so that when a user is denied access, an email with an
> > explanation is sent. Andrew, would you have any issues with such an
> > enhancement?
> >
> > Thanks all,
> >
> > Dave
> >
> > On Jan 23, 2008 4:35 PM, Florian Holeczek <fl...@holeczek.de> wrote:
> >
> >> Now that I've posted the bug part of the solution to JIRA
> >> JSPWIKI-102,
> >> the rest follows here.
> >>
> >> My configuration now is:
> >>
> >> conf/server.xml in section GlobalNamingResources:
> >> ---
> >>   <Resource name="mail/Session" auth="Container"
> >>             type="javax.mail.Session"
> >>             username="xy@somewhere.de"
> >>             password="secret"
> >>             mail.user="xy@somewhere.de"
> >>              mail.password="secret"
> >>             mail.smtp.host="smtp.1und1.de"
> >>             mail.smtp.auth="true"
> >>              mail.smtp.starttls.enable="true"
> >>             description="globale Mailresource für meinen Tomcat-
> >> Server
> >> zum Verschicken über 1und1" />
> >> ---
> >> If anything goes wrong, you may want to add a line mail.debug="true"
> >> to this section.
> >> As you see, I'm using an SMTP mail server that requires
> >> authentication
> >> and supports TLS. The problem with this configuration is that it
> >> won't
> >> work if only the mail.user/password are set. These aren't
> >> automatically used for authentication, so authentication fails (an
> >> AuthenticationFailedException is thrown).
> >> Therefore, you have to set username/password to the same values (or
> >> values that authenticate you properly).
> >> I got this information from here:
> >> http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166
> >>
> >> Next you have to link this global resource into JSPWiki's Context.
> >> I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6), but
> >> there are several possibilities to do this. Additionally, these
> >> differ
> >> in different versions.
> >> ---
> >> <Context path="/jspwiki" debug="false">
> >>
> >>       <ResourceLink name="mail/Session"
> >>               global="mail/Session"
> >>               type="javax.mail.Session" />
> >>
> >> </Context>
> >> ---
> >>
> >> Then you'll have to uncomment the following section in JSPWiki's
> >> web.xml descriptor:
> >> ---
> >>  <resource-ref>
> >>    <description>Resource reference to a container-managed JNDI
> >> JavaMail
> >> factory for sending e-mails.</description>
> >>    <res-ref-name>mail/Session</res-ref-name>
> >>    <res-type>javax.mail.Session</res-type>
> >>     <res-auth>Container</res-auth>
> >>  </resource-ref>
> >> ---
> >>
> >> If your mail factory's resource name differs from "mail/Session",
> >> you'll have to set this name in jspwiki.properties:
> >> ---
> >> jspwiki.mail.jndiname=mail/Session
> >> ---
> >>
> >> As Dave already mentioned, depending on your configuration you may
> >> have to delete JSPWiki's activation.jar and mail.jar.
> >> activation.jar isn't needed if your servlet container runs with Java
> >> 1.6+. mail.jar isn't needed if it's already contained in the servlet
> >> container's library path.
> >>
> >> Dave, please give it another try with these hints. I'm quite sure it
> >> will work :-)
> >> Then, we can publish this on some wiki page.
> >> Janne, where to put it?
> >>
> >> Regards,
> >> Florian
> >>
> >>
> >
> >
> > --
> > Dave Wolf
> > H: 303-377-9537
> > M: 303-956-9106
> >
> > "Our lives begin to end the day we become silent about things that
> > matter."
> > --Dr. Martin Luther King Jr.
>
>


-- 
Dave Wolf
H: 303-377-9537
M: 303-956-9106

"Our lives begin to end the day we become silent about things that matter."
--Dr. Martin Luther King Jr.

Re: teaching mailing to JSPWiki

Posted by Andrew Jaquith <an...@mac.com>.
Dave, glad things are working for you now!

Not sure what you mean by your suggestion... denied access to what?  
Depending on what it is, it's probably a good idea... the workflow  
package is meant to be used for all sorts of creative things.

Andrew

On Jan 26, 2008, at 9:33 PM, Dave Wolf wrote:

> Hi,
>
> I updated my source from CVS, added the username & password  
> attributes, and
> it works like a charm!
>
> Thank you Florian for tracking this down!
>
> On a Workflow process related note, I'd like to propose that we add an
> enhancement so that when a user is denied access, an email with an
> explanation is sent. Andrew, would you have any issues with such an
> enhancement?
>
> Thanks all,
>
> Dave
>
> On Jan 23, 2008 4:35 PM, Florian Holeczek <fl...@holeczek.de> wrote:
>
>> Now that I've posted the bug part of the solution to JIRA  
>> JSPWIKI-102,
>> the rest follows here.
>>
>> My configuration now is:
>>
>> conf/server.xml in section GlobalNamingResources:
>> ---
>>   <Resource name="mail/Session" auth="Container"
>>             type="javax.mail.Session"
>>             username="xy@somewhere.de"
>>             password="secret"
>>             mail.user="xy@somewhere.de"
>>              mail.password="secret"
>>             mail.smtp.host="smtp.1und1.de"
>>             mail.smtp.auth="true"
>>              mail.smtp.starttls.enable="true"
>>             description="globale Mailresource für meinen Tomcat- 
>> Server
>> zum Verschicken über 1und1" />
>> ---
>> If anything goes wrong, you may want to add a line mail.debug="true"
>> to this section.
>> As you see, I'm using an SMTP mail server that requires  
>> authentication
>> and supports TLS. The problem with this configuration is that it  
>> won't
>> work if only the mail.user/password are set. These aren't
>> automatically used for authentication, so authentication fails (an
>> AuthenticationFailedException is thrown).
>> Therefore, you have to set username/password to the same values (or
>> values that authenticate you properly).
>> I got this information from here:
>> http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166
>>
>> Next you have to link this global resource into JSPWiki's Context.
>> I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6), but
>> there are several possibilities to do this. Additionally, these  
>> differ
>> in different versions.
>> ---
>> <Context path="/jspwiki" debug="false">
>>
>>       <ResourceLink name="mail/Session"
>>               global="mail/Session"
>>               type="javax.mail.Session" />
>>
>> </Context>
>> ---
>>
>> Then you'll have to uncomment the following section in JSPWiki's
>> web.xml descriptor:
>> ---
>>  <resource-ref>
>>    <description>Resource reference to a container-managed JNDI  
>> JavaMail
>> factory for sending e-mails.</description>
>>    <res-ref-name>mail/Session</res-ref-name>
>>    <res-type>javax.mail.Session</res-type>
>>     <res-auth>Container</res-auth>
>>  </resource-ref>
>> ---
>>
>> If your mail factory's resource name differs from "mail/Session",
>> you'll have to set this name in jspwiki.properties:
>> ---
>> jspwiki.mail.jndiname=mail/Session
>> ---
>>
>> As Dave already mentioned, depending on your configuration you may
>> have to delete JSPWiki's activation.jar and mail.jar.
>> activation.jar isn't needed if your servlet container runs with Java
>> 1.6+. mail.jar isn't needed if it's already contained in the servlet
>> container's library path.
>>
>> Dave, please give it another try with these hints. I'm quite sure it
>> will work :-)
>> Then, we can publish this on some wiki page.
>> Janne, where to put it?
>>
>> Regards,
>> Florian
>>
>>
>
>
> -- 
> Dave Wolf
> H: 303-377-9537
> M: 303-956-9106
>
> "Our lives begin to end the day we become silent about things that  
> matter."
> --Dr. Martin Luther King Jr.


Re: teaching mailing to JSPWiki

Posted by Dave Wolf <da...@gmail.com>.
Hi,

I updated my source from CVS, added the username & password attributes, and
it works like a charm!

Thank you Florian for tracking this down!

On a Workflow process related note, I'd like to propose that we add an
enhancement so that when a user is denied access, an email with an
explanation is sent. Andrew, would you have any issues with such an
enhancement?

Thanks all,

Dave

On Jan 23, 2008 4:35 PM, Florian Holeczek <fl...@holeczek.de> wrote:

> Now that I've posted the bug part of the solution to JIRA JSPWIKI-102,
> the rest follows here.
>
> My configuration now is:
>
> conf/server.xml in section GlobalNamingResources:
> ---
>    <Resource name="mail/Session" auth="Container"
>              type="javax.mail.Session"
>              username="xy@somewhere.de"
>              password="secret"
>              mail.user="xy@somewhere.de"
>               mail.password="secret"
>              mail.smtp.host="smtp.1und1.de"
>              mail.smtp.auth="true"
>               mail.smtp.starttls.enable="true"
>              description="globale Mailresource für meinen Tomcat-Server
> zum Verschicken über 1und1" />
> ---
> If anything goes wrong, you may want to add a line mail.debug="true"
> to this section.
> As you see, I'm using an SMTP mail server that requires authentication
> and supports TLS. The problem with this configuration is that it won't
> work if only the mail.user/password are set. These aren't
> automatically used for authentication, so authentication fails (an
> AuthenticationFailedException is thrown).
> Therefore, you have to set username/password to the same values (or
> values that authenticate you properly).
> I got this information from here:
> http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166
>
> Next you have to link this global resource into JSPWiki's Context.
> I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6), but
> there are several possibilities to do this. Additionally, these differ
> in different versions.
> ---
> <Context path="/jspwiki" debug="false">
>
>        <ResourceLink name="mail/Session"
>                global="mail/Session"
>                type="javax.mail.Session" />
>
> </Context>
> ---
>
> Then you'll have to uncomment the following section in JSPWiki's
> web.xml descriptor:
> ---
>   <resource-ref>
>     <description>Resource reference to a container-managed JNDI JavaMail
> factory for sending e-mails.</description>
>     <res-ref-name>mail/Session</res-ref-name>
>     <res-type>javax.mail.Session</res-type>
>      <res-auth>Container</res-auth>
>   </resource-ref>
> ---
>
> If your mail factory's resource name differs from "mail/Session",
> you'll have to set this name in jspwiki.properties:
> ---
> jspwiki.mail.jndiname=mail/Session
> ---
>
> As Dave already mentioned, depending on your configuration you may
> have to delete JSPWiki's activation.jar and mail.jar.
> activation.jar isn't needed if your servlet container runs with Java
> 1.6+. mail.jar isn't needed if it's already contained in the servlet
> container's library path.
>
> Dave, please give it another try with these hints. I'm quite sure it
> will work :-)
> Then, we can publish this on some wiki page.
> Janne, where to put it?
>
> Regards,
>  Florian
>
>


-- 
Dave Wolf
H: 303-377-9537
M: 303-956-9106

"Our lives begin to end the day we become silent about things that matter."
--Dr. Martin Luther King Jr.

Re: teaching mailing to JSPWiki

Posted by Florian Holeczek <fl...@holeczek.de>.
Now that I've posted the bug part of the solution to JIRA JSPWIKI-102,
the rest follows here.

My configuration now is:

conf/server.xml in section GlobalNamingResources:
---
    <Resource name="mail/Session" auth="Container"
              type="javax.mail.Session"
              username="xy@somewhere.de"
              password="secret"
              mail.user="xy@somewhere.de"
              mail.password="secret"
              mail.smtp.host="smtp.1und1.de"
              mail.smtp.auth="true"
              mail.smtp.starttls.enable="true"
              description="globale Mailresource für meinen Tomcat-Server zum Verschicken über 1und1" />
---
If anything goes wrong, you may want to add a line mail.debug="true"
to this section.
As you see, I'm using an SMTP mail server that requires authentication
and supports TLS. The problem with this configuration is that it won't
work if only the mail.user/password are set. These aren't
automatically used for authentication, so authentication fails (an
AuthenticationFailedException is thrown).
Therefore, you have to set username/password to the same values (or
values that authenticate you properly).
I got this information from here:
http://forum.java.sun.com/thread.jspa?threadID=615393&messageID=3422166

Next you have to link this global resource into JSPWiki's Context.
I did this via webapps/<jspwiki>/META-INF/context.xml (Tomcat 6), but
there are several possibilities to do this. Additionally, these differ
in different versions.
---
<Context path="/jspwiki" debug="false">

        <ResourceLink name="mail/Session"
                global="mail/Session"
                type="javax.mail.Session" />

</Context>
---

Then you'll have to uncomment the following section in JSPWiki's
web.xml descriptor:
---
   <resource-ref>
     <description>Resource reference to a container-managed JNDI JavaMail factory for sending e-mails.</description>
     <res-ref-name>mail/Session</res-ref-name>
     <res-type>javax.mail.Session</res-type>
     <res-auth>Container</res-auth>
   </resource-ref>
---

If your mail factory's resource name differs from "mail/Session",
you'll have to set this name in jspwiki.properties:
---
jspwiki.mail.jndiname=mail/Session
---

As Dave already mentioned, depending on your configuration you may
have to delete JSPWiki's activation.jar and mail.jar.
activation.jar isn't needed if your servlet container runs with Java
1.6+. mail.jar isn't needed if it's already contained in the servlet
container's library path.

Dave, please give it another try with these hints. I'm quite sure it
will work :-)
Then, we can publish this on some wiki page.
Janne, where to put it?

Regards,
 Florian


Re: teaching mailing to JSPWiki

Posted by Dave Wolf <da...@gmail.com>.
I would be happy to help document the solution. I can't wait to see what
you've found. This was the only bug preventing me from deploying JSPWiki at
my company's client site and for a non-profit that I help out.

Cheers,

Dave

On Jan 23, 2008 12:37 PM, Florian Holeczek <fl...@holeczek.de> wrote:

> Hi Dave,
>
> thank you very much for your reply. I've been trying a few hours now
> and found the mistakes. My installation is working now!
>
> One of the mistakes is a JSPWiki bug. For now, I believe no one could
> have been using JSPWiki mailing via JNDI as it's been simply logically
> impossible.
>
> Dave, I found your JIRA entry on this issue and will reopen it and
> post the solution as a comment there.
>
> There are a few other hints related to JavaMail in general. Maybe you
> and me could write a bit about this on jspwiki.org?
>
> Regards,
>  Florian
>
>
>


-- 
Dave Wolf
H: 303-377-9537
M: 303-956-9106

"Our lives begin to end the day we become silent about things that matter."
--Dr. Martin Luther King Jr.

Re: teaching mailing to JSPWiki

Posted by Janne Jalkanen <Ja...@ecyrd.com>.
> Dave, I found your JIRA entry on this issue and will reopen it and
> post the solution as a comment there.

Awesome, guys!  Please post the solution to the bug :-)

/Janne

Re: teaching mailing to JSPWiki

Posted by Florian Holeczek <fl...@holeczek.de>.
Hi Dave,

thank you very much for your reply. I've been trying a few hours now
and found the mistakes. My installation is working now!

One of the mistakes is a JSPWiki bug. For now, I believe no one could
have been using JSPWiki mailing via JNDI as it's been simply logically
impossible.

Dave, I found your JIRA entry on this issue and will reopen it and
post the solution as a comment there.

There are a few other hints related to JavaMail in general. Maybe you
and me could write a bit about this on jspwiki.org?

Regards,
 Florian



Re: teaching mailing to JSPWiki

Posted by Dave Wolf <da...@gmail.com>.
Hi Florian,

I've run into the same problem, but I've been assured by Janne that it
works. I've taken a similar approach as you have, but have not yet had
success.

Janne, would it be possible for you to expand on the documentation for
setting up mail? Some examples of the configuration files would be great.

Florian, btw, JRE 1.6 provides the activation jar, so you likely should
remove it from <tomcat home>/lib and remove it from JSPWiki/WEB-INF/lib to
prevent classpath issues, if you're using JRE 1.6.

Regards,

Dave

On Jan 23, 2008 4:41 AM, Florian Holeczek <fl...@holeczek.de> wrote:

> Hi all,
>
> I'm trying to teach mailing to my local JSPWiki on Tomcat 6. Since I'm
> using Apache Roller, too, I'd like to configure a global Mail
> resource.
> My JSPWiki is running with custom authentication via the
> CookieAuthModule.
>
> I added the following code to Tomcat's server.xml
> <GlobalNamingResources> section:
> ---
>    <Resource name="mail/Session" auth="Application"
>              type="javax.mail.Session"
>              mail.user="someuser@holeczek.de"
>              mail.password="secret"
>              mail.smtp.host="smtp.1und1.de"
>              mail.smtp.starttls.enable="true"
>              mail.smtp.auth="true"
>              debug="true"
>              description="some desc." />
> ---
>
> Then I added this jspwiki.xml to Catalina/localhost to map the global
> resource to JSPWiki's Context:
> ---
> <Context path="/jspwiki" debug="0">
>        <ResourceLink
>                name="mail/Session"
>                global="mail/Session"
>                type="javax.mail.Session"
>        />
> </Context>
> ---
>
> The next thing was modifying JSPWiki's web.xml:
> ---
>   <resource-ref>
>     <description>Resource reference to a application-managed JNDI JavaMail
> factory for sending e-mails.</description>
>     <res-ref-name>mail/Session</res-ref-name>
>     <res-type>javax.mail.Session</res-type>
>     <res-auth>Application</res-auth>
>   </resource-ref>
> ---
>
> Well, mailing isn't working :-( I'm not sure if this log entry is
> related to this issue:
> 23.01.2008 12:16:28 org.apache.catalina.core.ApplicationContext log
> INFO: No jspwiki.propertyfile defined for this context, using default from
> /WEB-INF/jspwiki.properties
>
> JSPWiki's log tells me that it falls back to its own settings. BTW,
> when commenting out all custom mail settings, the log simply contains
> a NullPointerException at this place.
>
> I'm new to all this JNDI, JEE a.s.o. stuff and maybe I'm doing a basic
> mistake?
>
> Would appreciate any help!
>
> Regards,
>  Florian
>
>


-- 
Dave Wolf
H: 303-377-9537
M: 303-956-9106

"Our lives begin to end the day we become silent about things that matter."
--Dr. Martin Luther King Jr.