栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在单个Weblogic域的同一群集中部署两个Spring批处理应用程序?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在单个Weblogic域的同一群集中部署两个Spring批处理应用程序?

我找到了解决此问题的方法。由于无法注册Mbean,因此我们需要覆盖jmx-context.xml,该文件将扫描具有不同域名的jmx Mbean。

在/ meta-INF / spring / batch / override /目录下的具有覆盖上下文的批处理项目中的一个项目中创建jmx-
context.xml:覆盖用于扫描的mbean-export和用于集成Mbean的int-jmx:mbean-export,如下所示-

/meta-INF/spring/batch/override/jmx-context.xml-

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:int-jmx="http://www.springframework.org/schema/integration/jmx" xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/integration/jmx http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">    <int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application.mybatch" server="mbeanServer" />    <context:mbean-export default-domain="spring.application.mybatch" server="mbeanServer" /></beans>

确保为该春季批处理项目更改具有唯一名称的默认域。实施此解决方案后,我使两个批处理应用程序在Weblogic域内的单个群集中同时运行。

重要的是,将jmx-context.xml作为/ appa-INF / spring / batch / override
/作为您在servlet.xml文件中导入的webapp-config.xml放置,以便配置管理控制台,并从该替代中导入所有*
.xml文件夹&可以用来覆盖任何默认配置。仅供参考,我在这里从spring-batch-admin-manager-resources
jar复制了webapp-config.xml的内容,应将其作为项目中的依赖项引入。

/org/springframework/batch/admin/web/resources/webapp-config.xml-

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">    <!-- Workaround for INT-1831 -->    <bean id="dummy" />    <import resource="classpath*:/meta-INF/spring/batch/bootstrap*.xml" />    <import resource="classpath*:/meta-INF/spring/batch/override*.xml" />    <bean id="parameterUnpackerFilter" >        <property name="prefix" value="unpack_"/>        <property name="putEmptyParamsInPath" value="true"/>    </bean></beans>

以防万一,如果您想知道我们将webapp-
config.xml导入哪里,我放下了servlet.xml的内容来配置批处理管理控制台,您在启动时将其加载到项目的web.xml中。

/WEB-INF/config/spring-beans/servlet.xml-

<?xml version="1.0" encoding="UTF-8" ?><beans xmlns="http://www.springframework.org/schema/beans"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">    <!-- Spring Batch Admin -->      <import resource="classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml"/>    <import resource="classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml"/>    <bean id="resourceService" >        <property name="servletPath" value="/batch" />    </bean></beans>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/609811.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号