4 Replies Latest reply on Mar 24, 2010 5:51 AM by Cesare Bellini

    Problem configuration ActiveMQ

    Cesare Bellini Newbie

      I have a problem with the ActiveMQ configuration in Fuse ESB 4.2.

      I want to use the JDBC persistence adapter and I want to use a database MySQL, so I config the file activemq-broker.xml in this way:

       

      -


      <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" persistent="true" useShutdownHook="false" >

      ...

      <persistenceAdapter>

                  <journaledJDBC dataDirectory="${activemq.base}/data" dataSource="#mysql-ds"/>

              </persistenceAdapter>

      ...

      + +

      -


       

      but when I startup ServiceMix I obtain in the log file this error:

      -


      10:26:02,443 | ERROR | Thread-4         | FeaturesServiceImpl              | s.internal.FeaturesServiceImpl$1  677 | Error installing boot features

      java.lang.Exception: Could not start bundle spring:file:etc/activemq-broker.xml in feature(s) activemq-broker-4.2.0-fuse-01-00: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.commons.dbcp; version="0.0.0"

           at org.apache.felix.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:302)

           at org.apache.felix.karaf.features.internal.FeaturesServiceImpl$1.run(FeaturesServiceImpl.java:675)

      Caused by: org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.commons.dbcp; version="0.0.0"

           at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1313)

           at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1297)

           at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:309)

           at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)

           at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)

           at org.apache.felix.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:294)

           ... 1 more

      -


      I don't understand the reason of this error and how resolve it....can anyone help me,please!?

        • 1. Re: Problem configuration ActiveMQ
          Freeman(Yue) Fang Master

          Hi,

          This error means you didn't install required bundle

           

          do

          osgi:install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.2.2_5

           

          from the shell.

           

          Freeman

          • 2. Re: Problem configuration ActiveMQ
            Cesare Bellini Newbie

            Thanks for your help!! You are right!!

            Now I enable at startup this bundle and the mysql-connector, but now I have another problem:

            -


            12:41:13,270 | ERROR | xtenderThread-12 | ContextLoaderListener            | BundleApplicationContextListener   50 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=activemq-broker.xml, config=osgibundle:/META-INF/spring/*.xml))

            +org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 22 in XML document from URL bundleentry://134.fwk5226838/META-INF/spring/activemq-broker.xml is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'broker'.+

            +     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)+

            +     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)+

            +     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)+

            +     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)+

            +     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)+

            +     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)+

            +     at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:176)+

            +     at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:142)+

            +     at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)+

            +     at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)+

            +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)+

            +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)+

            +     at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)+

            +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)+

            +     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:222)+

            +     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175)+

            +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)+

            +     at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718)+

            +     at java.lang.Thread.run(Thread.java:595)+

            +Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'broker'.+

            +     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)+

            +     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)+

            +     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)+

            +     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)+

            +     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)+

            +     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185)+

            +     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1955)+

            +     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)+

            +     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)+

            +     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)+

            +     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)+

            +     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)+

            +     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)+

            +     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)+

            +     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)+

            +     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)+

            +     at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)+

            +     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)+

            +     ... 18 more+

            -


            I have this config for the activemq-broker.xml file:

             

            +<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-5.3.0.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">+

             

                +<!-- Allows us to use system properties as variables in this configuration file -->+

                <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

             

            <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" persistent="true" useShutdownHook="false" >

            ...

            -


            where is my error??

            • 3. Re: Problem configuration ActiveMQ and Camel
              Cesare Bellini Newbie

              I found my error here http://activemq.apache.org/xml-reference.html

              my mistake depending on fuse message broker documentation.

               

              However now I have a problem to configure activemq inside fuse esb to redelivery messages when the message broker does not shutdown properly.

              For my project I use camel and activemq.

              This is my camel-context.xml:

              -


              <camelContext 

              +                 xmlns="http://camel.apache.org/schema/spring"     +

                   +             xmlns:person="http://servicemix.apache.org/samples/wsdl-first">+

                               

                      <route>

                          <from uri="jbi:endpoint:http://servicemix.apache.org/samples/wsdl-first/PersonService/soap" />

              +               +

                      </route> 

               

                      <route errorHandlerRef="errorHandler">

                          <from uri="activemq:topic:coda1" />

              +          +

               

                      <route errorHandlerRef="errorHandler">

                          <from uri="activemq:topic:coda2" />

              +          +

               

                      <route errorHandlerRef="errorHandler">

                          <from uri="activemq:topic:coda3" />

              +          +

                          <from uri="activemq:topic:errori" />

              +          +

               

              </camelContext>

               

              +     +

                      <property name="maximumRedeliveries" value="-1"/>

               

              +     +

                          <property name="maximumRedeliveries" value="-1"/>

                 +     </bean>+

               

               

                  <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">

                      <property name="configuration" ref="jmsConfig"/>

                  </bean>

               

                  <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">

                      <property name="connectionFactory" ref="jmsConnectionFactoryProcess"/>

               

              +     </bean>+

               

                <bean id="jmsConnectionFactoryProcess" class="org.apache.activemq.ActiveMQConnectionFactory">

                    <property name="brokerURL" value="tcp://localhost:61616"/>

                    <property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig2" />

                </bean>

              -


              With this configuration when I send a message, and for example the endpoint PersonServiceP is down, the message broker continue to redelivery message.

              My problem is when a message continue to be redelivery and in the meanwhile occur a disaster and the fuse esb go down!

              At the startup the message isn't redelivery....and I obtain a message lost!

              How can I avoid this problem?

               

              Edited by: joe on Mar 23, 2010 8:24 AM

              • 4. Re: Problem configuration ActiveMQ
                Cesare Bellini Newbie

                I've followed this configuration for Activemq http://activemq.apache.org/amq-message-store.html

                but when I kill servicemix, delete the idex-store-state file and then I restart servicemix, I obtain an error of activemq:

                -


                ...

                10:16:32,372 | ERROR | xtenderThread-18 | BrokerService                    | he.activemq.broker.BrokerService  496 | Failed to start ActiveMQ JMS Message Broker. Reason: java.io.EOFException

                java.io.EOFException

                +     at java.io.RandomAccessFile.readFully(RandomAccessFile.java:373)+

                +     at java.io.RandomAccessFile.readFully(RandomAccessFile.java:351)+

                +     at org.apache.activemq.kaha.impl.index.StoreIndexReader.readItem(StoreIndexReader.java:46)+

                +     at org.apache.activemq.kaha.impl.index.IndexManager.getIndex(IndexManager.java:70)+

                +     at org.apache.activemq.kaha.impl.IndexRootContainer.getRoot(IndexRootContainer.java:126)+

                +     at org.apache.activemq.kaha.impl.KahaStore.generateInterestInMapDataFiles(KahaStore.java:564)+

                +     at org.apache.activemq.kaha.impl.KahaStore.initialize(KahaStore.java:486)+

                +     at org.apache.activemq.kaha.impl.KahaStore.getMapContainerIds(KahaStore.java:251)+

                +     at org.apache.activemq.store.kahadaptor.KahaReferenceStoreAdapter.start(KahaReferenceStoreAdapter.java:96)+

                +     at org.apache.activemq.store.amq.AMQPersistenceAdapter.start(AMQPersistenceAdapter.java:233)+

                +     at org.apache.activemq.broker.BrokerService.start(BrokerService.java:456)+

                +     at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:61)+

                +     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)+

                +     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)+

                +     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)+

                +     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)+

                +     at java.security.AccessController.doPrivileged(Native Method)+

                +     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)+

                +     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)+

                +     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)+

                +     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)+

                +     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)+

                +     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)+

                +     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)+

                +     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)+

                +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)+

                +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)+

                +     at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)+

                +     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)+

                +     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)+

                +     at java.lang.Thread.run(Thread.java:595)+

                ...

                -


                and so Activemq don't start! Where's my error??