Greetings-
I am need to upgrade an installation of XWiki from 1.2.2 to the latest (currently 1.6.1) and I am trying to put together an attack plan. Should I attempt an upgrade all the way to 1.6.1 in one fell swoop or should I upgrade to 1.3.2 -> 1.4.1 ...etc. Do I need to upgrade the XAR for every release or just once?
I am using hsqldb as my database, but after getting everything upgraded correctly, I will be moving the database to MySQL.
I have searched the archives but I haven't found anything more recent and also dealing with wide range of upgrading I need to do.
Regards
_________________________________________________________________
Get more done, have more fun, and stay more connected with Windows Mobile®.
http://clk.atdmt.com/MRT/go/119642556/direct/01/
I tried changing newdoc.getAttachments() to
newdoc.newDocument(context).getAttachmentList().
I've stripped down the class to remove dependance on getting values
out of the context; i.e I've provided string literals for sender, cc,
etc. I've also changed the rule to DocChangeRule(this), and removed
the test for the change coming from a space's Blog so that any
document save event would trigger email.
Still no joy.
The only clue in the log is when calling the notify method from a
velocity script:
[WARNING] Cannot retrieve method notify from object of class
BlogMailNotificationGroovyClass due to security restrictions.
Dan
Here's the revised class:
/* Groovy Class #* */
import com.xpn.xwiki.api.XWiki;
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface;
import com.xpn.xwiki.notify.DocObjectChangedRule;
import com.xpn.xwiki.notify.XWikiNotificationRule;
import com.xpn.xwiki.doc.XWikiDocument;
public class BlogMailNotificationGroovyClass implements \
XWikiDocChangeNotificationInterface
{
def xwiki;
def rule;
def name;
public void initClasses(XWikiContext context)
{
this.xwiki = context.getWiki();
// listen to notifications
this.rule = DocChangeRule(this);
context.getWiki().getNotificationManager().addGeneralRule(rule);
}
public void notify(XWikiNotificationRule rule, XWikiDocument
newdoc, \
XWikiDocument olddoc, int event, XWikiContext
context)
{
def ms = xwiki.getPlugin("mailsender");
def nb = ms.sendHtmlMessage("XWiki.Admin", \
"dsvoboda(a)structbio.pitt.edu", \
"dsvoboda(a)structbio.pitt.edu", \
"dsvoboda(a)structbio.pitt.edu", \
"subject", \
newdoc.getRenderedContent(), \
newdoc.getContent(), \
newdoc.newDocument(context).getAttachmentList());
}
}
/* *# */
> Ok, I have another idea. Did you try sending the mail without
> attachments ?
>
> This because what you pass the plugin API are XWikiAttachments
> (http://maven.xwiki.org/site/xwiki-core-parent/xwiki-core/apidocs/com/xpn/xw…
> ),
> while it expects "com.xpn.xwiki.api.Attachment" (see the plugin API
> here
> http://code.xwiki.org/xwiki/bin/view/Plugins/MailSenderPlugin).
> If you want to have the proper wrapped attachments to pass the plugin,
> you should use "newdoc.newDocument(context).getAttachmentList()"
>
> Hope this helps,
> Jerome.
>
> Daniel Svoboda wrote:
>> Thanks for the replies.
>>
>> I had already found that bug. If I take the conditional completely
>> out
>> of the class, it still doesn't send an email.
>>
>> Dan
>>
>>> It is probably due to the following :
>>>
>>> "if(newdoc.getSpace().substring(lastFour) == "Blog") {"
>>>
>>> in Java, if you have the following :
>>>
>>> String st1 = "Blog";
>>> String st2 = new String("Blog");
>>>
>>> then st1 == st2 will always return false, as the objects are not the
>>> same. What you want is to compare their values, using
>>> st1.equals(st2),
>>> which will return true.
>>> You can read here to find out more
>>> http://www.unix.com.ua/orelly/java/langref/ch04_09.htm (especially
>>> this
>>> sentence : "Because the == operator determines if two objects are
>>> the
>>> same object, it is not appropriate for comparisons that need to
>>> determine if two objects have the same contents. For example, if you
>>> need to know whether two String objects contain the same sequences
>>> of
>>> characters, the == operator is inappropriate. You should use the
>>> equals() method")
>>>
>>> Anyway, their is even simpler for you. What you want to do is
>>> check if
>>> the space name finishes by "Blog". For this the appropriate method
>>> is
>>> String#endsWith
>>> (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#endsWith(java…
>>> )
>>> )
>>> As in :
>>>
>>> "if(newdoc.getSpace().endsWith("Blog")) {"
>>>
>>> Hope this helps and fixes your issue,
>>>
>>> Regards,
>>> Jerome
>>>
>>> Daniel Svoboda wrote:
>>>> Yes. The problem is that no mail gets sent, which is the purpose of
>>>> the notification. I reread my initial post, and now I understand
>>>> your
>>>> confusion. I didn't explicitly state that the class wasn't working.
>>>>
>>>> I'm using XWiki Enterprise manager 1.3 with platform version 1.5.2.
>>>>
>>>> Dan
>>>>
>>>>
>>>>> Do you actually encounter a problem, besides the error in the
>>>>> logs ?
>>>>> I believe those logs are generated when you call
>>>>> getRenderedContent on
>>>>> your blog article, so I maintain they have nothing to do with your
>>>>> notification class.
>>>>> Which version of XWiki Enterprise are you using ?
>>>>>
>>>>> Jerome.
>>>>>
>>>>> Dan Svoboda wrote:
>>>>>> Hi,
>>>>>>
>>>>>> See below
>>>>>>
>>>>>> Dan Svoboda wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm trying to use the notification system to trigger the
>>>>>>>> sending of
>>>>>>>> email whenever a comment is added to a blog article. I'm
>>>>>>>> patterning my
>>>>>>>> groovy class after the pircbot example on the xwiki snippets
>>>>>>>> site.
>>>>>>>>
>>>>>>>> My system is xwiki workspaces as a virtual xwiki under xem. The
>>>>>>>> platform version is 1.5.2.
>>>>>>>>
>>>>>>>> Here's my groovy class
>>>>>>>> (XWSNotify.BlogMailNotificationGroovyClass):
>>>>>>>>
>>>>>>>> /* Groovy Class #* */
>>>>>>>>
>>>>>>>> import com.xpn.xwiki.api.XWiki;
>>>>>>>> import com.xpn.xwiki.XWikiContext;
>>>>>>>> import
>>>>>>>> com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface;
>>>>>>>> import com.xpn.xwiki.notify.DocObjectChangedRule;
>>>>>>>> import com.xpn.xwiki.notify.XWikiNotificationRule;
>>>>>>>> import com.xpn.xwiki.doc.XWikiDocument;
>>>>>>>>
>>>>>>>> public class BlogMailNotificationGroovyClass implements \
>>>>>>>>
>>>>>>>> XWikiDocChangeNotificationInterface
>>>>>>>>
>>>>>>>> {
>>>>>>>> def xwiki;
>>>>>>>> def rule;
>>>>>>>> def name;
>>>>>>>>
>>>>>>>> public void initClasses(XWikiContext context)
>>>>>>>> {
>>>>>>>> this.xwiki = context.getWiki();
>>>>>>>> // listen to notifications
>>>>>>>> this.rule = DocObjectChangedRule(this);
>>>>>>>>
>>>>>>>> context
>>>>>>>> .getWiki().getNotificationManager().addGeneralRule(rule);
>>>>>>>> }
>>>>>>>>
>>>>>>>> public void notify(XWikiNotificationRule rule, XWikiDocument
>>>>>>>> newdoc, \
>>>>>>>> XWikiDocument olddoc, int event,
>>>>>>>> XWikiContext
>>>>>>>> context)
>>>>>>>> {
>>>>>>>> def length = newdoc.getSpace().length();
>>>>>>>> def lastFour = length - 4;
>>>>>>>> if(newdoc.getSpace().substring(lastFour) == "Blog") {
>>>>>>>>
>>>>>>>> def ms = xwiki.getPlugin("mailsender");
>>>>>>>> def nb = ms.sendHtmlMessage(context.getUser(),
>>>>>>>> "myAddress(a)myHost.org <mailto:myAddress@myHost.org>
>>>>>>>> ", \
>>>>>>>> context.get("ccrecipients"),
>>>>>>>> context.get("bccrecipients"), \
>>>>>>>> context.get("subject"),
>>>>>>>> newdoc.getRenderedContent(), \
>>>>>>>> newdoc.getContent(),
>>>>>>>> newdoc.getAttachments());
>>>>>>>> }
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> /* *# */
>>>>>>>>
>>>>>>>> Here's a velocity script I'm using to initialize/test:
>>>>>>>>
>>>>>>>> #set($sc =
>>>>>>>> $context.getContext().getEngineContext().getServletContext())
>>>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>>> #set($blgmlnotif =
>>>>>>>> $
>>>>>>>> xwiki
>>>>>>>> .parseGroovyFromPage
>>>>>>>> ("XWSNotify.BlogMailNotificationGroovyClass"))
>>>>>>>> #set($ok = $sc.setAttribute("blgmailnotif", $blgmlnotif))
>>>>>>>> #set($blgmailnotif = $sc.getAttribute("blgmailnotif"))
>>>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>>> #set($ok = $blgmlnotif.initClasses($context))
>>>>>>>> #set($ok = $blgmlnotif.notify($blgmlnotif.rule,$newdoc,$newdoc,
>>>>>>>> 3,$context))
>>>>>>>>
>>>>>>>> Here's the output from the velocity script:
>>>>>>>>
>>>>>>>> BlogMailNotificationGroovyClass@68e4a47
>>>>>>>> BlogMailNotificationGroovyClass@3c401d45
>>>>>>>>
>>>>>>>> So, the groovy class gets initialized to a new reference
>>>>>>>> successfully
>>>>>>>> each time parseGroovyFromPage is called.
>>>>>>>>
>>>>>>>> Here's what appears in the log after running the velocity
>>>>>>>> script:
>>>>>>>>
>>>>>>>> [ERROR] Left side ($request.title) of '!=' operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 53, column 43]
>>>>>>>> [WARNING] Cannot retrieve method notify from object of class
>>>>>>>> BlogMailNotificationGroovyClass due to security restrictions.
>>>>>>>>
>>>>>>>> If I alter the velocity script to:
>>>>>>>>
>>>>>>>> #set($sc =
>>>>>>>> $context.getContext().getEngineContext().getServletContext())
>>>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>>>
>>>>>>>> Here's what appears in the log:
>>>>>>>>
>>>>>>>> [ERROR] Left side ($request.title) of '!=' operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 53, column 43]
>>>>>>>>
>>>>>>>> So, the [WARNING] is the only log entry pertaining to the
>>>>>>>> groovy
>>>>>>>> class.
>>>>>>>>
>>>>>>>> If I add a comment to a Blog article (with or without the
>>>>>>>> BlogMailNotificationGroovyClass initialized), the following
>>>>>>>> appears in
>>>>>>>> the log:
>>>>>>>>
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>> value.
>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>
>>>>>>>> The number of lines corresponds to the number of comments
>>>>>>>> present
>>>>>>>> in
>>>>>>>> the Blog article. There's nothing in the log pertaining to the
>>>>>>>> groovy
>>>>>>>> class.
>>>>>>> Indeed, this has nothing to do with your groovy notification.
>>>>>>> This
>>>>>>> is
>>>>>>> generated by the velocity engine.
>>>>>>> Is your skin customized ? Is the blog application modified ?
>>>>>>> (The
>>>>>>> log
>>>>>>> says that somewhere a variable $index is trying to add something
>>>>>>> to
>>>>>>> "null". Might be the pagination of blog articles ?)
>>>>>>>
>>>>>>> Jerome.
>>>>>> I can't find a variable $index in any arithmetical expression in
>>>>>> any
>>>>>> velocity script anywhere on the site.
>>>>>>
>>>>>> The skin is customized only to the extent of some inconsequential
>>>>>> tweaks. Same with blog app.
>>>>>>
>>>>>> There's no pagination of blog articles.
>>>>>>
>>>>>> Would someone please review the basic mechanics of how groovy
>>>>>> classes
>>>>>> work, particularly as it pertains to my notification class?
>>>>>>
>>>>>> Also, I see by reading source that there's a newer way of
>>>>>> monitoring
>>>>>> events through the "observation manager". Would someone please
>>>>>> review
>>>>>> how to use this system?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Dan
Since 1.6 creating headings in the old WYSIWYG-Editor creats html-Headings
Heading 1 -> <h1>Text</h1>
Heading 2 -> <h2>Text</h2>
....
The result is that some functions (e.g. Toc macro) don't work anymore.
Is it planned to fix that? or is there no more development for the old
WYSIWYG?
The new looks great but has not the functionality of the old one (yet?)
Thanks
Helmut
--
View this message in context: http://n2.nabble.com/Headings-in-old-WYSIWYG-and-some-more-questions-tp1575…
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi,
I'm using JBoss (4.2.1), XWiki XE 1.7 Milestone 1.
Which parameters are to be set or which files have to be modified/moved to
prevent the following DEBUG and ERROR messages?
No matter whether xwiki.cfg file has
xwiki.cache.cachefactory.hint=jbosscache and
xwiki.cache.cachefactory.local.hint=jbosscache/local as comment or not,
there is a DEBUG message on console saying
"Failed to load configuration file xwiki.store.pagecache".
There's a second DEBUG message saying "Failed to load configuration file
default".
I realized this after deletion of log4j-1.2.13.jar in lib folder.
The real problem seems to be that there is an error later with lucene:
ERROR [com.xpn.xwiki.plugin.lucene.IndexUpdater] error indexing document
xwiki:XWiki.420127.default.objects
com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while
reading document XWiki.420127
(The number is a XWiki "username".)
Logging is very high. It's showing a lot of debug and error messages
relating caching.
Thanks,
Rudolf
Each stack traces are there a lot of times. Stack Details:
1) as first
2008-11-13 00:00:00,015 ERROR [org.quartz.core.QuartzSchedulerThread]
Runtime error occured in main trigger firing loop.
java.lang.NullPointerException
at
org.apache.commons.logging.LogFactory.getCachedFactory(LogFactory.java:979)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:435)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at org.quartz.core.JobRunShell.<init>(JobRunShell.java:80)
at
org.quartz.impl.StdJobRunShellFactory.borrowJobRunShell(StdJobRunShellFactory.java:86)
at
org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:357)
2) a bit later
2008-11-13 05:10:00,888 INFO
[org.xwiki.cache.jbosscache.internal.JBossCacheCacheFactory] Start JBoss
cache initialisation
2008-11-13 05:10:00,904 DEBUG
[org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration] Failed to
load configuration file xwiki.groovy.content
org.xwiki.cache.jbosscache.internal.PropertiesLoadingCacheException: Can't
find any configuration file forxwiki.groovy.content
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.loadConfig(JBossCacheCacheConfiguration.java:245)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.load(JBossCacheCacheConfiguration.java:115)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.<init>(JBossCacheCacheConfiguration.java:99)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheFactory.newCache(JBossCacheCacheFactory.java:78)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.initCache(XWikiGroovyRenderer.java:133)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.initCache(XWikiGroovyRenderer.java:121)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.prepareCache(XWikiGroovyRenderer.java:152)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.parseGroovyFromString(XWikiGroovyRenderer.java:333)
at com.xpn.xwiki.XWiki.parseGroovyFromString(XWiki.java:5698)
at com.xpn.xwiki.api.XWiki.parseGroovyFromPage(XWiki.java:2169)
at gjdk.com.xpn.xwiki.api.XWiki_GroovyReflector.invoke(Unknown Source)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:111)
at
org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:657)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:363)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:146)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
at Script1.run(Script1.groovy:8)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:485)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:460)
at com.xpn.xwiki.plugin.scheduler.GroovyJob.execute(GroovyJob.java:83)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
2008-11-13 05:10:00,904 DEBUG
[org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration] Failed to
load configuration file default-local
org.xwiki.cache.jbosscache.internal.PropertiesLoadingCacheException: Can't
find any configuration file fordefault-local
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.loadConfig(JBossCacheCacheConfiguration.java:245)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.getDefaultConfig(JBossCacheCacheConfiguration.java:216)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.load(JBossCacheCacheConfiguration.java:118)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheConfiguration.<init>(JBossCacheCacheConfiguration.java:99)
at
org.xwiki.cache.jbosscache.internal.JBossCacheCacheFactory.newCache(JBossCacheCacheFactory.java:78)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.initCache(XWikiGroovyRenderer.java:133)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.initCache(XWikiGroovyRenderer.java:121)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.prepareCache(XWikiGroovyRenderer.java:152)
at
com.xpn.xwiki.render.groovy.XWikiGroovyRenderer.parseGroovyFromString(XWikiGroovyRenderer.java:333)
at com.xpn.xwiki.XWiki.parseGroovyFromString(XWiki.java:5698)
at com.xpn.xwiki.api.XWiki.parseGroovyFromPage(XWiki.java:2169)
at gjdk.com.xpn.xwiki.api.XWiki_GroovyReflector.invoke(Unknown Source)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:111)
at
org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:657)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:363)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:146)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
at Script1.run(Script1.groovy:8)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:485)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:460)
at com.xpn.xwiki.plugin.scheduler.GroovyJob.execute(GroovyJob.java:83)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
2008-11-13 05:10:00,919 INFO [org.jboss.cache.factories.ComponentRegistry]
JBoss Cache version: JBossCache 'Poblano' 2.2.0.GA
2008-11-13 05:10:00,919 INFO
[org.xwiki.cache.jbosscache.internal.JBossCacheCacheFactory] End JBoss cache
initialisation
3) at least each hour
2008-11-13 05:13:05,559 ERROR [com.xpn.xwiki.plugin.lucene.IndexUpdater]
error indexing document xwiki:XWiki.420127.default.objects
com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while
reading document XWiki.420127
Wrapped Exception: Entry.next=null, data[removeIndex]=XWiki.545365=<?xml
version="1.0" encoding="UTF-8"?>
<class>
<name>XWiki.545365</name>
<customClass></customClass>
<customMapping></customMapping>
<defaultViewSheet></defaultViewSheet>
<defaultEditSheet></defaultEditSheet>
<defaultWeb></defaultWeb>
<nameField></nameField>
<validationScript></validationScript>
</class>
previous=XWiki.420762=<?xml version="1.0" encoding="UTF-8"?>
<class>
<name>XWiki.420762</name>
<customClass></customClass>
<customMapping></customMapping>
<defaultViewSheet></defaultViewSheet>
<defaultEditSheet></defaultEditSheet>
<defaultWeb></defaultWeb>
<nameField></nameField>
<validationScript></validationScript>
</class>
key=XWiki.420127 value=<?xml version="1.0" encoding="UTF-8"?>
<class>
<name>XWiki.420127</name>
<customClass></customClass>
<customMapping></customMapping>
<defaultViewSheet></defaultViewSheet>
<defaultEditSheet></defaultEditSheet>
<defaultWeb></defaultWeb>
<nameField></nameField>
<validationScript></validationScript>
</class>
size=20 maxSize=20 Please check that your keys are immutable, and that you
have used synchronization properly. If so, then please report this to
commons-dev(a)jakarta.apache.org as a bug.
at
com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:744)
at
com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:209)
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1323)
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1363)
at
com.xpn.xwiki.plugin.lucene.IndexUpdater.runMainLoop(IndexUpdater.java:217)
at com.xpn.xwiki.plugin.lucene.IndexUpdater.run(IndexUpdater.java:117)
at java.lang.Thread.run(Thread.java:619)
--
View this message in context: http://n2.nabble.com/JBossCacheCacheConfiguration-Failed-to-load-configurat…
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi,
I have done an upgrade (WAR and XAR) today from XE 1.6.1 to 1.7.3 with lots
of issues with LDAP.
1. Get a lot of the following errors even when users are just browsing
without loggin
[https://myserver/xwiki/bin/view/Main/?xpage=xpart&vm=commentsinline.vm]
[TP-Processor1] DEBUG LDAP.XWikiLDAPAuthServiceImpl - LDAP authentication
failed: login null
2. User mapping to Group member ship has issue. (this is more serious)
It used to map OK but currently, after a new user first login, it added the
user in this format "XWiki.XWiki.<USERID>" into the group multiple times.
When user loggedin and browse, it add even more multiple entries. So a user
login for the first time and browse 2 pages, could end up having 10 idential
entries in the group.
Normally it added in the format "XWiki.<USERID>" not "XWiki.XWiki.<USERID>".
3. After a user loggin, browsing, I saw lots of these errors
[TP-Processor8] ERROR LDAP.XWikiLDAPAuthServiceImpl - Failed to add a user
[XWiki.USERID] to a group [XWiki.MYGROUP]
com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving
document XWiki.MYGROUP
Wrapped Exception: Batch update returned unexpected row count from update
[1]; actual row count: 0; expected: 1
at
com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:590)
at
com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:135)
at
com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:128)
at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1270)
and
[TP-Processor2] DEBUG LDAP.XWikiLDAPAuthServiceImpl - Local LDAP
authentication failed.
java.lang.NullPointerException
at
com.xpn.xwiki.user.impl.LDAP.XWikiLDAPAuthServiceImpl.ldapAuthenticateInContext(XWikiLDAPAuthServiceImpl.java:369)
at
com.xpn.xwiki.user.impl.LDAP.XWikiLDAPAuthServiceImpl.ldapAuthenticate(XWikiLDAPAuthServiceImpl.java:197)
at
com.xpn.xwiki.user.impl.LDAP.XWikiLDAPAuthServiceImpl.authenticate(XWikiLDAPAuthServiceImpl.java:148)
at
com.xpn.xwiki.user.impl.xwiki.MyFormAuthenticator.authenticate(MyFormAuthenticator.java:239)
Any thoughts please?
I do need to upgrade in order to fix the upload image with space in the
filename issue.
Appreciated, and Thanks!
--
View this message in context: http://n2.nabble.com/LDAP-issue-after-upgrade-from-XE-1.6.1-to-1.7.3-tp1573…
Sent from the XWiki- Users mailing list archive at Nabble.com.
I found something else that was incorrect, but correcting it didn't
help:
newdoc.getRenderedContent() needs to be
newdoc.getRenderedContent(context)
Dan
> I tried changing newdoc.getAttachments() to
> newdoc.newDocument(context).getAttachmentList().
>
> I've stripped down the class to remove dependance on getting values
> out of the context; i.e I've provided string literals for sender,
> cc, etc. I've also changed the rule to DocChangeRule(this), and
> removed the test for the change coming from a space's Blog so that
> any document save event would trigger email.
>
> Still no joy.
>
> The only clue in the log is when calling the notify method from a
> velocity script:
>
> [WARNING] Cannot retrieve method notify from object of class
> BlogMailNotificationGroovyClass due to security restrictions.
>
> Dan
>
> Here's the revised class:
>
> /* Groovy Class #* */
>
> import com.xpn.xwiki.api.XWiki;
> import com.xpn.xwiki.XWikiContext;
> import com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface;
> import com.xpn.xwiki.notify.DocObjectChangedRule;
> import com.xpn.xwiki.notify.XWikiNotificationRule;
> import com.xpn.xwiki.doc.XWikiDocument;
>
> public class BlogMailNotificationGroovyClass implements \
>
> XWikiDocChangeNotificationInterface
>
> {
> def xwiki;
> def rule;
> def name;
>
> public void initClasses(XWikiContext context)
> {
> this.xwiki = context.getWiki();
> // listen to notifications
> this.rule = DocChangeRule(this);
>
> context.getWiki().getNotificationManager().addGeneralRule(rule);
> }
>
> public void notify(XWikiNotificationRule rule, XWikiDocument
> newdoc, \
> XWikiDocument olddoc, int event, XWikiContext
> context)
> {
>
> def ms = xwiki.getPlugin("mailsender");
> def nb = ms.sendHtmlMessage("XWiki.Admin", \
> "dsvoboda(a)structbio.pitt.edu", \
> "dsvoboda(a)structbio.pitt.edu", \
> "dsvoboda(a)structbio.pitt.edu", \
> "subject", \
> newdoc.getRenderedContent(), \
> newdoc.getContent(), \
>
> newdoc.newDocument(context).getAttachmentList());
> }
> }
>
> /* *# */
>
>
>
>> Ok, I have another idea. Did you try sending the mail without
>> attachments ?
>>
>> This because what you pass the plugin API are XWikiAttachments
>> (http://maven.xwiki.org/site/xwiki-core-parent/xwiki-core/apidocs/com/xpn/xw…
>> ),
>> while it expects "com.xpn.xwiki.api.Attachment" (see the plugin API
>> here
>> http://code.xwiki.org/xwiki/bin/view/Plugins/MailSenderPlugin).
>> If you want to have the proper wrapped attachments to pass the
>> plugin,
>> you should use "newdoc.newDocument(context).getAttachmentList()"
>>
>> Hope this helps,
>> Jerome.
>>
>> Daniel Svoboda wrote:
>>> Thanks for the replies.
>>>
>>> I had already found that bug. If I take the conditional completely
>>> out
>>> of the class, it still doesn't send an email.
>>>
>>> Dan
>>>
>>>> It is probably due to the following :
>>>>
>>>> "if(newdoc.getSpace().substring(lastFour) == "Blog") {"
>>>>
>>>> in Java, if you have the following :
>>>>
>>>> String st1 = "Blog";
>>>> String st2 = new String("Blog");
>>>>
>>>> then st1 == st2 will always return false, as the objects are not
>>>> the
>>>> same. What you want is to compare their values, using
>>>> st1.equals(st2),
>>>> which will return true.
>>>> You can read here to find out more
>>>> http://www.unix.com.ua/orelly/java/langref/ch04_09.htm (especially
>>>> this
>>>> sentence : "Because the == operator determines if two objects are
>>>> the
>>>> same object, it is not appropriate for comparisons that need to
>>>> determine if two objects have the same contents. For example, if
>>>> you
>>>> need to know whether two String objects contain the same
>>>> sequences of
>>>> characters, the == operator is inappropriate. You should use the
>>>> equals() method")
>>>>
>>>> Anyway, their is even simpler for you. What you want to do is
>>>> check if
>>>> the space name finishes by "Blog". For this the appropriate
>>>> method is
>>>> String#endsWith
>>>> (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#endsWith(java…
>>>> )
>>>> )
>>>> As in :
>>>>
>>>> "if(newdoc.getSpace().endsWith("Blog")) {"
>>>>
>>>> Hope this helps and fixes your issue,
>>>>
>>>> Regards,
>>>> Jerome
>>>>
>>>> Daniel Svoboda wrote:
>>>>> Yes. The problem is that no mail gets sent, which is the purpose
>>>>> of
>>>>> the notification. I reread my initial post, and now I understand
>>>>> your
>>>>> confusion. I didn't explicitly state that the class wasn't
>>>>> working.
>>>>>
>>>>> I'm using XWiki Enterprise manager 1.3 with platform version
>>>>> 1.5.2.
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>>> Do you actually encounter a problem, besides the error in the
>>>>>> logs ?
>>>>>> I believe those logs are generated when you call
>>>>>> getRenderedContent on
>>>>>> your blog article, so I maintain they have nothing to do with
>>>>>> your
>>>>>> notification class.
>>>>>> Which version of XWiki Enterprise are you using ?
>>>>>>
>>>>>> Jerome.
>>>>>>
>>>>>> Dan Svoboda wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> See below
>>>>>>>
>>>>>>> Dan Svoboda wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I'm trying to use the notification system to trigger the
>>>>>>>>> sending of
>>>>>>>>> email whenever a comment is added to a blog article. I'm
>>>>>>>>> patterning my
>>>>>>>>> groovy class after the pircbot example on the xwiki snippets
>>>>>>>>> site.
>>>>>>>>>
>>>>>>>>> My system is xwiki workspaces as a virtual xwiki under xem.
>>>>>>>>> The
>>>>>>>>> platform version is 1.5.2.
>>>>>>>>>
>>>>>>>>> Here's my groovy class
>>>>>>>>> (XWSNotify.BlogMailNotificationGroovyClass):
>>>>>>>>>
>>>>>>>>> /* Groovy Class #* */
>>>>>>>>>
>>>>>>>>> import com.xpn.xwiki.api.XWiki;
>>>>>>>>> import com.xpn.xwiki.XWikiContext;
>>>>>>>>> import
>>>>>>>>> com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface;
>>>>>>>>> import com.xpn.xwiki.notify.DocObjectChangedRule;
>>>>>>>>> import com.xpn.xwiki.notify.XWikiNotificationRule;
>>>>>>>>> import com.xpn.xwiki.doc.XWikiDocument;
>>>>>>>>>
>>>>>>>>> public class BlogMailNotificationGroovyClass implements \
>>>>>>>>>
>>>>>>>>> XWikiDocChangeNotificationInterface
>>>>>>>>>
>>>>>>>>> {
>>>>>>>>> def xwiki;
>>>>>>>>> def rule;
>>>>>>>>> def name;
>>>>>>>>>
>>>>>>>>> public void initClasses(XWikiContext context)
>>>>>>>>> {
>>>>>>>>> this.xwiki = context.getWiki();
>>>>>>>>> // listen to notifications
>>>>>>>>> this.rule = DocObjectChangedRule(this);
>>>>>>>>>
>>>>>>>>> context
>>>>>>>>> .getWiki().getNotificationManager().addGeneralRule(rule);
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> public void notify(XWikiNotificationRule rule, XWikiDocument
>>>>>>>>> newdoc, \
>>>>>>>>> XWikiDocument olddoc, int event,
>>>>>>>>> XWikiContext
>>>>>>>>> context)
>>>>>>>>> {
>>>>>>>>> def length = newdoc.getSpace().length();
>>>>>>>>> def lastFour = length - 4;
>>>>>>>>> if(newdoc.getSpace().substring(lastFour) == "Blog") {
>>>>>>>>>
>>>>>>>>> def ms = xwiki.getPlugin("mailsender");
>>>>>>>>> def nb = ms.sendHtmlMessage(context.getUser(),
>>>>>>>>> "myAddress(a)myHost.org <mailto:myAddress@myHost.org>
>>>>>>>>> ", \
>>>>>>>>> context.get("ccrecipients"),
>>>>>>>>> context.get("bccrecipients"), \
>>>>>>>>> context.get("subject"),
>>>>>>>>> newdoc.getRenderedContent(), \
>>>>>>>>> newdoc.getContent(),
>>>>>>>>> newdoc.getAttachments());
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> /* *# */
>>>>>>>>>
>>>>>>>>> Here's a velocity script I'm using to initialize/test:
>>>>>>>>>
>>>>>>>>> #set($sc =
>>>>>>>>> $context.getContext().getEngineContext().getServletContext())
>>>>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>>>> #set($blgmlnotif =
>>>>>>>>> $
>>>>>>>>> xwiki
>>>>>>>>> .parseGroovyFromPage
>>>>>>>>> ("XWSNotify.BlogMailNotificationGroovyClass"))
>>>>>>>>> #set($ok = $sc.setAttribute("blgmailnotif", $blgmlnotif))
>>>>>>>>> #set($blgmailnotif = $sc.getAttribute("blgmailnotif"))
>>>>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>>>> #set($ok = $blgmlnotif.initClasses($context))
>>>>>>>>> #set($ok = $blgmlnotif.notify($blgmlnotif.rule,$newdoc,
>>>>>>>>> $newdoc,
>>>>>>>>> 3,$context))
>>>>>>>>>
>>>>>>>>> Here's the output from the velocity script:
>>>>>>>>>
>>>>>>>>> BlogMailNotificationGroovyClass@68e4a47
>>>>>>>>> BlogMailNotificationGroovyClass@3c401d45
>>>>>>>>>
>>>>>>>>> So, the groovy class gets initialized to a new reference
>>>>>>>>> successfully
>>>>>>>>> each time parseGroovyFromPage is called.
>>>>>>>>>
>>>>>>>>> Here's what appears in the log after running the velocity
>>>>>>>>> script:
>>>>>>>>>
>>>>>>>>> [ERROR] Left side ($request.title) of '!=' operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 53, column 43]
>>>>>>>>> [WARNING] Cannot retrieve method notify from object of class
>>>>>>>>> BlogMailNotificationGroovyClass due to security restrictions.
>>>>>>>>>
>>>>>>>>> If I alter the velocity script to:
>>>>>>>>>
>>>>>>>>> #set($sc =
>>>>>>>>> $context.getContext().getEngineContext().getServletContext())
>>>>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>>>>
>>>>>>>>> Here's what appears in the log:
>>>>>>>>>
>>>>>>>>> [ERROR] Left side ($request.title) of '!=' operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 53, column 43]
>>>>>>>>>
>>>>>>>>> So, the [WARNING] is the only log entry pertaining to the
>>>>>>>>> groovy
>>>>>>>>> class.
>>>>>>>>>
>>>>>>>>> If I add a comment to a Blog article (with or without the
>>>>>>>>> BlogMailNotificationGroovyClass initialized), the following
>>>>>>>>> appears in
>>>>>>>>> the log:
>>>>>>>>>
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>> [ERROR] Left side ($index) of addition operation has null
>>>>>>>>> value.
>>>>>>>>> Operation not possible. [line 20, column 25]
>>>>>>>>>
>>>>>>>>> The number of lines corresponds to the number of comments
>>>>>>>>> present
>>>>>>>>> in
>>>>>>>>> the Blog article. There's nothing in the log pertaining to the
>>>>>>>>> groovy
>>>>>>>>> class.
>>>>>>>> Indeed, this has nothing to do with your groovy notification.
>>>>>>>> This
>>>>>>>> is
>>>>>>>> generated by the velocity engine.
>>>>>>>> Is your skin customized ? Is the blog application modified ?
>>>>>>>> (The
>>>>>>>> log
>>>>>>>> says that somewhere a variable $index is trying to add
>>>>>>>> something
>>>>>>>> to
>>>>>>>> "null". Might be the pagination of blog articles ?)
>>>>>>>>
>>>>>>>> Jerome.
>>>>>>> I can't find a variable $index in any arithmetical expression in
>>>>>>> any
>>>>>>> velocity script anywhere on the site.
>>>>>>>
>>>>>>> The skin is customized only to the extent of some
>>>>>>> inconsequential
>>>>>>> tweaks. Same with blog app.
>>>>>>>
>>>>>>> There's no pagination of blog articles.
>>>>>>>
>>>>>>> Would someone please review the basic mechanics of how groovy
>>>>>>> classes
>>>>>>> work, particularly as it pertains to my notification class?
>>>>>>>
>>>>>>> Also, I see by reading source that there's a newer way of
>>>>>>> monitoring
>>>>>>> events through the "observation manager". Would someone please
>>>>>>> review
>>>>>>> how to use this system?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Dan
Hi,
I've updated from 1.5.2 to 1.6.1. After this, I found all groups beeing
empty - so no users were there anymore.
As result I started mapping LDAP groups to XWiki groups to let XWiki
populate the memberships again - I was planning this anyway.
For some reason XWiki is not able to get the groups members and I cannot
understand why. Also it is not putting my user in the XWiki.AllGroup -
still my groups do not have any member.
This are the logs:
DEBUG LDAP.XWikiLDAPAuthServiceImpl - Updating existing user with LDAP
attribues located at cn=a12345,ou=associates,ou=users,o=wlgore
DEBUG ldap.XWikiLDAPConfig - Ready to create user from LDAP
with fields
last_name=sn,first_name=givenName,fullname=fullName,email=mail,ldap_dn=dn
DEBUG ldap.XWikiLDAPConfig - Groupmapping found:
XWiki.XWikiAdminGroup
cn=Admin,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore
DEBUG ldap.XWikiLDAPConfig - Groupmapping found:
XWiki.MSOEGroup
cn=MSOE,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore
DEBUG ldap.XWikiLDAPConfig - Groupmapping found:
XWiki.MedicalFabricsAdmGroup
cn=MedFabAdmin,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore
DEBUG ldap.XWikiLDAPConfig - Groupmapping found:
XWiki.MedicalFabricsGroup
cn=MedFabUser,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore
DEBUG LDAP.XWikiLDAPAuthServiceImpl - Updating group membership for the
user: tzwitano
DEBUG LDAP.XWikiLDAPAuthServiceImpl - The user belongs to following
XWiki groups:
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.XWikiAllGroup
DEBUG LDAP.XWikiLDAPAuthServiceImpl - All defined XWiki groups:
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.MSOEGroup
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.MedicalFabricsAdmGroup
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.MedicalFabricsGroup
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.TrillrAdmin
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.TrillrUser
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.XWikiAdminGroup
DEBUG LDAP.XWikiLDAPAuthServiceImpl - XWiki.XWikiAllGroup
DEBUG ldap.XWikiLDAPUtils - Found group
[cn=MSOE,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore]
members :{}
DEBUG ldap.XWikiLDAPUtils - Found group
[cn=Admin,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore]
members :{}
DEBUG ldap.XWikiLDAPUtils - Found group
[cn=MedFabAdmin,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore]
members :{}
DEBUG ldap.XWikiLDAPUtils - Found group
[cn=MedFabUser,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore]
members :{}
This is my config:
#-# new LDAP authentication service
xwiki.authentication.authclass=com.xpn.xwiki.user.impl.LDAP.XWikiLDAPAuthServiceImpl
#-# Turn LDAP authentication on - otherwise only XWiki authentication
#-# 0: disable
#-# 1: enable
xwiki.authentication.ldap=1
#-# Force to check password after LDAP connection
#-# 0: disable
#-# 1: enable
xwiki.authentication.ldap.validate_password=0
#-# only members of the following group will be verified in the LDAP
# otherwise only users that are found after searching starting from the
base_DN
#xwiki.authentication.ldap.user_group=o=wlgore
#-# base DN for searches
#xwiki.authentication.ldap.base_DN=o=wlgore
#-# Specifies the LDAP attribute containing the identifier to be used as
the XWiki name (default=cn)
xwiki.authentication.ldap.UID_attr=uid
#-# [SINCE 1.5M1, XWikiLDAPAuthServiceImpl]
#-# Specifies the LDAP attribute containing the password to be used "when
xwiki.authentication.ldap.validate_password" is set to 1
# xwiki.authentication.ldap.password_field=userPassword
#-# [SINCE 1.5M1, XWikiLDAPAuthServiceImpl]
#-# The potential LDAP groups classes. Separated by commas.
xwiki.authentication.ldap.group_classes=group,groupOfNames,groupOfUniqueNames,dynamicGroup,dynamicGroupAux,groupWiseDistributionList,Top
#xwiki.authentication.ldap.group_classes=groupOfNames,Top,groupOfNames
#-# [SINCE 1.5M1, XWikiLDAPAuthServiceImpl]
#-# The potential names of the LDAP groups fields containings the members.
Separated by commas.
xwiki.authentication.ldap.group_memberfields=member,equivalentToMe
#-# retrieve the following fields from LDAP and store them in the XWiki
user object (xwiki-attribute=ldap-attribute)
#-# ldap_dn=dn -- dn is set by class, caches dn in XWiki.user object for
faster access
xwiki.authentication.ldap.fields_mapping=last_name=sn,first_name=givenName,fullname=fullName,email=mail,ldap_dn=dn
#-# [SINCE 1.3M2, XWikiLDAPAuthServiceImpl]
#-# on every login update the mapped attributes from LDAP to XWiki
otherwise this happens only once when the XWiki account is created.
xwiki.authentication.ldap.update_user=1
#-# [SINCE 1.3M2, XWikiLDAPAuthServiceImpl]
#-# mapps XWiki groups to LDAP groups, separator is "|"
xwiki.authentication.ldap.group_mapping=XWiki.XWikiAdminGroup=cn=Admin,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore|\
XWiki.MSOEGroup=cn=MSOE,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore|\
XWiki.MedicalFabricsAdmGroup=cn=MedFabAdmin,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore|\
XWiki.MedicalFabricsGroup=cn=MedFabUser,ou=XWiki,ou=Corp,ou=Links,ou=extranet_access,ou=groups,o=wlgore
#-# [SINCE 1.3M2, XWikiLDAPAuthServiceImpl]
#-# time in s after which the list of members in a group is refreshed from
LDAP (default=3600*6)
xwiki.authentication.ldap.groupcache_expiration=60
#-# [SINCE 1.3M2, XWikiLDAPAuthServiceImpl]
#-# - create : synchronize group membership only when the user is first
created
#-# - always: synchronize on every login
xwiki.authentication.ldap.mode_group_sync=always
#-# [SINCE 1.3M2, XWikiLDAPAuthServiceImpl]
#-# if ldap authentication fails for any reason, try XWiki DB
authentication with the same credentials
xwiki.authentication.ldap.trylocal=1
Thanks!
Thomas
Thanks for the replies.
I had already found that bug. If I take the conditional completely out
of the class, it still doesn't send an email.
Dan
> It is probably due to the following :
>
> "if(newdoc.getSpace().substring(lastFour) == "Blog") {"
>
> in Java, if you have the following :
>
> String st1 = "Blog";
> String st2 = new String("Blog");
>
> then st1 == st2 will always return false, as the objects are not the
> same. What you want is to compare their values, using st1.equals(st2),
> which will return true.
> You can read here to find out more
> http://www.unix.com.ua/orelly/java/langref/ch04_09.htm (especially
> this
> sentence : "Because the == operator determines if two objects are the
> same object, it is not appropriate for comparisons that need to
> determine if two objects have the same contents. For example, if you
> need to know whether two String objects contain the same sequences of
> characters, the == operator is inappropriate. You should use the
> equals() method")
>
> Anyway, their is even simpler for you. What you want to do is check if
> the space name finishes by "Blog". For this the appropriate method is
> String#endsWith
> (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#endsWith(java…
> )
> As in :
>
> "if(newdoc.getSpace().endsWith("Blog")) {"
>
> Hope this helps and fixes your issue,
>
> Regards,
> Jerome
>
> Daniel Svoboda wrote:
>> Yes. The problem is that no mail gets sent, which is the purpose of
>> the notification. I reread my initial post, and now I understand your
>> confusion. I didn't explicitly state that the class wasn't working.
>>
>> I'm using XWiki Enterprise manager 1.3 with platform version 1.5.2.
>>
>> Dan
>>
>>
>>> Do you actually encounter a problem, besides the error in the logs ?
>>> I believe those logs are generated when you call
>>> getRenderedContent on
>>> your blog article, so I maintain they have nothing to do with your
>>> notification class.
>>> Which version of XWiki Enterprise are you using ?
>>>
>>> Jerome.
>>>
>>> Dan Svoboda wrote:
>>>> Hi,
>>>>
>>>> See below
>>>>
>>>> Dan Svoboda wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to use the notification system to trigger the
>>>>>> sending of
>>>>>> email whenever a comment is added to a blog article. I'm
>>>>>> patterning my
>>>>>> groovy class after the pircbot example on the xwiki snippets
>>>>>> site.
>>>>>>
>>>>>> My system is xwiki workspaces as a virtual xwiki under xem. The
>>>>>> platform version is 1.5.2.
>>>>>>
>>>>>> Here's my groovy class
>>>>>> (XWSNotify.BlogMailNotificationGroovyClass):
>>>>>>
>>>>>> /* Groovy Class #* */
>>>>>>
>>>>>> import com.xpn.xwiki.api.XWiki;
>>>>>> import com.xpn.xwiki.XWikiContext;
>>>>>> import com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface;
>>>>>> import com.xpn.xwiki.notify.DocObjectChangedRule;
>>>>>> import com.xpn.xwiki.notify.XWikiNotificationRule;
>>>>>> import com.xpn.xwiki.doc.XWikiDocument;
>>>>>>
>>>>>> public class BlogMailNotificationGroovyClass implements \
>>>>>>
>>>>>> XWikiDocChangeNotificationInterface
>>>>>>
>>>>>> {
>>>>>> def xwiki;
>>>>>> def rule;
>>>>>> def name;
>>>>>>
>>>>>> public void initClasses(XWikiContext context)
>>>>>> {
>>>>>> this.xwiki = context.getWiki();
>>>>>> // listen to notifications
>>>>>> this.rule = DocObjectChangedRule(this);
>>>>>>
>>>>>> context.getWiki().getNotificationManager().addGeneralRule(rule);
>>>>>> }
>>>>>>
>>>>>> public void notify(XWikiNotificationRule rule, XWikiDocument
>>>>>> newdoc, \
>>>>>> XWikiDocument olddoc, int event,
>>>>>> XWikiContext
>>>>>> context)
>>>>>> {
>>>>>> def length = newdoc.getSpace().length();
>>>>>> def lastFour = length - 4;
>>>>>> if(newdoc.getSpace().substring(lastFour) == "Blog") {
>>>>>>
>>>>>> def ms = xwiki.getPlugin("mailsender");
>>>>>> def nb = ms.sendHtmlMessage(context.getUser(),
>>>>>> "myAddress(a)myHost.org <mailto:myAddress@myHost.org>
>>>>>> ", \
>>>>>> context.get("ccrecipients"),
>>>>>> context.get("bccrecipients"), \
>>>>>> context.get("subject"),
>>>>>> newdoc.getRenderedContent(), \
>>>>>> newdoc.getContent(),
>>>>>> newdoc.getAttachments());
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> /* *# */
>>>>>>
>>>>>> Here's a velocity script I'm using to initialize/test:
>>>>>>
>>>>>> #set($sc =
>>>>>> $context.getContext().getEngineContext().getServletContext())
>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>> #set($blgmlnotif =
>>>>>> $
>>>>>> xwiki
>>>>>> .parseGroovyFromPage
>>>>>> ("XWSNotify.BlogMailNotificationGroovyClass"))
>>>>>> #set($ok = $sc.setAttribute("blgmailnotif", $blgmlnotif))
>>>>>> #set($blgmailnotif = $sc.getAttribute("blgmailnotif"))
>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>> #set($ok = $blgmlnotif.initClasses($context))
>>>>>> #set($ok = $blgmlnotif.notify($blgmlnotif.rule,$newdoc,$newdoc,
>>>>>> 3,$context))
>>>>>>
>>>>>> Here's the output from the velocity script:
>>>>>>
>>>>>> BlogMailNotificationGroovyClass@68e4a47
>>>>>> BlogMailNotificationGroovyClass@3c401d45
>>>>>>
>>>>>> So, the groovy class gets initialized to a new reference
>>>>>> successfully
>>>>>> each time parseGroovyFromPage is called.
>>>>>>
>>>>>> Here's what appears in the log after running the velocity script:
>>>>>>
>>>>>> [ERROR] Left side ($request.title) of '!=' operation has null
>>>>>> value.
>>>>>> Operation not possible. [line 53, column 43]
>>>>>> [WARNING] Cannot retrieve method notify from object of class
>>>>>> BlogMailNotificationGroovyClass due to security restrictions.
>>>>>>
>>>>>> If I alter the velocity script to:
>>>>>>
>>>>>> #set($sc =
>>>>>> $context.getContext().getEngineContext().getServletContext())
>>>>>> $sc.getAttribute("blgmailnotif")<br/>
>>>>>>
>>>>>> Here's what appears in the log:
>>>>>>
>>>>>> [ERROR] Left side ($request.title) of '!=' operation has null
>>>>>> value.
>>>>>> Operation not possible. [line 53, column 43]
>>>>>>
>>>>>> So, the [WARNING] is the only log entry pertaining to the groovy
>>>>>> class.
>>>>>>
>>>>>> If I add a comment to a Blog article (with or without the
>>>>>> BlogMailNotificationGroovyClass initialized), the following
>>>>>> appears in
>>>>>> the log:
>>>>>>
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>> [ERROR] Left side ($index) of addition operation has null value.
>>>>>> Operation not possible. [line 20, column 25]
>>>>>>
>>>>>> The number of lines corresponds to the number of comments present
>>>>>> in
>>>>>> the Blog article. There's nothing in the log pertaining to the
>>>>>> groovy
>>>>>> class.
>>>>> Indeed, this has nothing to do with your groovy notification. This
>>>>> is
>>>>> generated by the velocity engine.
>>>>> Is your skin customized ? Is the blog application modified ? (The
>>>>> log
>>>>> says that somewhere a variable $index is trying to add something
>>>>> to
>>>>> "null". Might be the pagination of blog articles ?)
>>>>>
>>>>> Jerome.
>>>> I can't find a variable $index in any arithmetical expression in
>>>> any
>>>> velocity script anywhere on the site.
>>>>
>>>> The skin is customized only to the extent of some inconsequential
>>>> tweaks. Same with blog app.
>>>>
>>>> There's no pagination of blog articles.
>>>>
>>>> Would someone please review the basic mechanics of how groovy
>>>> classes
>>>> work, particularly as it pertains to my notification class?
>>>>
>>>> Also, I see by reading source that there's a newer way of
>>>> monitoring
>>>> events through the "observation manager". Would someone please
>>>> review
>>>> how to use this system?
>>>>
>>>> Thanks,
>>>>
>>>> Dan
>>