directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Karasulu <akaras...@apache.org>
Subject Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException
Date Fri, 14 Oct 2011 13:09:38 GMT
On Fri, Oct 14, 2011 at 3:43 PM, Harakiri <harakiri_23@yahoo.com> wrote:

> Hello,
>
> im trying to port my custom partition from 1.5.x to 2.0.0-M3.
>
> Im getting a ClassNotFoundException when using
>
> schemaManager.loadAllEnabled();
>
> lang.ClassNotFoundException:
> org.apache.directory.shared.ldap.schema.comparators.IntegerOrderingComparator
>
> This class isnt in the jar, infact there is no packet "comperators" or even
> "schema" in the jar at all.
>
> Additionally - im trying to port this code:
>
>  private void initSchemaPartition()
>            throws Exception {
>
>        SchemaPartition schemaPartition =
>            service.getSchemaService().getSchemaPartition();
>
>        // Init the LdifPartition
>        LdifPartition ldifPartition = new LdifPartition();
>        String workingDirectory     =
> service.getWorkingDirectory().getPath();
>
>        ldifPartition.setWorkingDirectory(workingDirectory + "/schema");
>
>        // Extract the schema on disk (a brand new one) and load the
> registries
>        File schemaRepository = new File(workingDirectory, "schema");
>        SchemaLdifExtractor extractor =
>            new DefaultSchemaLdifExtractor(new File(workingDirectory));
>
>        extractor.extractOrCopy(true);
>        schemaPartition.setWrappedPartition(ldifPartition);
>
>        SchemaLoader  loader        = new
> LdifSchemaLoader(schemaRepository);
>        SchemaManager schemaManager = new DefaultSchemaManager(loader);
>
>        service.setSchemaManager(schemaManager);
>
>        // We have to load the schema now, otherwise we won't be able
>        // to initialize the Partitions, as we won't be able to parse
>        // and normalize their suffix DN
>        schemaManager.loadAllEnabled();
>        schemaPartition.setSchemaManager(schemaManager);
>
>        List<Throwable> errors = schemaManager.getErrors();
>
>        if (errors.size() != 0) {
>            throw new Exception("Schema load failed : " + errors);
>        }
>
>    }
>
> i got as far as this but im not sure if this is correct (because of the
> class not found exception) :
>
>  private void initSchemaPartition()
>            throws Exception {
>         String workingDir    = workingDirectory.getPath();
>
>
>        // Extract the schema on disk (a brand new one) and load the
> registries
>        File schemaRepository = new File(workingDir, "schema");
>        SchemaLdifExtractor extractor =
>            new DefaultSchemaLdifExtractor(new File(workingDir));
>
>        extractor.extractOrCopy(true);
>
>
>        SchemaLoader  loader        = new
> LdifSchemaLoader(schemaRepository);
>        SchemaManager schemaManager = new DefaultSchemaManager(loader);
>
>        // Init the LdifPartition
>        LdifPartition ldifPartition = new LdifPartition(schemaManager);
>
>
>        service.setSchemaManager(schemaManager);
>        schemaManager.loadAllEnabled();
>
>
>        List<Throwable> errors = schemaManager.getErrors();
>
>        if (errors.size() != 0) {
>            throw new Exception("Schema load failed : " + errors);
>        }
> }
>
> Thanks for your assistance!
>

There are several references to fully qualified class names in the schema
partition which will cause problems for you when moving from the old version
to the latest release. This is due to class renaming, deletions, and package
movement.

I recommend you export an LDIF of your DIT and reimport it on the latest
release. This is the least painful most well defined path you can follow for
an upgrade at this present time.

-- 
Best Regards,
-- Alex

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message