On Jul 28, 2008, at 12:53 PM, Thomas Mortagne wrote:

> On Mon, Jul 28, 2008 at 12:17 PM, Markus Lanthaler
> <[EMAIL PROTECTED]> wrote:
>> Hi Ludovic,
>>
>> I just created a class OpenIDHelper which has a static method
>> findOpenIDUser(). That method is called in the already existent class
>> MyFormAuthenticator which I extended a bit. Shouldn't the component  
>> manager
>> be set up already in that "context"? Do you need any other details?
>
> Yes i did not look close enough the stack trace. So I don't understand
> why this is not already initialized...

I think I know why: because the code doesn't work :)

The AbstractQueryManager should implement Composable.

I'm looking into it.

Thanks
-Vincent

>>> I think it's "prop.value =:identifier" (not ':identifier') otherwise
>>> hibernate will consider you use the value ":identifier" and will not
>>> replace it.
>>
>> OK Thomas, I fixed that. Thanks!
>>
>>
>> ----- Original Message -----
>> From: "Ludovic Dubost" <[EMAIL PROTECTED]>
>> To: "XWiki Developers" <[email protected]>
>> Sent: Monday, July 28, 2008 11:53 AM
>> Subject: [gsoc] Re: [xwiki-devs] Problems creating a query using the
>> QueryManager
>>
>>
>>>
>>> Hi Markus,
>>>
>>> Line 73 of AbstractQueryManager
>>>
>>>   query = (Query) componentManager.lookup(Query.ROLE, language);
>>>
>>> Your componentManager is null.. This probably means that you have   
>>> not
>>> activated the component manager from plexus properly.
>>> Probably Vincent can help, but he will probably need to know how you
>>> have build your code.
>>>
>>> Ludovic
>>>
>>> Markus Lanthaler wrote:
>>>> Hi,
>>>>
>>>> I'm currently implementing the last things to finish OpenID
>>>> authentication
>>>> support but I have some problems with the query manager. I'm  
>>>> trying to
>>>> get
>>>> the document (should be only one) which an attached  
>>>> OpenIdIdentifier
>>>> object
>>>> whose "identifier" string property's value has some specific  
>>>> value. I
>>>> didn't
>>>> found any documentation apart
>>>> http://markmail.org/message/jt6m2huqr4r6hvk6
>>>> and
>>>> http://dev.xwiki.org/xwiki/bin/view/Design/XWiki+Query+Language+Specification
>>>>  
>>>> .
>>>>
>>>> I tried to achieve this by the following code:
>>>>
>>>>    public static String findOpenIDUser(String openid_identifier,
>>>> XWikiContext context) throws XWikiException
>>>>    {
>>>>        XWiki xwiki = context.getWiki();
>>>>
>>>>        QueryManager qm = xwiki.getStore().getQueryManager();
>>>>        Query search_user;
>>>>
>>>>        if (qm.hasLanguage(Query.HQL)) {
>>>>            search_user =
>>>>                qm.createQuery(", BaseObject as obj,  
>>>> StringProperty as
>>>> prop
>>>> where doc.fullName = obj.name and obj.className =
>>>> 'XWiki.OpenIdIdentifier'
>>>> and obj.id=prop.id.id and prop.id.name='identifier' and  
>>>> prop.value =
>>>> ':identifier'", Query.HQL);
>>>>        } else if (qm.hasLanguage(Query.XPATH)) {
>>>>            search_user =
>>>> qm.createQuery("/*/*[obj/XWiki/OpenIdIdentifier/@xp:identifier =
>>>> ':identifier'] ", Query.XPATH);
>>>>        } else
>>>>            throw new RuntimeException();
>>>>
>>>>        search_user.bindValue("identifier", openid_identifier);
>>>>
>>>>        List<XWikiDocument> found_users =
>>>> search_user.setLimit(1).execute();
>>>>        if (found_users.size() > 0) {
>>>>            if (log.isDebugEnabled()) {
>>>>                log.debug("OpenID " + openid_identifier + " already
>>>> registered.");
>>>>            }
>>>>            return found_users.get(0).getFullName();
>>>>        }
>>>>
>>>>        return null;
>>>>    }
>>>>
>>>>
>>>> but all I get is a NullPointerException when qm.createQuery(...,
>>>> Query.HQL)
>>>> is called. What's wrong with my code?
>>>>
>>>> java.lang.NullPointerException
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .store 
>>>> .query.AbstractQueryManager.createQuery(AbstractQueryManager.java: 
>>>> 73)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .user.impl.openid.OpenIDHelper.findOpenIDUser(OpenIDHelper.java: 
>>>> 109)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .user 
>>>> .impl 
>>>> .xwiki.MyFormAuthenticator.processLogin(MyFormAuthenticator.java: 
>>>> 201)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .user 
>>>> .impl 
>>>> .xwiki.MyFormAuthenticator.processLogin(MyFormAuthenticator.java: 
>>>> 178)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .user 
>>>> .impl 
>>>> .xwiki.XWikiAuthServiceImpl.checkAuth(XWikiAuthServiceImpl.java: 
>>>> 205)
>>>> at com.xpn.xwiki.XWiki.checkAuth(XWiki.java:3518)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .user 
>>>> .impl 
>>>> .xwiki 
>>>> .XWikiRightServiceImpl.checkAccess(XWikiRightServiceImpl.java:139)
>>>> at com.xpn.xwiki.XWiki.checkAccess(XWiki.java:3526)
>>>> at com.xpn.xwiki.XWiki.prepareDocuments(XWiki.java:4432)
>>>> at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:190)
>>>> at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
>>>> at
>>>> org 
>>>> .apache 
>>>> .struts 
>>>> .action 
>>>> .RequestProcessor.processActionPerform(RequestProcessor.java:431)
>>>> at
>>>> org 
>>>> .apache 
>>>> .struts.action.RequestProcessor.process(RequestProcessor.java:236)
>>>> at
>>>> org.apache.struts.action.ActionServlet.process(ActionServlet.java: 
>>>> 1196)
>>>> at  
>>>> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java: 
>>>> 432)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core 
>>>> .ApplicationFilterChain 
>>>> .internalDoFilter(ApplicationFilterChain.java:290)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 
>>>> 206)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .web 
>>>> .SavedRequestRestorerFilter 
>>>> .doFilter(SavedRequestRestorerFilter.java:287)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core 
>>>> .ApplicationFilterChain 
>>>> .internalDoFilter(ApplicationFilterChain.java:235)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 
>>>> 206)
>>>> at
>>>> com 
>>>> .xpn 
>>>> .xwiki 
>>>> .web 
>>>> .SetCharacterEncodingFilter 
>>>> .doFilter(SetCharacterEncodingFilter.java:112)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core 
>>>> .ApplicationFilterChain 
>>>> .internalDoFilter(ApplicationFilterChain.java:235)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 
>>>> 206)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core.StandardContextValve.invoke(StandardContextValve.java:175)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina 
>>>> .core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>> at
>>>> org 
>>>> .apache 
>>>> .catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>>>> at
>>>> org 
>>>> .apache 
>>>> .coyote.http11.Http11Processor.process(Http11Processor.java:844)
>>>> at
>>>> org.apache.coyote.http11.Http11Protocol 
>>>> $Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>> at
>>>> org.apache.tomcat.util.net.JIoEndpoint 
>>>> $Worker.run(JIoEndpoint.java:447)
>>>> at java.lang.Thread.run(Thread.java:619)
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to