Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在本地tomcat(spring boot嵌入式)服务器上运行SpringBoot 1.5.10.RELEASE_Java_Spring_Spring Boot_Jmx - Fatal编程技术网

Java 无法在本地tomcat(spring boot嵌入式)服务器上运行SpringBoot 1.5.10.RELEASE

Java 无法在本地tomcat(spring boot嵌入式)服务器上运行SpringBoot 1.5.10.RELEASE,java,spring,spring-boot,jmx,Java,Spring,Spring Boot,Jmx,我已经将spring应用程序迁移到springBoot1.5.10.RLEASE 尝试在本地服务器上运行应用程序时出现以下错误,需要帮助解决此错误: 2018-02-14 18:51:24.173警告12028-[main] ationConfigEmbeddedWebApplicationContext:遇到异常 在上下文初始化期间-取消刷新尝试: org.springframework.beans.factory.BeanCreationException:错误 创建在类路径中定义了名为“b

我已经将spring应用程序迁移到springBoot1.5.10.RLEASE

尝试在本地服务器上运行应用程序时出现以下错误,需要帮助解决此错误:

2018-02-14 18:51:24.173警告12028-[main] ationConfigEmbeddedWebApplicationContext:遇到异常 在上下文初始化期间-取消刷新尝试: org.springframework.beans.factory.BeanCreationException:错误 创建在类路径中定义了名为“batchMBeanExporter”的bean 资源[app context.xml]:无法创建内部bean 类型的“org.springframework.aop.framework.ProxyFactoryBean5287ba5f” [org.springframework.aop.framework.ProxyFactoryBean]在设置 bean属性“jobService”;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为的bean 'org.springframework.aop.framework.ProxyFactoryBean5287ba5f': FactoryBean在创建对象时引发异常;嵌套异常是 org.springframework.beans.factory.noSuchBean定义异常:否 名为“jobService”的bean可用

bean创建仍然与springboot迁移之前相同:-

<bean id="batchMBeanExporter" class="org.springframework.batch.admin.jmx.BatchMBeanExporter">
        <property name="server" ref="mbeanServer" />
        <property name="jobService">
            <bean class="org.springframework.aop.framework.ProxyFactoryBean">
                <property name="targetName" value="jobService" />
                <property name="interceptorNames" value="cacheInterceptor" />
            </bean>
        </property>
        <property name="defaultDomain" value="etl.web.spring.application" />
        <property name="excludedBeans">
        <list>
            <value>integrationMBeanExporter</value>
        </list>
        </property>
</bean>
咖啡豆-

<bean id="cacheInterceptor" class="org.springframework.batch.admin.util.SimpleEhCacheInterceptor" >
        <property name="cacheName" value="webSimple_${env}"/>
</bean>
春季文件- 吉拉,同样-


它告诉您没有名为jobService的bean被设置为proxyFactoryBean上的属性。所以我的问题是,您是否在spring上下文中定义了一个名为JobService的bean,spring可以使用它和autowire。因此,在迁移之前,我们没有在spring上下文中创建JobService bean。我们需要在springboot中显式地为同一个bean创建bean吗?我不知道您想做什么。我所能告诉你的是,异常告诉你,当它试图自动连接到一个叫做JobService的东西时,它找不到它。我不知道你以前做过什么,也不知道它以前是怎么发现的。谢谢你的解决方案。。。它让我通过了异常..我在我的spring boot中遇到了以下错误app@EnableScheduling+Spring批处理管理由以下原因引起:java.lang.IllegalStateException:需要调用在目标类“SimpleJobService”上声明的方法“removeInactiveExecutions”,但在公开代理类型的任何接口中都找不到。通过在配置中强制使用代理目标类模式,将方法向上拉到接口或切换到CGLIB代理。很高兴答案很有用。
<bean id="cacheInterceptor" class="org.springframework.batch.admin.util.SimpleEhCacheInterceptor" >
        <property name="cacheName" value="webSimple_${env}"/>
</bean>
Now I am able to start the server without any of the above mentioned issues.

SimpleEhCacheInterceptor is removed from version 1.3.0 to remove explicit caching instead caching is implemented internally in version 1.3.0 of spring batch admin manager. JIRA for the same  https://jira.spring.io/browse/BATCHADM-133

After removing cacheInterceptor, application was throwing below issue-
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchMBeanExporter' defined in class path resource [app-context.xml]: Cannot create inner bean 'org.springframework.aop.framework.ProxyFactoryBean#4ae2e781' of type [org.springframework.aop.framework.ProxyFactoryBean] while setting bean property 'jobService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.framework.ProxyFactoryBean#4ae2e781': Post-processing of FactoryBean's object failed; nested exception is java.lang.IllegalStateException: Need to invoke method 'removeInactiveExecutions' declared on target class 'SimpleJobService', but not found in any interface(s) of the exposed proxy type. Either pull the method up to an interface or switch to CGLIB proxies by enforcing proxy-target-class mode in your configuration.

have set the proxyTargetClass property to true, now the embedded tomcat with spring boot is starting up without any issue.
working configuration:-
Spring batch admin manager version 1.3.1

    <bean id="batchMBeanExporter" class="org.springframework.batch.admin.jmx.BatchMBeanExporter">
        <property name="server" ref="mbeanServer" />
        <property name="jobService">
            <bean class="org.springframework.aop.framework.ProxyFactoryBean">
                <property name="targetName" value="jobService" />
                <property name="proxyTargetClass" value="true"/>
            </bean>
        </property>
        <property name="defaultDomain" value="spring.application" />
    </bean>

<bean id="jobService" class="org.springframework.batch.admin.service.SimpleJobServiceFactoryBean">
    <property name="jobRepository" ref="jobRepository"/>
    <property name="jobLauncher" ref="jobLauncher"/>
    <property name="jobLocator" ref="jobRegistry"/>
    <property name="dataSource" ref="dataSource"/>
</bean>