【问题标题】:Hazelcast Management Center ConfigurationHazelcast 管理中心配置
【发布时间】:2014-06-02 01:44:06
【问题描述】:

我创建了一个 Spring、Hibernate、Hazelcast 集成应用程序。

Spring Config 文件如下所示:- SpringDispatcher-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:mvc="http://www.springframework.org/schema/mvc"
            xmlns:hz="http://www.hazelcast.com/schema/spring"
            xmlns:context="http://www.springframework.org/schema/context"
            xsi:schemaLocation="
                http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
                http://www.hazelcast.com/schema/spring
                http://www.hazelcast.com/schema/spring/hazelcast-spring-3.0.xsd">
         -->


         <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:hz="http://www.hazelcast.com/schema/spring"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.hazelcast.com/schema/spring
        http://www.hazelcast.com/schema/spring/hazelcast-spring-3.2.xsd">





        <hz:hazelcast id="hazelastInstance">


            <hz:config>


                <hz:group name="dev" password="password" />
                <hz:network port="5701" port-auto-increment="false">
                    <hz:join>
                        <hz:multicast enabled="false" multicast-group="225.225.225.0"
                            multicast-port="54327" />

                        <hz:tcp-ip enabled="true">
                            <hz:members>192.168.0.101, 192.168.0.104</hz:members>
                        </hz:tcp-ip>
                    </hz:join>
                </hz:network>
                <!-- <hz:map name="map" backup-count="2" max-size="0"
                    eviction-percentage="30" read-backup-data="true" cache-value="true"
                    eviction-policy="NONE" merge-policy="com.hazelcast.map.merge.PassThroughMergePolicy" /> -->
            </hz:config>
            </hz:hazelcast>




        <!-- <bean id="sessionFactory"
                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
                <property name="configLocation">
                    <value>classpath:hibernate.cfg.xml</value>
                </property>
                <property name="configurationClass">
                    <value>org.hibernate.cfg.Configuration</value>
                </property>
            </bean> -->


        <bean id="sessionFactory"  class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
         <property name="dataSource" ref="dataSource"></property>
         <property name="packagesToScan" value="com.last.forms"></property>
         <property name="hibernateProperties">
            <props>
                <prop key="dialect">org.hibernate.dialect.MySQL5Dialect</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
                <prop key="show_sql">false</prop>
                <prop key="connection.pool_size">1</prop>
            </props>
         </property>    


         <property name="configLocation">
                    <value>classpath:hibernate.cfg.xml</value>
                </property>
        </bean>


        <bean id="dataSource" 
            class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
              <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
              <property name="url" value="jdbc:mysql://localhost/mock_data" /> 
              <property name="username" value="root" /> 
              <property name="password" value="root" /> 
           </bean> 


           <context:component-scan base-package="com.last.controllers" />
         <mvc:annotation-driven />




           <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                <property name="prefix" value="/WEB-INF/jsp/" />
                <property name="suffix" value=".jsp" />
            </bean>

        </beans>

各种 Hazelcast 教程要求我在 Hazelcast.xml 中复制以下代码行。

    <management-center enabled="true">http://localhost:8080/mancenter-3.2-RC2</management-center>

但我不使用最后在 Hazelcast 包的 bin 文件夹中找到的 Hazelcast.xml。

相反,我将 Hazelcast jar 复制到了 eclipse 中的 lib 文件夹中。

我需要在我的工作区中进行哪些配置才能运行 Mancenter 管理中心?

【问题讨论】:

  • 请注意我的 mancenter-3.2-RC2.war 部署在服务器上。
  • 我也尝试通过单击部分“或单击此处动态分配网址(不推荐)”从 man.center 连接到 hazelcast 实例

标签: java spring configuration center hazelcast


【解决方案1】:

Mancenter 管理中心就像一个独立的网络应用程序。您可以在您的 Web 应用程序服务器中部署它的 WAR,它应该可以运行。为确保它已启动并运行,请尝试从浏览器中点击它。完成后,将 hazelcast 设置为连接到它。这是在 hazelcast.xml 中完成的。

<management-center enabled="true">http://localhost:8080/mancenter-3.2-RC2</management-center>

您的 hazelcast.xml 应该在您的应用程序类路径中 - 否则,将使用默认 hazelcast.xml。

另外,请确保 mancenter 版本和 hazelcast 版本匹配。

【讨论】:

  • 感谢 cricsync。我不知道命名空间的概念:这就是问题所在。我使用 并且效果很好
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-07-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多