On Thu, Dec 18, 2008 at 3:03 PM, Juergen Lorenz Simon <[email protected]> wrote:
> Hi,
>
> On 18.12.2008, at 14:37, Thomas Mortagne wrote:
>
>> On Thu, Dec 18, 2008 at 1:54 PM, Juergen Lorenz Simon <[email protected]
>> > wrote:
>>> Hi Thomas,
>>>
>>> no, I do not create a context myself. I'm running this in Eclipse
>>
>> But where do you get the XWikiContext you give to
>> createExternalURL() ?
>
>
> When the indexing plugin is instantiated I grab the context:
>
> public IndexUpdater(XWiki wiki, XWikiContext context) {
> this.xwiki = wiki;
> this.context = context;
> }
>
> Which is obtained from XWiki at plugin initialization time:
>
> public void init(XWikiContext context) {
> ...
> // initialize the actual plugin
> indexUpdater = new IndexUpdater(context.getWiki(), context);
> indexUpdater.start();
>
> // Hook into the document change notifications
> DocChangeRule docChangeRule = new DocChangeRule(indexUpdater);
>
> context
> .getWiki().getNotificationManager().addGeneralRule(docChangeRule);
> }
>
> Do you think I should use the context that comes in the notify()
> method instead?
No need, even if it's cleaner but it should be exactly the same java
object I think, so I don't understand why your context's request
object is wrong.
Could you send you full stack trace ?
>
>
>
>>> though. Could querying the servlet context cause this problem? We
>>> have
>>> a class that is supposed to resolve properties and stuff from the
>>> web.xml file, and it creates an InitialContext (jndi) for lookups:
>>>
>>> InitialContext jndiContext = new InitialContext();
>>> Object prop = jndiContext.lookup("java:comp/env/someprop");
>>>
>>> but it would seem far fetched that this would cause trouble, or? And
>>> the only other change since the last time it worked was migrating to
>>> 1.7.
>>>
>>>
>>> On 18.12.2008, at 13:44, Thomas Mortagne wrote:
>>>
>>>> I looked a little closely and there is something weird, there is a
>>>> request in your XWikiContext but it does not return any servlet path
>>>> according to your stack trace.
>>>>
>>>> If it's running in it's own thread how do you create the
>>>> XWikiContext ?
>>>>
>>>> On Thu, Dec 18, 2008 at 1:40 PM, Thomas Mortagne
>>>> <[email protected]> wrote:
>>>>> Hi,
>>>>>
>>>>> Is your indexer running in it's own thread ?
>>>>>
>>>>> In that case the problem is that when you ask for URL XWiki need
>>>>> the
>>>>> current URL for some informations it does not have in its
>>>>> configuration like the current host or protocol or even the port to
>>>>> be
>>>>> able to recreate the URL as expected.
>>>>>
>>>>> Are you sure it worked fine in 1.6 ?
>>>>>
>>>>> On Tue, Dec 16, 2008 at 1:09 PM, Juergen Lorenz Simon <[email protected]
>>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm writing an indexer plugin for XWiki and recently found a
>>>>>> problem
>>>>>> when trying to obtain the external document url:
>>>>>>
>>>>>> java.lang.NullPointerException
>>>>>> at com.xpn.xwiki.XWiki.getServletPath(XWiki.java:4317)
>>>>>> at
>>>>>> com
>>>>>> .xpn
>>>>>> .xwiki
>>>>>> .web
>>>>>> .XWikiServletURLFactory
>>>>>> .addServletPath(XWikiServletURLFactory.java:
>>>>>> 208)
>>>>>> at
>>>>>> com
>>>>>> .xpn
>>>>>> .xwiki
>>>>>> .web.XWikiServletURLFactory.createURL(XWikiServletURLFactory.java:
>>>>>> 178)
>>>>>> at
>>>>>> com
>>>>>> .xpn
>>>>>> .xwiki
>>>>>> .web
>>>>>> .XWikiServletURLFactory
>>>>>> .createExternalURL(XWikiServletURLFactory.java:
>>>>>> 273)
>>>>>> at
>>>>>> com.xpn.xwiki.doc.XWikiDocument.getExternalURL(XWikiDocument.java:
>>>>>> 925)
>>>>>> at
>>>>>> com
>>>>>> .kontrast
>>>>>> .vodafone
>>>>>> .portal
>>>>>> .xwiki.plugins.indexer.IndexUpdater.runMainLoop(IndexUpdater.java:
>>>>>> 180)
>>>>>> at
>>>>>> com
>>>>>> .kontrast
>>>>>> .vodafone
>>>>>> .portal.xwiki.plugins.indexer.IndexUpdater.run(IndexUpdater.java:
>>>>>> 116)
>>>>>>
>>>>>>
>>>>>>
>>>>>> I updated to XWiki version 1.7-SNAPSHOT recently. Before that I
>>>>>> didn't
>>>>>> experience this. Can anyone shed some light on this?
>>>>>>
>>>>>> Thanks,
>>>>>> J.L.Simon
>>>>>> _______________________________________________
>>>>>> devs mailing list
>>>>>> [email protected]
>>>>>> http://lists.xwiki.org/mailman/listinfo/devs
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Thomas Mortagne
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thomas Mortagne
>>>> _______________________________________________
>>>> devs mailing list
>>>> [email protected]
>>>> http://lists.xwiki.org/mailman/listinfo/devs
>>>>
>>>
>>> _______________________________________________
>>> devs mailing list
>>> [email protected]
>>> http://lists.xwiki.org/mailman/listinfo/devs
>>>
>>
>>
>>
>> --
>> Thomas Mortagne
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
--
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs