2017-11-09 14 views
1

は私がのMBeanServer JMXサポートを使用しようとしていると はMBeanServerのための例外の下になって:私は8-OpenJDKのとwildflyのJBossサーバー、無コンパイル時のエラーを使用していますjava.lang.NoSuchMethodError:org.springframework.jmx.support.MBeanServerFactoryBean.getObject()Ljavax/management/MBeanServer;

Caused by: java.lang.NoSuchMethodError: org.springframework.jmx.support.MBeanServerFactoryBean.getObject()Ljavax/management/MBeanServer; 
    at com.ctil.PaymentsApplication.mbeanServer(PaymentsApplication.java:239) 
    at com.ctil.PaymentsApplication$$EnhancerBySpringCGLIB$$411b63e3.CGLIB$mbeanServer$3(<generated>) 
    at com.ctil.PaymentsApplication$$EnhancerBySpringCGLIB$$411b63e3$$FastClassBySpringCGLIB$$c3de57c.invoke(<generated>) 
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) 
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312) 
    at com.ctil.PaymentsApplication$$EnhancerBySpringCGLIB$$411b63e3.mbeanServer(<generated>) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166) 
    ... 28 more 

クラス構成のanotations:

@Configuration 
@EnableJpaRepositories 
@EnableJpaAuditing 
@Import({ RepositoryRestMvcConfiguration.class,JMSSQSConfig.class}) 
@ComponentScan 
@EnableAutoConfiguration 
@EnableAspectJAutoProxy(proxyTargetClass = true) 
@EnableTransactionManagement(proxyTargetClass = true) 
@EnableScheduling 

方法投げているエラー:

@Bean 
    public MBeanServer mbeanServer() { 
     System.out.println("INSIDE FACTORY CREATE******"); 
     SpecificPlatform platform = SpecificPlatform.get(); 
     if (platform != null) { 
      return platform.getMBeanServer(); 
     } 
     MBeanServerFactoryBean factory = new MBeanServerFactoryBean(); 
     factory.setLocateExistingServerIfPossible(true); 
     factory.afterPropertiesSet(); 
     return factory.getObject(); 
    } 


@Bean 
public AnnotationMBeanExporter annotationMBeanExporter() throws MalformedObjectNameException { 
    AnnotationMBeanExporter exporter = new AnnotationMBeanExporter(); 
    ObjectName name = new ObjectName("com.ctil.payments.transactionProcessor","transacionProcessorConfiguration","TransactionProcessorConfiguration"); 
    exporter.setServer(mbeanServer()); 
    exporter.setDefaultDomain("com.ctil.payments.transactionProcessor"); 

    if (!exporter.getServer().isRegistered(name)) { 

     TransactionProcessorConfiguration config = new TransactionProcessorConfiguration(); 
     exporter.registerManagedResource(config, name); 

    } 
    return exporter; 

} 

のpom.xml:

<dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-jdbc</artifactId> 
      <exclusions> 
       <exclusion> 
        <groupId>org.apache.tomcat</groupId> 
        <artifactId>tomcat-jdbc</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

     <dependency> 
      <groupId>javax.xml.soap</groupId> 
      <artifactId>saaj-api</artifactId> 
      <version>1.3.5</version> 
     </dependency> 

     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-ws</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>wsdl4j</groupId> 
      <artifactId>wsdl4j</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-security</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-oxm</artifactId> 
     </dependency> 

<dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jmx</artifactId> 
      <version>2.0.8</version> 
     </dependency> 

私はUbuntuの16.04、64ビットマシンを使用しています。 この設定はすべてWindowsシステムで動作しています。 私もoracle-8 jdkを使用しようとしましたが、同じエラーが発生しました。 バージョン管理の問題のようですが、解決できません。あなたのpom.xmlから次

+0

あなたの春のブートバージョンは何ですか? – mhshimul

+0

@mhshimul spring-boot-1.1.10 – Mousam

答えて

0

削除:

<dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-jmx</artifactId> 
     <version>2.0.8</version> 
    </dependency> 
+0

Worked、ありがとうございました – Mousam

+0

スプリングブートスターターにはすでに依存関係があります。しかし、getObject()メソッドが欠けていた古いバージョンの依存関係を提供していました。 – mhshimul

+0

同じバージョンのspring-boot-starterを使用しているWindowsマシンを使用している他の人のために働いていたことは分かりません。 ubuntuのためにだけそれは間違いを投げていた。 – Mousam