lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-5471) Classloader issues when running Lucene under a java SecurityManager
Date Tue, 25 Feb 2014 21:03:22 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-5471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13912054#comment-13912054
] 

Hoss Man commented on LUCENE-5471:
----------------------------------

bq. Even more puzzling, the program works if I first run it without a SecurityManager, then
install a SecurityManager, then re-run the program, all within the lifetime of a single JVM.


I suspect this is because of when/how SPI is used - if the codec is resolved before you load
the security manager, then that info is still available in NamedSPILoader.

if you did a NamedSPILoader.reload() on your classloader after activating the SecurityManager,
you'd probably see the same problem no matter what.

bq. I think its a bug in your securitymanager config (e.g. you are missing reflectpermission
or something really necessary).

yeah ... w/o showing us what security manager you are using, it's hard to guess what the specific
problem might be.

that said: it's strange that you got an IllegalArgumentException from NamedSPILoader instead
of a SecurityException ... i can't think of any (legitimate) reason why that should have happened,
unless we're swallowing RuntimeExceptions in the SPI Loader code?

> Classloader issues when running Lucene under a java SecurityManager
> -------------------------------------------------------------------
>
>                 Key: LUCENE-5471
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5471
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 4.5
>            Reporter: Rick Hillegas
>         Attachments: SecureLucene.java
>
>
> I see the following error when I run Lucene 4.5.0 under a java SecurityManager. I will
attach a test program which shows this problem. The program works fine when a SecurityManager
is not installed. But the program fails when I install a SecurityManager. Even more puzzling,
the program works if I first run it without a SecurityManager, then install a SecurityManager,
then re-run the program, all within the lifetime of a single JVM. I would appreciate advice
about how to work around this problem:
> Exception in thread "main" java.lang.ExceptionInInitializerError
> 	at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:122)
> 	at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:165)
> 	at SecureLucene$1.run(SecureLucene.java:129)
> 	at SecureLucene$1.run(SecureLucene.java:122)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at SecureLucene.getIndexWriter(SecureLucene.java:120)
> 	at SecureLucene.runTest(SecureLucene.java:72)
> 	at SecureLucene.main(SecureLucene.java:52)
> Caused by: java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec
with name 'Lucene45' does not exist. You need to add the corresponding JAR file supporting
this SPI to your classpath.The current classpath supports the following names: []
> 	at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109)
> 	at org.apache.lucene.codecs.Codec.forName(Codec.java:95)
> 	at org.apache.lucene.codecs.Codec.<clinit>(Codec.java:122)
> 	... 8 more



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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


Mime
View raw message