Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-07 Thread Stefan Seelmann
Andrew Wiley wrote:
 For some reason, when I switched from apacheds-all to apacheds-server-integ,
 Maven started downloading source code successfully (there might be something
 wrong there), so I was able to debug it and found that it was throwing the
 error while opening a bad jar file (Maven downloaded the 301 moved
 permanently error page instead of the actual jar file). I guess that
 exceptions like that should really be handled by printing out an error
 message and continuing, because even if there are corrupt jar files in the
 class path, they should probably just be skipped.

You are totally right. I created a Jira:
  https://issues.apache.org/jira/browse/DIRSERVER-1491

 However, I'm new here and I don't know your practices. Thanks for your help!

Thanks for sharing your experience and for showing the pitfalls.

Kind Regards,
Stefan



Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-07 Thread Stefan Seelmann
Andrew Wiley wrote:
 Actually, it turns out that if I change the method definition to this:
 JdbmPartition partition = new JdbmPartition();
 partition.setId( partitionId );
 partition.setSuffix( partitionDn );
 partition.setSchemaManager(service.getSchemaManager());
 partition.setPartitionDir(new
 File(service.getWorkingDirectory().getAbsolutePath() + File.pathSeparator +
 partitionId));
 partition.initialize();
 service.addPartition( partition );
 
 Everything works. Is this how I should be determining the PartitionDir?

Yes, that looks good.

I think it is not necessary to explicitely call partition.initialize()
but I may be wrong.

 Also, should I be worried about the few hundred log lines of the form:
 6118 [main] INFO org.apache.directory.server.core.entry.ServerStringValue  -
 Cannot normalize the value :ERR_04226 I do not know how to handle
 NameAndOptionalUID normalization with objects of class: [Class Name]

No, don't worry. You can set the log level to warn or error in your
log4j.properties. The *Value classes are work in progress, btw.

Kind Regards,
Stefan




Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-06 Thread Stefan Seelmann
Andrew Wiley wrote:
 Caused by: java.util.zip.ZipException: error in opening zip file
 at java.util.zip.ZipFile.open(Native Method)
 at java.util.zip.ZipFile.init(ZipFile.java:131)
 at java.util.zip.ZipFile.init(ZipFile.java:148)
 at
 org.apache.directory.shared.ldap.schema.ldif.extractor.impl.ResourceMap.getResourcesFromJarFile(ResourceMap.java:94)

Something is happening here. Unfortunately the ZipException doesn't say
which file it wants to open. We have to add more logging to the
ResourceMap code.

 It looks like the server is trying to extract the core schema from a zip/jar
 file and for some reason this is failing. The only cause I can think of is
 that the files aren't present. I'm using a Maven-based project that includes
 apacheds-all, which depends on shared-ldap and shared-ldap-schema, and I'm
 pretty sure the schema files are supposed to be in there? What am I doing
 wrong?

I guess you are using Version 1.5.6?

Could you please try to remove the apacheds-all dependency and add the
apacheds-server-integ instead?

dependency
  groupIdorg.apache.directory.server/groupId
  artifactIdapacheds-server-integ/artifactId
  version1.5.6/version
/dependency

Kind Regards,
Stefan




Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-06 Thread Andrew Wiley
On Tue, Apr 6, 2010 at 9:06 AM, Andrew Wiley debio...@gmail.com wrote:

 Where would I find the artifact for ldap-client-api? It's not in the Maven
 repository, and apacheds-server-integ depends on it.


Nevermind, Maven wouldn't download it until I added it explicitly as a
dependency. Not sure why that happened.
I seem to be getting the same error and the same log with
apacheds-server-integ. Should I post up my pom.xml?

Thanks,
Andrew Wiley


Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-06 Thread Stefan Seelmann
Andrew Wiley wrote:

 Where would I find the artifact for ldap-client-api? It's not in the Maven
 repository, and apacheds-server-integ depends on it.

Damn, the server-integ pom contains a snapshot dependency.

dependency
  groupIdorg.apache.directory.client.ldap/groupId
  artifactIdldap-client-api/artifactId
  version0.1-SNAPSHOT/version
/dependency

The release plugin should prevent us from doing that...

Stefan




Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-06 Thread Andrew Wiley
On Tue, Apr 6, 2010 at 2:02 PM, Andrew Wiley debio...@gmail.com wrote:



 On Tue, Apr 6, 2010 at 9:21 AM, Stefan Seelmann seelm...@apache.orgwrote:

 Andrew Wiley wrote:
  Nevermind, Maven wouldn't download it until I added it explicitly as a
  dependency. Not sure why that happened.
  I seem to be getting the same error and the same log with
  apacheds-server-integ. Should I post up my pom.xml?

 Yes, please post it to pastebin or so.


 Pastebin at http://pastebin.com/LiAt4m1y


For some reason, when I switched from apacheds-all to apacheds-server-integ,
Maven started downloading source code successfully (there might be something
wrong there), so I was able to debug it and found that it was throwing the
error while opening a bad jar file (Maven downloaded the 301 moved
permanently error page instead of the actual jar file). I guess that
exceptions like that should really be handled by printing out an error
message and continuing, because even if there are corrupt jar files in the
class path, they should probably just be skipped.
However, I'm new here and I don't know your practices. Thanks for your help!

Thanks,
Andrew Wiley


Re: Starting Embedded ApacheDS - Fails to Extract Schema?

2010-04-06 Thread Andrew Wiley
It looks like I'm not home free yet. I'm following the example for embedding
ApacheDS, and the example's addPartition method seems to be broken as well.
The body of the method is this:
JdbmPartition partition = new JdbmPartition();
partition.setId( partitionId );
partition.setSuffix( partitionDn );
service.addPartition( partition );

return partition;

This crashes in service.addPartition with this:
java.lang.NullPointerException
at
org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore.init(JdbmStore.java:269)
at
org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition.initialize(JdbmPartition.java:164)
at
org.apache.directory.server.core.partition.DefaultPartitionNexus.addContextPartition(DefaultPartitionNexus.java:916)
at
org.apache.directory.server.core.DefaultDirectoryService.addPartition(DefaultDirectoryService.java:597)
at
org.wileynet.slinad.embedded.EmbeddedADS.addPartition(EmbeddedADS.java:69)
at org.wileynet.slinad.embedded.EmbeddedADS.init(EmbeddedADS.java:113)
at org.wileynet.slinad.embedded.EmbeddedADS.init(EmbeddedADS.java:177)
at org.wileynet.slinad.embedded.EmbeddedADS.main(EmbeddedADS.java:192)

As far as I can tell, the problem is that JdbmStore.workingDirectory is
never initialized, leading to a NullPointerException when JdbmStore.init
tries to create it. JdbmStore has a setWorkingDirectory method... should I
be calling it or should it be populated along the way? I don't see how I
would populate it because I'm creating a JdbmPartition, and my code doesn't
have a way to get a reference to the JdbmStore reference, at least not
directly, as far as I can tell.

Thanks,
Andrew Wiley