2012-04-17 134 views
0

我在Ubuntu Linux 10.04上安装了Karaf(2.2.5)。 安装ActiveMQ作为Karaf顶部的功能。 用跺脚连接器创建自定义代理。 现在,当我尝试从Java客户端连接到这个stomp代理时,我得到“java.net.SocketTimeoutException:读取超时”在OSGI(KARAF)上使用ActiveMQ上的STOMP问题

如果我作为独立应用程序启动ActiveMQ,同一个客户端可以正常工作。

由于提前

这里是我的配置:

<beans 
    xmlns="http://www.springframework.org/schema/beans" 
    xmlns:amq="http://activemq.apache.org/schema/core" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:osgi="http://www.springframework.org/schema/osgi" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd 
    http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd 
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> 
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> 
    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="dios" dataDirectory="${karaf.data}/activemq/dios" useShutdownHook="false"> 
     <destinationPolicy> 
      <policyMap> 
       <policyEntries> 
       <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb"> 
        <pendingSubscriberPolicy> 
        <vmCursor /> 
        </pendingSubscriberPolicy> 
       </policyEntry> 
       <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb"> 
       </policyEntry> 
       </policyEntries> 
      </policyMap> 
     </destinationPolicy> 
     <managementContext> 
      <managementContext createConnector="false"/> 
     </managementContext> 
     <persistenceAdapter> 
      <kahaDB directory="${karaf.data}/activemq/dios/kahadb"/> 
     </persistenceAdapter> 
     <shutdownHooks> 
      <bean xmlns="http://www.springframework.org/schema/beans" id="hook" class="org.apache.activemq.hooks.SpringContextHook" /> 
     </shutdownHooks> 
     <transportConnectors> 
      <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> 
      <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?trace=true"/> 
     </transportConnectors> 
    </broker> 
    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
     <property name="brokerURL" value="tcp://0.0.0.0:61616" /> 
    </bean> 
    <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"> 
     <property name="maxConnections" value="8" /> 
     <property name="connectionFactory" ref="activemqConnectionFactory" /> 
    </bean> 
    <bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource"> 
      <property name="transactionManager" ref="transactionManager" /> 
      <property name="connectionFactory" ref="activemqConnectionFactory" /> 
      <property name="resourceName" value="activemq.dios" /> 
    </bean> 
    <osgi:reference id="transactionManager" interface="javax.transaction.TransactionManager" /> 
    <osgi:service ref="pooledConnectionFactory"> 
     <osgi:interfaces> 
      <value>javax.jms.ConnectionFactory</value> 
     </osgi:interfaces> 
     <osgi:service-properties> 
      <entry key="name" value="dios"/> 
     </osgi:service-properties> 
    </osgi:service> 
</beans> 
+0

任何人都可以请帮忙吗?我卡在这里! – 2012-04-18 13:10:21

+0

你可以把你的经纪人配置在这里吗?如果他们不理解这个问题,人们就无能为力。 – Buchi 2012-04-18 18:47:02

回答

0

我看不到一个明显的问题,你的配置我个人而言,我一直在使用OSGi的春天,因为我一直遇到停止开机时间竞赛条件。 Spring的<osgi:service>使用超时,所以延迟引导会扰乱一切。以下替代模式运作得非常好,我Karaf 2.2.4下:

  • 此回购添加到我等/ org.apache.karaf.features.cfg文件:mvn:org.apache.activemq/activemq-karaf/${activemq.version}/xml/features
  • 添加等/ activemq-通过Blueprint编写的broker.xml文件。我从an example XML from Talend开始,并根据我的需要进行了定制。
  • 声明上的ActiveMQ,蓝图的依赖在我自己的features.xml文件像这样:<feature version="${activemq.version}">activemq-blueprint</feature>
  • 声明一个XML文件中我features.xml:<bundle>blueprint:file:etc/activemq-broker.xml</bundle>

我不是蓝图的大风扇一般来说,但它使这个配置对我来说非常简单。