【问题标题】:How to create module based application in J2EE for the large scale application?如何在 J2EE 中为大型应用程序创建基于模块的应用程序?
【发布时间】:2014-06-05 03:35:01
【问题描述】:

我们将使用 J2EE 开发大型应用程序。该应用程序包含许多模块,少数模块不直接与客户端通信。(即它将在​​单独的线程中处理,如 SNMP 侦听器、作业调度、轮询等)。

因此我们计划将应用程序拆分为基于模块的应用程序并在不同的服务器上运行,并与主 j2ee 应用程序集成以向用户展示结果。

谁能帮助我如何创建基于模块的应用程序并运行可以在不同服务器上运行的应用程序?

【问题讨论】:

    标签: java jakarta-ee module large-scale


    【解决方案1】:
    First thing you have to do is you should have a clear logical idea about hierarchical view of the modules. For example consider you will be having a security based module which should be always on top, other core featuring module will depend on the higher level modules.In such a way you must have a clear view about the level of modules. 
    
    Have a building script like ANT for each module separately to build/jar that module, have a global level ANT to call all the individual modules as per the order.
    
    Here, we have a similar architecture which has more than 10o different modules (both dependent on others and independent). Having these kind of structure you can able to skip any module that you don't wish, in a very simple manner.
    
    Sample Global Ant script
    --------------------------
    
    <target name="build.projects">
        <ant dir="${security.module}" antfile="build.xml" target="build.project" />
        <ant dir="${core.module}" antfile="build.xml" target="build.project" />
        <ant dir="${Resource.module}" antfile="build.xml" target="build.project" />
        <ant dir="${SNMP.module}" antfile="build.xml" target="build.project" />
        <ant dir="${util.module}" antfile="build.xml" target="build.project" />
    </target>
    
    and the Individual one..
    
    <project name="security.module" default="all" basedir=".">
        <target name="build.project" depends="-Properties, create.output, compile, jars" />
    </project>
    

    【讨论】:

    • 是的,我知道 maven 和 ant 提供基于模块的应用程序。我的问题是如果每个模块都在单独的服务器上运行,如何与模块进行黑白通信
    • 使用基于 JMX MBean 的通信。请参阅docs.oracle.com/javase/7/docs/technotes/guides/jmx/overview/…。让我知道以获得更多帮助。
    • 感谢您提供宝贵的信息。我刚刚听说带有 osgi 的 Apache cxf 也可以很好地用于这种情况。我可以知道哪个最好吗?
    • 这取决于您需要在不同服务器之间进行通信的案例/次数。如果它是最小的并且就像请求/响应一样,那么 Mbeans 将节省您的大部分时间。 Apache CXF 的更多内容(如果您有大量列表,请选择它)也可以在基于 Web 服务(SOAP/XML 格式)的 java 和 .net 服务器(跨平台)上使用。最后,一切都取决于依赖什么的设计和要求。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-06
    相关资源
    最近更新 更多