我正在尝试使用需要Amazon AWS库的Proguard缩小Scala项目。原始的JAR文件按预期工作,但是缩小的文件会引发一个异常,即某些类不实现MBean约定。在使用" -keep"之前,我整理了几个类似的问题。选项,但这次我输了。
有什么想法如何解决它?
Jul 02, 2016 9:29:38 AM com.amazonaws.jmx.SdkMBeanRegistrySupport registerMetricAdminMBean
WARNING:
java.lang.IllegalArgumentException: javax.management.NotCompliantMBeanException: MBean class com.amazonaws.metrics.MetricAdmin does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.amazonaws.metrics.MetricAdmin: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant MXBean)
at com.amazonaws.jmx.MBeans.registerMBean(MBeans.java:56)
at com.amazonaws.jmx.SdkMBeanRegistrySupport.registerMetricAdminMBean(SdkMBeanRegistrySupport.java:27)
at com.amazonaws.metrics.AwsSdkMetrics.registerMetricAdminMBean(AwsSdkMetrics.java:390)
at com.amazonaws.metrics.AwsSdkMetrics.<clinit>(AwsSdkMetrics.java:351)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.<clinit>(AmazonDynamoDBClient.java:245)
at mycode.MinimalTest$.entry(MinimalTest.scala:275)
at mycode.MinimalTest$.main(MinimalTest.scala:248)
at mycode.MinimalTest.main(MinimalTest.scala)
Caused by: javax.management.NotCompliantMBeanException: MBean class com.amazonaws.metrics.MetricAdmin does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.amazonaws.metrics.MetricAdmin: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant MXBean)
at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:176)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:317)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at com.amazonaws.jmx.MBeans.registerMBean(MBeans.java:52)
... 7 more
Jul 02, 2016 9:29:38 AM com.amazonaws.jmx.SdkMBeanRegistrySupport registerMetricAdminMBean
WARNING:
java.lang.IllegalArgumentException: javax.management.NotCompliantMBeanException: MBean class com.amazonaws.metrics.MetricAdmin does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.amazonaws.metrics.MetricAdmin: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant MXBean)
at com.amazonaws.jmx.MBeans.registerMBean(MBeans.java:56)
at com.amazonaws.jmx.SdkMBeanRegistrySupport.registerMetricAdminMBean(SdkMBeanRegistrySupport.java:27)
at com.amazonaws.metrics.AwsSdkMetrics.registerMetricAdminMBean(AwsSdkMetrics.java:399)
at com.amazonaws.metrics.AwsSdkMetrics.<clinit>(AwsSdkMetrics.java:351)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.<clinit>(AmazonDynamoDBClient.java:245)
at mycode.MinimalTest$.entry(MinimalTest.scala:275)
at mycode.MinimalTest$.main(MinimalTest.scala:248)
at mycode.MinimalTest.main(MinimalTest.scala)
Caused by: javax.management.NotCompliantMBeanException: MBean class com.amazonaws.metrics.MetricAdmin does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.amazonaws.metrics.MetricAdmin: Class com.amazonaws.metrics.MetricAdmin is not a JMX compliant MXBean)
at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:176)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:317)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at com.amazonaws.jmx.MBeans.registerMBean(MBeans.java:52)
... 7 more
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:531)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:448)
at com.amazonaws.internal.config.InternalConfig.<clinit>(InternalConfig.java:43)
at com.amazonaws.internal.config.InternalConfig$Factory.<clinit>(InternalConfig.java:304)
at com.amazonaws.util.VersionInfoUtils.userAgent(VersionInfoUtils.java:141)
at com.amazonaws.util.VersionInfoUtils.initializeUserAgent(VersionInfoUtils.java:136)
at com.amazonaws.util.VersionInfoUtils.getUserAgent(VersionInfoUtils.java:97)
at com.amazonaws.ClientConfiguration.<clinit>(ClientConfiguration.java:60)
at com.amazonaws.ClientConfigurationFactory.getDefaultConfig(ClientConfigurationFactory.java:46)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientConfigurationFactory.getDefaultConfig(AmazonDynamoDBClientConfigurationFactory.java:31)
at com.amazonaws.ClientConfigurationFactory.getConfig(ClientConfigurationFactory.java:36)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClient.<init>(AmazonDynamoDBAsyncClient.java:319)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClient.<init>(AmazonDynamoDBAsyncClient.java:299)
at mycode.MinimalTest$.entry(MinimalTest.scala:275)
at mycode.MinimalTest$.main(MinimalTest.scala:248)
at mycode.MinimalTest.main(MinimalTest.scala)
Caused by: java.lang.NullPointerException
at com.fasterxml.jackson.databind.cfg.MapperConfig.collectFeatureDefaults(MapperConfig.java:88)
at com.fasterxml.jackson.databind.cfg.MapperConfigBase.<clinit>(MapperConfigBase.java:31)
... 16 more
答案 0 :(得分:1)
您必须指示ProGuard保持MBean类不被混淆,以遵循标准MBean约定。这样的规则可能就足够了:
-keep class **MBean {
void set*(***);
void set*(int, ***);
boolean is*();
boolean is*(int);
*** get*();
*** get*(int);
}
这将指示ProGuard保留所有类似* MBean的类,并保留任何getter / setter。