Announcement Announcement Module
Collapse
No announcement yet.
intermittent activmeq schema failure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • intermittent activmeq schema failure

    I'm trying to deploy an embedded activemq broker in a war bundle. However, I seem to get an intermittent error that requires me to deploy my war with the activemq schema references in place successfully before actually putting in the broker config. I have a bundle dependency on com.springsource.org.apache.activemq 5.3.0 in my war, with a corresponding embedded broker configuration. However, when I try to start the war bundle I get an initialization error:

    Code:
    XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://activemq.apache.org/schema/core/activemq-core.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    The only way I've found to make this work is to add the activemq schema references into the beans tag and deploy the war (which it does successfully) and then add the broker config and redeploy. That works reliably, but every time I restart my server I have to remove the broker configuration, deploy the war, add the broker configuration back in and deploy it again. I've tried dropping the activemq bundle into the pickup folder (instead of repository/usr) but that makes no difference. What am I doing wrong?

    I'm using STS 2.3.0, by the way, and doing "hot" deployment.

    Here's the spring context file:


    Code:
    <?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:context="http://www.springframework.org/schema/context"
      xmlns:osgi="http://www.springframework.org/schema/osgi"
      xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
      xmlns:amq="http://activemq.apache.org/schema/core"
      xsi:schemaLocation="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.xsd
        http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd 
        http://www.springframework.org/schema/osgi-compendium 
        http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
    
    
    	<osgi:reference id="osgiDictionaryService"
    	        interface="com.gehc.ce.poc.dictionary.services.DictionaryService" filter="(backend=${backend})"/>
    
    	<context:property-placeholder properties-ref="configAdminProperties"/>
    	<osgix:cm-properties id="configAdminProperties" persistent-id="dictionary">
    		<prop key="backend">memory</prop>
    		<prop key="importqueue">queue.import</prop>
    	</osgix:cm-properties>
    
       <broker useJmx="true" persistent="false" xmlns="http://activemq.apache.org/schema/core">
          <persistenceAdapter>
             <kahaDB directory="serviceability/activemq"/>
          </persistenceAdapter>
          <transportConnectors>
             <transportConnector uri="tcp://localhost:61616" />
          </transportConnectors>
       </broker>
    
    </beans>

  • #2
    With OSGi and activemq config, I found that using ActiveMQ schema causes more issues than benefit.
    I believe it is using XBean, and xbean is trying to be a classloader when it grows up and does dynamic discovery of property files in META-INF folders of bundles it has no visibility into.

    I would switch to using plain spring bean configuration.

    Just my 2c.

    Comment


    • #3
      Hmmm.... I never actually even thought about doing straight Spring. Apache should put up an example using regular spring to make it a bit quicker for people to get up to speed. But you're right, it worked much better that way. Thanks for the tip.

      Comment


      • #4
        How about this:

        Code:
        <bean id="broker" class="org.apache.activemq.xbean.XBeanBrokerService">
                <property name="transportConnectorURIs">
                    <list>
                        <value>tcp://localhost:61616</value>
                    </list>
                </property>
                <property name="useJmx" value="true"/>
                <property name="persistent" value="true"/>
            </bean>
        
            <!-- use pooled connection factory -->
            <bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
                <property name="connectionFactory">
                    <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                        <property name="brokerURL" value="tcp://localhost:61616"/>
                    </bean>
                </property>
            </bean>

        Comment

        Working...
        X