lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DM Smith <dm-sm...@woh.rr.com>
Subject Exception in migrating from 2.9.x to 3.0.2 on Android
Date Sat, 04 Dec 2010 23:16:08 GMT
The current code that works on Android with 2.9.1, but fails with 3.0.2:

Directory dir = FSDirectory.open(file);
...
do something with directory
...

The error we're seeing is:
12-04 21:34:41.629: WARN/System.err(23160): java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory
12-04 21:34:41.639: WARN/System.err(23160):     at org.apache.lucene.store.NativeFSLockFactory.acquireTestLock(NativeFSLockFactory.java:87)
12-04 21:34:41.639: WARN/System.err(23160):     at org.apache.lucene.store.NativeFSLockFactory.makeLock(NativeFSLockFactory.java:142)
12-04 21:34:41.649: WARN/System.err(23160):     at org.apache.lucene.store.Directory.makeLock(Directory.java:106)
12-04 21:34:41.649: WARN/System.err(23160):     at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:1058)

Turns out Android does not have java.lang.management.ManagementFactory. 

There are several work arounds in client code, but not sure what is best.

The bigger question is whether and how Lucene should be modified to accommodate?

Ultimately FSDirectory.open does the following:
    if (Constants.WINDOWS) {
      return new SimpleFSDirectory(path, lockFactory);
    } else {
      return new NIOFSDirectory(path, lockFactory);
    }

Should Android be a supported client OS?

If so, wouldn't it be better not to have OS specific if-then-else and use reflection or something
else?

Thanks,
	DM
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message