【问题标题】:How to correctly add JVM System properties flag如何正确添加 JVM 系统属性标志
【发布时间】:2019-03-15 16:55:31
【问题描述】:

在 Solr 日志中我看到错误 -

java.lang.UnsupportedOperationException: Serialization support for 
org.apache.commons.collections.functors.InvokerTransformer is disabled for
security reasons. To enable it set system property 
'org.apache.commons.collections.enableUnsafeSerialization' to 'true',
but you must ensure that your application does not de-serialize
 objects from untrusted sources.

我正在尝试添加标志-Dorg.apache.commons.collections.enableUnsafeSerialization=true,但它没有帮助。 如何正确启用此属性? (我无法访问 solrconfig.xml)

【问题讨论】:

    标签: java apache solr jvm


    【解决方案1】:

    您可以将其添加到SOLR_OPTS环境变量中或直接传递给启动脚本:

    bin/solr start -Dorg.apache.commons.collections.enableUnsafeSerialization=true
    

    根据Configuring solrconfig.xml docs

    通常,您要设置的任何 Java 系统属性都可以使用标准 -Dproperty=value 语法通过 bin/solr 脚本传递。或者,您可以将常用系统属性添加到 Solr 包含文件(bin/solr.in.sh 或 bin/solr.in.cmd)中定义的 SOLR_OPTS 环境变量。

    【讨论】:

    • 你能举个例子吗,如何正确地将它添加到 SOLR_OPTS 中?
    • @Bookin 修改环境变量取决于你的操作系统
    • 是的,我正在尝试使用-D 参数,但看起来没有帮助
    猜你喜欢
    • 2012-11-25
    • 1970-01-01
    • 2015-07-25
    • 2012-04-01
    • 1970-01-01
    • 2023-03-06
    • 2013-05-29
    • 1970-01-01
    • 2018-04-01
    相关资源
    最近更新 更多