You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Kelly Marchewa <kl...@gmail.com> on 2022/04/01 12:37:01 UTC

Workspace Mismatch Issue

Hello,
I am attempting to connect to a remote JCR instance (specifically an
instance related to Adobe's AEM solution, using this guide:
https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/access-jcr.html?lang=en
)
This is a sample code snippet of how I am connecting:

    public static void main(String[] args) throws RepositoryException {
        javax.jcr.Repository repository = JcrUtils
                .getRepository("https://example.com/crx/server");

        // Create a Session instance
        var session = repository
                .login(new SimpleCredentials("user", "user".toCharArray()));
        var root = session.getRootNode();
        var nIter = root.getNodes();
        while (nIter.hasNext()) {
            var n = (Node) nIter.next();
            System.out.println(n.getPath());
        }

However, the "iteration" portion is given an error: Workspace
mismatch: 'https://example.com:443/crx/server/crx.default/jcr%3aroot/bin'
not under workspace 'https://example.com/crx/server/crx.default'
(position 41: '{https:/example.com}:443/crx/server/crx.default/jcr%3aroot/bin',
expected: '/crx/server/crx.default')

From the error (and confirmed by debugging), I can see that the
mismatch is occurring because of the port (443) being include in the URI
 but not the workspace (the position 41 in the error is inaccurate
simply because since I have removed the actual domain).

However, I am a bit perplexed as to why it is including the port.
Obviously, I am not specifying the port when connecting and I am using the
standard https port, so I am not sure how I can resolve this issue ?

Re: Workspace Mismatch Issue

Posted by Julian Reschke <ju...@gmx.de>.
Am 02.04.2022 um 16:08 schrieb Kelly Marchewa:
> Thanks much for the response and explanation.
>
> I do not have access to AEM configuration itself; is there any way to
> work around this issue in the code/app that is accessing the AEM repo?

I don't think so; the server is misconfigured, thus the client code is
unhappy.

Best regards, Julian

Re: Workspace Mismatch Issue

Posted by Kelly Marchewa <kl...@gmail.com>.
Thanks much for the response and explanation.

I do not have access to AEM configuration itself; is there any way to 
work around this issue in the code/app that is accessing the AEM repo?

On 4/2/22 02:53, Julian Reschke wrote:
> Am 01.04.2022 um 14:37 schrieb Kelly Marchewa:
>> Hello,
>> I am attempting to connect to a remote JCR instance (specifically an
>> instance related to Adobe's AEM solution, using this guide:
>> https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/access-jcr.html?lang=en 
>>
>> )
>> This is a sample code snippet of how I am connecting:
>>
>>      public static void main(String[] args) throws RepositoryException {
>>          javax.jcr.Repository repository = JcrUtils
>> .getRepository("https://example.com/crx/server");
>>
>>          // Create a Session instance
>>          var session = repository
>>                  .login(new SimpleCredentials("user", 
>> "user".toCharArray()));
>>          var root = session.getRootNode();
>>          var nIter = root.getNodes();
>>          while (nIter.hasNext()) {
>>              var n = (Node) nIter.next();
>>              System.out.println(n.getPath());
>>          }
>>
>> However, the "iteration" portion is given an error: Workspace
>> mismatch: 
>> 'https://example.com:443/crx/server/crx.default/jcr%3aroot/bin'
>> not under workspace 'https://example.com/crx/server/crx.default'
>> (position 41: 
>> '{https:/example.com}:443/crx/server/crx.default/jcr%3aroot/bin',
>> expected: '/crx/server/crx.default')
>>
>>> From the error (and confirmed by debugging), I can see that the
>> mismatch is occurring because of the port (443) being include in the URI
>>   but not the workspace (the position 41 in the error is inaccurate
>> simply because since I have removed the actual domain).
>>
>> However, I am a bit perplexed as to why it is including the port.
>> Obviously, I am not specifying the port when connecting and I am 
>> using the
>> standard https port, so I am not sure how I can resolve this issue ?
>
> The confusion is likely caused by HTTPs being terminated outside the VM,
> thus the URIs returned in WebDAV responses do not match.
>
> You probably need to configure the Sling WebDAV servlets inside AEM to
> use "absolute paths" in responses.
>
> Best regards, Julian
>
>

Re: Workspace Mismatch Issue

Posted by Julian Reschke <ju...@gmx.de>.
Am 01.04.2022 um 14:37 schrieb Kelly Marchewa:
> Hello,
> I am attempting to connect to a remote JCR instance (specifically an
> instance related to Adobe's AEM solution, using this guide:
> https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/access-jcr.html?lang=en
> )
> This is a sample code snippet of how I am connecting:
>
>      public static void main(String[] args) throws RepositoryException {
>          javax.jcr.Repository repository = JcrUtils
>                  .getRepository("https://example.com/crx/server");
>
>          // Create a Session instance
>          var session = repository
>                  .login(new SimpleCredentials("user", "user".toCharArray()));
>          var root = session.getRootNode();
>          var nIter = root.getNodes();
>          while (nIter.hasNext()) {
>              var n = (Node) nIter.next();
>              System.out.println(n.getPath());
>          }
>
> However, the "iteration" portion is given an error: Workspace
> mismatch: 'https://example.com:443/crx/server/crx.default/jcr%3aroot/bin'
> not under workspace 'https://example.com/crx/server/crx.default'
> (position 41: '{https:/example.com}:443/crx/server/crx.default/jcr%3aroot/bin',
> expected: '/crx/server/crx.default')
>
>>From the error (and confirmed by debugging), I can see that the
> mismatch is occurring because of the port (443) being include in the URI
>   but not the workspace (the position 41 in the error is inaccurate
> simply because since I have removed the actual domain).
>
> However, I am a bit perplexed as to why it is including the port.
> Obviously, I am not specifying the port when connecting and I am using the
> standard https port, so I am not sure how I can resolve this issue ?

The confusion is likely caused by HTTPs being terminated outside the VM,
thus the URIs returned in WebDAV responses do not match.

You probably need to configure the Sling WebDAV servlets inside AEM to
use "absolute paths" in responses.

Best regards, Julian