On Tue, Aug 05, 2008 at 06:10:20AM -0700, Joe Fernandez wrote:
> 
> Hi Eugeny,
> 
> You can try starting the embedded broker with a brokerURL that specifies a
> config file, and have the config file include a <> element. 
> 
> With this brokerURL the cfg file must be in the application???s CLASSPATH. 
> vm://localbroker?brokerConfig=xbean:activemq.xml
> 
> With this one, you're specifying an absolute path to the cfg file.
> vm://localbroker?brokerConfig=xbean:file:C:/tmp/activemq.xml

Hello, Joe!

Thank you for quick reply, however things are not clear for me :)

Looks like the way I am creating the broker is incorrect:

        final BrokerService broker = BrokerFactory.createBroker(new URI(
                        "xbean:activemq.xml"));

Gives the error:

0 [main] INFO org.apache.xbean.spring.context.ResourceXmlApplicationContext  - 
Refreshing [EMAIL PROTECTED]: display name [EMAIL PROTECTED]; startup date [Wed 
Aug 06 14:19:13 EEST 2008]; root of context hierarchy
152 [main] INFO org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader 
 - Loading XML bean definitions from class path resource [activemq.xml]
Exception in thread "main" 
org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized 
xbean namespace mapping: http://mortbay.com/schemas/jjettyetty/1.0
        at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:277)

and the activemq.xml file looks like

<beans>

    <bean
        
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
    <broker brokerName="broker0" xmlns="http://activemq.org/config/1.0";>
        <managementContext>
            <managementContext connectorPort="1599"
                jmxDomainName="org.apache.activemq"/>
        </managementContext>
        <!-- The transport connectors ActiveMQ will listen to -->
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://localhost:1235" />
        </transportConnectors>
    </broker>
    <jetty xmlns="http://mortbay.com/schemas/jetty/1.0";>
        <connectors>
            <nioConnector port="8161" />
        </connectors>
        <handlers>
            <webAppContext contextPath="/admin"
                resourceBase="webapps/admin" logUrlOnStart="true" />
            <webAppContext contextPath="/demo"
                resourceBase="webapps/demo" logUrlOnStart="true" />
            <webAppContext contextPath="/fileserver"
                resourceBase="webapps/fileserver" logUrlOnStart="true" />
        </handlers>
    </jetty>
</beans>


Did I miss some dependency on Jetty?

I am using Maven to build and execute the test application, and I specified the 
dependencies as below

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-optional</artifactId>
            <version>5.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-core</artifactId>
            <version>5.1.0</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.13</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>2.5.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>2.5.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.xbean</groupId>
            <artifactId>xbean-spring</artifactId>
            <version>3.4</version>
        </dependency>

Thank you in advance!

-- 
Eugene N Dzhurinsky

Attachment: pgpKPLECLwcay.pgp
Description: PGP signature

Reply via email to