You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Markus Joschko <ma...@gmail.com> on 2011/09/19 22:03:25 UTC

Not possible to get a secured repository with the JCRUtils.getRepository

Hi,
is it just my setup or is there no way to get access to a repository
via JCRUtils.getRepository when
there is the anonymous user disabled?

The davex RepositoryFactory doesn't seem to recognize that there is a
valid repository if just the credentials are provided.

 java -jar target/jackrabbit-standalone-2.3-SNAPSHOT.jar --cli
http://localhost:8080
Exception in thread "main" javax.jcr.RepositoryException: Unable to
access a repository with the following settings:
    org.apache.jackrabbit.repository.uri: http://localhost:8080
The following RepositoryFactory classes were consulted:
    org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory: declined
    org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory: declined
    org.apache.jackrabbit.commons.JndiRepositoryFactory: declined
    org.apache.jackrabbit.core.RepositoryFactoryImpl: declined
    org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory: failed
        because of RepositoryException: Failed to read the resource at
URL http://localhost:8080
        because of IOException: Server returned HTTP response code:
401 for URL: http://localhost:8080
Perhaps the repository you are trying to access is not available at the moment.
        at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:216)
        at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:256)
        at org.apache.jackrabbit.standalone.Main.run(Main.java:127)
        at org.apache.jackrabbit.standalone.Main.main(Main.java:61)

This problem does not appear when using a browser. There I am asked
for my credentials.

Regards,
 Markus

Re: Not possible to get a secured repository with the JCRUtils.getRepository

Posted by Markus Joschko <ma...@gmail.com>.
Hi Jukka,
I just tried the trunk standalone client via davex.
While I can login to the repository and read everything, I can not
delete or import stuff.
Instead I get an UnsupportedRepositoryException (below). Everything is
fine if I allow anonymous the access to the repository.

[/] > del etc

an exception occurred

exception: javax.jcr.UnsupportedRepositoryOperationException
message: level.2.supported is not supported by this repository.

display stack trace? [y/n]y
javax.jcr.UnsupportedRepositoryOperationException: level.2.supported
is not supported by this repository.
        at org.apache.jackrabbit.jcr2spi.SessionImpl.checkSupportedOption(SessionImpl.java:986)
        at org.apache.jackrabbit.jcr2spi.ItemImpl.checkSupportedOption(ItemImpl.java:503)
        at org.apache.jackrabbit.jcr2spi.ItemImpl.remove(ItemImpl.java:302)
        at org.apache.jackrabbit.standalone.cli.core.RemoveItem.execute(RemoveItem.java:52)
        at org.apache.jackrabbit.standalone.cli.JcrClient.runCommand(JcrClient.java:255)
        at org.apache.jackrabbit.standalone.cli.JcrClient.runInteractive(JcrClient.java:210)
        at org.apache.jackrabbit.standalone.Main.run(Main.java:137)
        at org.apache.jackrabbit.standalone.Main.main(Main.java:60)



On Tue, Sep 20, 2011 at 11:51 AM, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On Tue, Sep 20, 2011 at 10:44 AM, Markus Joschko
> <ma...@gmail.com> wrote:
>> There is nothing wrong with the webdav url. It works fine if I allow
>> anonymous read rights.
>
> The problem is that the webdav client tries to connect the repository
> to see if it's there already before you've provided any credentials.
> And since due to the authentication requirement it can't access
> anything, it concludes that no repository can be found. I guess in
> such cases (when encountering a mandatory authentication request) the
> webdav client should just silently assume that there is a repository
> behind the given URL.
>
> I filed JCR-3076 [1] to track this problem.
>
> [1] https://issues.apache.org/jira/browse/JCR-3076
>
> BR,
>
> Jukka Zitting
>

Re: Not possible to get a secured repository with the JCRUtils.getRepository

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Sep 20, 2011 at 10:44 AM, Markus Joschko
<ma...@gmail.com> wrote:
> There is nothing wrong with the webdav url. It works fine if I allow
> anonymous read rights.

The problem is that the webdav client tries to connect the repository
to see if it's there already before you've provided any credentials.
And since due to the authentication requirement it can't access
anything, it concludes that no repository can be found. I guess in
such cases (when encountering a mandatory authentication request) the
webdav client should just silently assume that there is a repository
behind the given URL.

I filed JCR-3076 [1] to track this problem.

[1] https://issues.apache.org/jira/browse/JCR-3076

BR,

Jukka Zitting

Re: Not possible to get a secured repository with the JCRUtils.getRepository

Posted by Markus Joschko <ma...@gmail.com>.
Hi Francisco,
I'll specifically try to connect to a webdav repository and do not
want to start the repository.
There is nothing wrong with the webdav url. It works fine if I allow
anonymous read rights.

Regards,
 Markus

On Tue, Sep 20, 2011 at 10:25 AM, Francisco Carriedo Scher
<fc...@gmail.com> wrote:
> Hi there,
>
> --cli option requires from you to specify the path where your repository.xml
> file (the one which contains the repository configuration) relies (but you
> don't have to add the repository.xml name to the end of the path), for
> example:
>
>  java -jar jackrabbit-standalone-2.2.7.jar --cli
> file:///path/to/repositoryxmlfile/
>
> For more info about options try:
>
>  java -jar jackrabbit-standalone-2.2.7.jar --help
>
> Hope that helps!
>
>
>
> 2011/9/19 Markus Joschko <ma...@gmail.com>
>
>> Hi,
>> is it just my setup or is there no way to get access to a repository
>> via JCRUtils.getRepository when
>> there is the anonymous user disabled?
>>
>> The davex RepositoryFactory doesn't seem to recognize that there is a
>> valid repository if just the credentials are provided.
>>
>>  java -jar target/jackrabbit-standalone-2.3-SNAPSHOT.jar --cli
>> http://localhost:8080
>> Exception in thread "main" javax.jcr.RepositoryException: Unable to
>> access a repository with the following settings:
>>    org.apache.jackrabbit.repository.uri: http://localhost:8080
>> The following RepositoryFactory classes were consulted:
>>    org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory: declined
>>    org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory: declined
>>    org.apache.jackrabbit.commons.JndiRepositoryFactory: declined
>>    org.apache.jackrabbit.core.RepositoryFactoryImpl: declined
>>    org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory: failed
>>        because of RepositoryException: Failed to read the resource at
>> URL http://localhost:8080
>>        because of IOException: Server returned HTTP response code:
>> 401 for URL: http://localhost:8080
>> Perhaps the repository you are trying to access is not available at the
>> moment.
>>        at
>> org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:216)
>>        at
>> org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:256)
>>        at org.apache.jackrabbit.standalone.Main.run(Main.java:127)
>>        at org.apache.jackrabbit.standalone.Main.main(Main.java:61)
>>
>> This problem does not appear when using a browser. There I am asked
>> for my credentials.
>>
>> Regards,
>>  Markus
>>
>

Re: Not possible to get a secured repository with the JCRUtils.getRepository

Posted by Francisco Carriedo Scher <fc...@gmail.com>.
Hi there,

--cli option requires from you to specify the path where your repository.xml
file (the one which contains the repository configuration) relies (but you
don't have to add the repository.xml name to the end of the path), for
example:

 java -jar jackrabbit-standalone-2.2.7.jar --cli
file:///path/to/repositoryxmlfile/

For more info about options try:

 java -jar jackrabbit-standalone-2.2.7.jar --help

Hope that helps!



2011/9/19 Markus Joschko <ma...@gmail.com>

> Hi,
> is it just my setup or is there no way to get access to a repository
> via JCRUtils.getRepository when
> there is the anonymous user disabled?
>
> The davex RepositoryFactory doesn't seem to recognize that there is a
> valid repository if just the credentials are provided.
>
>  java -jar target/jackrabbit-standalone-2.3-SNAPSHOT.jar --cli
> http://localhost:8080
> Exception in thread "main" javax.jcr.RepositoryException: Unable to
> access a repository with the following settings:
>    org.apache.jackrabbit.repository.uri: http://localhost:8080
> The following RepositoryFactory classes were consulted:
>    org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory: declined
>    org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory: declined
>    org.apache.jackrabbit.commons.JndiRepositoryFactory: declined
>    org.apache.jackrabbit.core.RepositoryFactoryImpl: declined
>    org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory: failed
>        because of RepositoryException: Failed to read the resource at
> URL http://localhost:8080
>        because of IOException: Server returned HTTP response code:
> 401 for URL: http://localhost:8080
> Perhaps the repository you are trying to access is not available at the
> moment.
>        at
> org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:216)
>        at
> org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:256)
>        at org.apache.jackrabbit.standalone.Main.run(Main.java:127)
>        at org.apache.jackrabbit.standalone.Main.main(Main.java:61)
>
> This problem does not appear when using a browser. There I am asked
> for my credentials.
>
> Regards,
>  Markus
>