lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Exception in migrating from 2.9.x to 3.0.2 on Android
Date Sun, 05 Dec 2010 10:16:14 GMT
Hi DM,

In Lucene 3.0.3, NativeFSLockFactory no longer aquires a test log and does
not need the process ID anymore, so java.lang.management package is no
longer used.

In general, Lucene Java is compatible to the Java 5 SE specification.
Android uses Harmony and therefore we cannot guarantee compatibility as
Harmony is not TCK tested (but we do with latest versions, soon there will
also be tests on Hudson with Harmony). But only latest versions of Harmony
are really compatible with Lucene, previous versions fail lots of tests (ask
Robert), and Android phones use very antique versions of Harmony - it is not
even sure, that the Java5 Memory Model is correctly implemented in Dalvik!

About 3.0.2: Of course this version even works with latest Harmony, so
Harmony has java.lang.management package (which is java.lang!!!), so the bug
is in Android, simply by excluding a SE package. So you should open bug
report at Google and then hope that they fix it and all the phone
manufacturers like Motor-Roller will update their Android versions.

For your problem: The easy workaround is using Lucene 3.0.3 or simply use
another LockFactory (Andoid is single user so even NoLockFactory would be
fine in most cases). This are the same limitations like with the NFS
filesystem. Just use FSDir.open(dir, lockFactory).

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: DM Smith [mailto:dm-smith@woh.rr.com]
> Sent: Sunday, December 05, 2010 12:16 AM
> To: dev@lucene.apache.org
> Subject: Exception in migrating from 2.9.x to 3.0.2 on Android
> 
> 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(NativeFSLock
> Factory.java:87)
> 12-04 21:34:41.639: WARN/System.err(23160):     at
> org.apache.lucene.store.NativeFSLockFactory.makeLock(NativeFSLockFactor
> y.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



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


Mime
View raw message