Main Content

Magnolia Community Forums: Get help with Magnolia: Problem with accessing JCR after Magnolia startup


  • twelve4
    twelve4
    Full name: Dominik Jednoralski
    Posts: 5
    Last post: Dec 12, 2016 11:36:28 AM
    Registered on: Jul 19, 2016
    Problem with accessing JCR after Magnolia startup
    #1 by twelve4 on Nov 8, 2016 4:44:37 PM

    Hi all,

    I have an issue with accessing the JCR from a model class after Magnolia startup. A content area has a model and calls a
    method to get latest content from a specific workspace. Model code looks as follows:

    try {
    jcrSession = MgnlContext.getJCRSession("trouble");
    QueryManager jcrQueryManager = jcrSession.getWorkspace().getQueryManager();
    Query query = jcrQueryManager.createQuery(QUERY_STRING, Query.JCR_SQL2);
    query.setLimit(1l); // only one result
    QueryResult queryResult = query.execute();
    RowIterator iterator = queryResult.getRows();

    if (iterator.hasNext()) {
    // won't be entered
    // ...



    After startup, I observe that the iterator is empty, although

    * relevant node is present in public instance's trouble workspace (JCR app)
    * exact same query from model used on public instance finds the node (JCR tools, query)
    * all caches have been flushed (cache tools app)

    This behaviour persists randomly (yes, sadly), I haven't found a reproducible way to fix the problem. However, the following actions influence the issue:

    * publishing an asset
    * republishing the item from the workspace
    * open the browser console / network and force-reload the page

    What am I doing wrong? Any ideas?

    Kind Regards,

    Dominik

  • twelve4
    twelve4
    Full name: Dominik Jednoralski
    Posts: 5
    Last post: Dec 12, 2016 11:36:28 AM
    Registered on: Jul 19, 2016
    Re: Problem with accessing JCR after Magnolia startup
    #2 by twelve4 on Dec 12, 2016 11:36:28 AM

    Hi all,

    quickly coming back to this: turned out it was a rights-problem. On public instance, the "Anonymous" user did not have sufficient privilege to access the custom "trouble" workspace.

    Kind Regards,

    Dominik

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/