hi ulrich

ok… now i get it! you are not running on jackrabbit-core but try
to use the jcr-remoting. unfortunately, the access control part
is not yet implemented in the remoting setup which has jcr2spi
on it's client side.

see https://issues.apache.org/jira/browse/JCR-2113

kind regards
angela


On Jul 16, 2013, at 11:13 AM, Ulrich <for...@gombers.de> wrote:

> My program throws an exception when trying to instantiate
> javax.jcr.security.AccessControlManager. For testing I have downloaded me a
> jackrabbit-standalone-server-2.6.2.jar. I've started it on my Laptop (Windows 
> 7,
> Java 7.0.21) and ran my testprogram.
> It gave me this results (see attached program for these messages):
> Successfully connected to http://localhost:8080/server/. Workspace=default
> Access Control is supported: true
> Exception in thread "main" javax.jcr.UnsupportedRepositoryOperationException:
> JCR-1104
>        at
> org.apache.jackrabbit.jcr2spi.SessionImpl.getAccessControlManager(SessionImpl.java:501)
>        at de.ulrich.test.TestCaseACL.<init>(TestCaseACL.java:35)
>        at de.ulrich.test.TestCaseACL.main(TestCaseACL.java:42)
> 
> I have attached the source, the pom.xml and the security-settings of the
> jackrabbit-server. May I ask someone in the community to run my program as 
> well,
> to see whether he gets the same error. I've seen some samples in this forum of
> people who are using the AccessControlManager - so it seems to work, normally.
> 
> In my program I verify the setting of
> "Repository.OPTION_ACCESS_CONTROL_SUPPORTED", as described in the JCR-Specs
> (JSR-283) Chapter 16. So, according to this reference, my program should work.
> 
> Any help is appreciated,
> Ulrich
> 
> 
> 
> package de.ulrich.test
> 
> import javax.jcr.Credentials;
> import javax.jcr.Repository;
> import javax.jcr.RepositoryException;
> import javax.jcr.Session;
> import javax.jcr.SimpleCredentials;
> import javax.jcr.Value;
> import javax.jcr.security.AccessControlManager;
> 
> import org.apache.jackrabbit.core.security.AccessManager;
> 
> public class TestCaseACL {
> 
>        public TestCaseACL() throws RepositoryException, Exception {
>                String repositoryURI="http://localhost:8080/server/";;
>                String userid="admin";
>                String password="admin";
> 
>                Repository repository =
> org.apache.jackrabbit.commons.JcrUtils.getRepository(repositoryURI);
>                Credentials cred= new SimpleCredentials(userid,
> password.toCharArray());
>                Session session = repository.login(cred);
> 
>                if (session.isLive())
>                        System.out.println("Successfully connected to
> "+repositoryURI+". Workspace="+ session.getWorkspace().getName() );
> 
>                Value[]
> access=session.getRepository().getDescriptorValues(Repository.OPTION_ACCESS_CONTROL_SUPPORTED);
>                for (Value value : access) {
>                        System.out.println("Access Control is supported: "
> +value.getString());
>                }
>                Thread.sleep(200);
> 
>                AccessControlManager acm =  session.getAccessControlManager();
> 
>                session.logout();
>        }
> 
> 
>        public static void main(String[] args) throws Exception {
>                new TestCaseACL();
>        }
> 
> }
> 
> The program was created with this pom.xml:
> <project xmlns="http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>        <modelVersion>4.0.0</modelVersion>
>        <groupId>de.ulrich.test</groupId>
>        <artifactId>justasample</artifactId>
>        <version>0.0.1-SNAPSHOT</version>
>        <build>
>                <plugins>
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>                                <artifactId>maven-compiler-plugin</artifactId>
>                                <configuration>
>                                        <source>1.7</source>
>                                        <target>1.7</target>
>                                </configuration>
>                        </plugin>
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>                                <artifactId>maven-javadoc-plugin</artifactId>
>                        </plugin>
>                </plugins>
>        </build>
>        <dependencies>
>                <dependency>
>                        <groupId>org.apache.jackrabbit</groupId>
>                        <artifactId>jackrabbit-standalone</artifactId>
>                        <version>2.7.0</version>
>                </dependency>
>        </dependencies>
> </project>
> 
> 
> 
> 
> 
> 
> The repository.xml has set this security-tags:
> <Security appName="Jackrabbit">
>   <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager"
> workspaceName="security"/>
>   <AccessManager
>  class="org.apache.jackrabbit.core.security.DefaultAccessManager"/>
>   <LoginModule
> 
>   
> class="org.apache.jackrabbit.core.security.authentication.DefaultLoginModule"/>
> </Security>

Reply via email to