I'm thinking we may want to enhance activemq to use JAXB2 instead, as camel and cxf do, so that it works nicely with spring without having to rely on xbean-spring (which is broken with each new version of spring, and does not provide much to what jaxb2 + spring2 does).
On Nov 26, 2007 4:06 PM, Guillaume Nodet <[EMAIL PROTECTED]> wrote: > Hum, I'm sure there will be more problems ahead, because AFAIK, > xbean-spring is not really compatible with spring 2.5 :-( > > > On Nov 26, 2007 4:02 PM, Jeff Yu < [EMAIL PROTECTED]> wrote: > > > In fact, I am repackaging the xbean-spring in the servicemix.activemqbundle > > that I wrote..since it has a problem for xbean-spring bundle as > > following, > > which means I haven't installed the com.thoughtworks.qdox bundle in my > > tests..(I will switch to the xbean-spring bundle after solving the > > namespace > > issue, since I think I would like not to install the qdox or other extra > > bundles just because I need to use the xbean-spring bundle to register > > the > > spring custom tag).. > > > > Back to the bundle that I wrote, The manifest entry already has the > > "DynamicImport-Package: *", but it seems still can't find the > > activemq.org/config/1.0 file, which was located in the activemq-core > > bundle....I am wondering is it because we need to use bundleClassloader > > in > > the xbean? but as you said, Spring OSGi workef fine with namespace > > handlers, > > it should have a good approach to solve this problem.. I am still > > investigating.... > > > > > > > org.osgi.framework.BundleException : The bundle could not be > > resolved. > > > > > Reason: Missing Constraint: Import-Package: com.thoughtworks.qdox; > > > > > version="0.0.0" > > > > > at > > org.eclipse.osgi.framework.internal.core.BundleHost.startWorker > > ( > > > > > BundleHost.java:294) > > > > > at > > org.eclipse.osgi.framework.internal.core.AbstractBundle.start( > > > > > AbstractBundle.java :256) > > > > > at org.springframework.osgi.test.AbstractOsgiTests.startup( > > > > > AbstractOsgiTests.java:354) > > > > > at > > > > > > > org.springframework.osgi.test.AbstractOsgiTests.prepareTestExecution ( > > > > > AbstractOsgiTests.java:445) > > > > > at org.springframework.osgi.test.AbstractOsgiTests.runBare ( > > > > > AbstractOsgiTests.java:262) > > > > > at org.springframework.osgi.test.AbstractOsgiTests$1.protect ( > > > > > AbstractOsgiTests.java:241) > > > > > at junit.framework.TestResult.runProtected(TestResult.java > > :128) > > > > > at org.springframework.osgi.test.AbstractOsgiTests.run( > > > > > AbstractOsgiTests.java:239) > > > > > at junit.framework.TestSuite.runTest (TestSuite.java:232) > > > > > at junit.framework.TestSuite.run(TestSuite.java :227) > > > > > at org.junit.internal.runners.JUnit38ClassRunner.run ( > > > > > JUnit38ClassRunner.java:81) > > > > > at > > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run( > > > > > JUnit4TestReference.java:38) > > > > > at org.eclipse.jdt.internal.junit.runner.TestExecution.run ( > > > > > TestExecution.java:38) > > > > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > > > > ( > > > > > RemoteTestRunner.java:460) > > > > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > > > > ( > > > > > RemoteTestRunner.java:673) > > > > > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( > > > > > RemoteTestRunner.java:386) > > > > > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( > > > > > > full track for my bundle manifest.mf: > > -------------------------------------------------------- > > Manifest-Version: 1.0 > > Bundle-Name: ServiceMix ActiveMQ > > Private-Package: META-INF.services.org.apache.activemq.broker ,META-INF > > .services.org.apache.activemq.store.jdbc,META-INF.services.org.apache > > .activemq.transport,META-INF.services.org.apache.activemq.transport.d > > iscoveryagent,META-INF.services.org.apache.activemq.wireformat ,META-I > > NF.services.org.apache.camel,META-INF.services.org.apache.camel.compo > > nent,META-INF.services.org.apache.xbean.spring.http.activemq.org.conf > > ig,META-INF.spring,javax.transaction,javax.transaction.xa,org.apache . > > commons.pool.impl,org.apache.geronimo.transaction,org.apache.geronimo > > .transaction.log,org.apache.geronimo.transaction.manager,org.apache.s > > ervicemix.activemq,org.jencks.amqpool > > Created-By: 1.5.0_11 (Sun Microsystems Inc.) > > Bundle-ManifestVersion: 2 > > Bundle-SymbolicName: org.apache.servicemix.activemq > > Tool: Bnd-0.0.160 > > Include-Resource: src\main\resources > > Bnd-LastModified: 1196084126062 > > Export-Package: org.apache.xbean.spring.jndi ;uses:="javax.naming,org.s > > pringframework.core.io,org.apache.commons.logging,org.springframework > > .beans.factory,org.apache.xbean.spring.context.impl ,javax.naming.spi" > > ,org.apache.xbean.spring.generator;uses:="com.thoughtworks.qdox.model > > ,org.apache.tools.ant.types,org.apache.tools.ant.taskdefs,org.apache. > > tools.ant,org.apache.commons.logging,com.thoughtworks.qdox ,org.apache > > .xbean.spring.context.impl",org.apache.xbean.spring.util;uses:="org.s > > pringframework.beans.factory.config,org.springframework.beans",org.ap > > ache.xbean.spring.context.v2c;uses:=" org.springframework.beans.factor > > y.parsing,org.w3c.dom,org.apache.commons.logging,org.springframework. > > context.support,org.springframework.beans.factory.support,org.springf > > ramework.beans.factory.config,org.springframework.beans.factory.xml ,o > > rg.springframework.beans,org.springframework.util,org.springframework > > .beans.factory,org.apache.xbean.spring.context.impl",org.apache.xbean > > .spring,org.apache.commons.pool,org.apache.xbean.spring.context ;uses: > > ="org.xml.sax,org.w3c.dom,org.springframework.context,org.springframe > > work.context.support,org.springframework.beans.factory.support,org.sp > > ringframework.beans.factory.config, org.springframework.core.io,org.sp > > ringframework.beans.factory.xml,org.springframework.beans,org.springf > > ramework.beans.factory,org.apache.xbean.spring.context.impl,org.sprin > > gframework.web.context.support ",org.apache.xbean.spring.context.v2;us > > es:="org.springframework.util.xml,org.springframework.core.io.support > > ,org.xml.sax,org.springframework.beans.factory.parsing,org.w3c.dom,or > > g.apache.commons.logging ,org.apache.xbean.spring.context,org.springfr > > amework.context,org.springframework.beans.factory.support,org.springf > > ramework.beans.factory.config,org.springframework.beans.factory.xml,o > > rg.springframework.core.io,org.springframework.beans,org.springframew > > ork.util,org.springframework.beans.factory",org.apache.xbean.spring.c > > ontext.impl;uses:="javax.management,javax.xml.namespace,org.w3c.dom ,o > > rg.apache.commons.logging,org.apache.xbean.spring.context,org.springf > > ramework.beans.factory.support,org.springframework.beans.factory.conf > > ig,org.springframework.core.io ,org.springframework.beans.factory.xml, > > org.springframework.beans,org.springframework.beans.factory" > > Bundle-Version: 4.0.0.SNAPSHOT > > DynamicImport-Package: * > > > > > > > > Thanks > > Jeff > > > > > > > > > > On Nov 26, 2007 9:49 PM, Guillaume Nodet <[EMAIL PROTECTED]> wrote: > > > > > Well, thinking about this, the problem is that xbean is not OSGi > > friendly. > > > Spring osgi works well because it autodiscovers the namespace handlers > > > from > > > the bundles and use them. > > > XBean relies on the thread context classloader to load resources, so > > maybe > > > this would be enough to set it to the correct classloader before > > creating > > > the xbean context. > > > We may also have to use the DynamicImport-Package osgi manifest entry > > but > > > I > > > think the TCL classloader may be enough. > > > > > > On Nov 26, 2007 2:38 PM, Guillaume Nodet < [EMAIL PROTECTED]> wrote: > > > > > > > Well, it would be easier to patch activemq so that it export this > > > package > > > > maybe ? > > > > > > > > > > > > On Nov 26, 2007 2:26 PM, Jeff Yu < [EMAIL PROTECTED]> wrote: > > > > > > > > > Well, I've found a workaround for this. > > > > > > > > > > I need to copy the > > > > > > > > > > "/META-INF/service/org/apache/xbean/spring/http/activemq.org/config/1.0" > > > > > > > > > > file in the xbean-spring bundle, since the activemq bundle didn't > > > export > > > > > the > > > > > META-INF/service... config file, or bundles cant access the > > META-INF > > > > > file?? > > > > > > > > > > In the xbean-spring: XBeanNameSpaceHanlder.java, it load resource > > > (bean > > > > > definition for this case) from classpath: > > > > > > > > > > InputStream in = Thread.currentThread > > > > > ().getContextClassLoader().getResourceAsStream(uri); > > > > > if (in == null) { > > > > > ClassLoader cl = parserContext.getReaderContext > > > > > ().getReader().getBeanClassLoader(); > > > > > if (cl != null) { > > > > > in = cl.getResourceAsStream (uri); > > > > > } > > > > > if (in == null) { > > > > > in = > > > > > getClass().getClassLoader().getResourceAsStream(uri); > > > > > if (in == null) { > > > > > log.debug("Could not find resource: " + uri); > > > > > } > > > > > } > > > > > } > > > > > > > > > > > > > > > it seems can't find resource in other bundles META-INF/ folder... > > > > > > > > > > Thanks > > > > > Jeff > > > > > > > > > > On Nov 24, 2007 9:31 PM, Jeff Yu < [EMAIL PROTECTED]> wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > I am integrating with activemq 5.0 bundle, with pure spring xml > > > > > syntax, I > > > > > > make it work, I mean, start the embedded broker without any > > > problems, > > > > > but > > > > > > when I config broker with xbean configuration like: > > > > > > > > > > > > <beans > > > > > > xmlns=" http://www.springframework.org/schema/beans" > > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance " > > > > > > xmlns:amq=" http://activemq.org/config/1.0" > > > > > > xsi:schemaLocation=" > > http://www.springframework.org/schema/beans > > > > > > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd > > > > > > http://activemq.org/config/1.0 > > > > > > http://activemq.apache.org/schema/activemq-core.xsd "> > > > > > > > > > > > > <amq:broker useJmx="false" persistent="false"> > > > > > > <amq:transportConnectors> > > > > > > <amq:transportConnector uri="tcp://localhost:61616" > > /> > > > > > > </amq:transportConnectors> > > > > > > </amq:broker> > > > > > > </beans> > > > > > > > > > > > > I got the "Caused by: > > > > > > org.springframework.beans.factory.BeanDefinitionStoreException: > > > > > > Unrecognized xbean namespace mapping: http://activemq.org/config/1.0 > > > > > ", > > > > > > I've included > > > > > > the xbean-spring 3.3 in my bundle by using <Private-Package>. > > (if I > > > > > > install the xbean-spring 3.3-SNAPSHOT bundle, I would get > > following > > > > > error, > > > > > > so I add the xbean-spring > > > > > > in the Private-Package"). > > > > > > ------------------- > > > > > > org.osgi.framework.BundleException : The bundle could not be > > > resolved. > > > > > > Reason: Missing Constraint: Import-Package: > > com.thoughtworks.qdox; > > > > > > version="0.0.0" > > > > > > at > > > org.eclipse.osgi.framework.internal.core.BundleHost.startWorker( > > > > > > BundleHost.java:294) > > > > > > at > > org.eclipse.osgi.framework.internal.core.AbstractBundle.start > > > ( > > > > > > AbstractBundle.java:256) > > > > > > at org.springframework.osgi.test.AbstractOsgiTests.startup( > > > > > > AbstractOsgiTests.java:354) > > > > > > at > > > > > > > > org.springframework.osgi.test.AbstractOsgiTests.prepareTestExecution > > > ( > > > > > > AbstractOsgiTests.java:445) > > > > > > at org.springframework.osgi.test.AbstractOsgiTests.runBare ( > > > > > > AbstractOsgiTests.java:262) > > > > > > at org.springframework.osgi.test.AbstractOsgiTests$1.protect( > > > > > > AbstractOsgiTests.java:241) > > > > > > at junit.framework.TestResult.runProtected(TestResult.java > > :128) > > > > > > at org.springframework.osgi.test.AbstractOsgiTests.run( > > > > > > AbstractOsgiTests.java:239) > > > > > > at junit.framework.TestSuite.runTest (TestSuite.java:232) > > > > > > at junit.framework.TestSuite.run (TestSuite.java :227) > > > > > > at org.junit.internal.runners.JUnit38ClassRunner.run( > > > > > > JUnit38ClassRunner.java:81) > > > > > > at > > > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run ( > > > > > > JUnit4TestReference.java:38) > > > > > > at org.eclipse.jdt.internal.junit.runner.TestExecution.run( > > > > > > TestExecution.java:38) > > > > > > at > > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > > > > > ( > > > > > > RemoteTestRunner.java:460) > > > > > > at > > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > > > > > ( > > > > > > RemoteTestRunner.java:673) > > > > > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( > > > > > > RemoteTestRunner.java:386) > > > > > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main ( > > > > > > RemoteTestRunner.java:196) > > > > > > > > > > > > > > > > > > Full error stack for xbean namespace error: > > > > > > --------------------------------- > > > > > > Exception in thread "SimpleAsyncTaskExecutor-5" > > > > > > org.springframework.beans.factory.BeanCreationException : Error > > > > > creating > > > > > > bean with name 'activemqBroker' defined in OSGi > > > > > > res[/META-INF/spring/servicemix- > > > > > > activemq.xml|id=48|symName=org.apache.servicemix.activemq ]: > > > Invocation > > > > > of > > > > > > init method failed; nested exception is > > > > > > org.springframework.beans.factory.BeanDefinitionStoreException : > > > > > > Unrecognized xbean namespace mapping: > > http://activemq.org/config/1.0 > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean > > > > > > (AbstractAutowireCapableBeanFactory.java :1362)2007-11-24 > > > 21:15:57,187 > > > > > > ERROR [ > > > > > > > > > > > > > > > > org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext > > > > > ] > > > > > > - Post refresh error > > > > > > org.springframework.beans.factory.BeanCreationException : Error > > > > > creating > > > > > > bean with name 'activemqBroker' defined in OSGi > > > > > > res[/META-INF/spring/servicemix- > > > > > > activemq.xml|id=48|symName=org.apache.servicemix.activemq]: > > > Invocation > > > > > of > > > > > > init method failed; nested exception is > > > > > > org.springframework.beans.factory.BeanDefinitionStoreException: > > > > > > Unrecognized xbean namespace mapping: http://activemq.org/config/1.0 > > > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean > > > > > > (AbstractAutowireCapableBeanFactory.java :1362) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean > > > ( > > > > > > AbstractAutowireCapableBeanFactory.java :540) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run > > > > > > (AbstractAutowireCapableBeanFactory.java :485) > > > > > > at java.security.AccessController.doPrivileged (Native > > Method) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean > > > > > > (AbstractAutowireCapableBeanFactory.java:455) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject > > > > > ( > > > > > > AbstractBeanFactory.java:251) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton > > > > > > (DefaultSingletonBeanRegistry.java:169) > > > > > > at > > > > > > > > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean( > > > > > > AbstractBeanFactory.java :248) > > > > > > at > > > > > > > > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean( > > > > > > AbstractBeanFactory.java:170) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons > > > > > ( > > > > > > DefaultListableBeanFactory.java:407) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization > > > > > > (AbstractApplicationContext.java :735) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.osgi.internal.context.support.AbstractDelegatedExecutionApplicationContext.postRefresh > > > ( > > > > > > AbstractDelegatedExecutionApplicationContext.java:218) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.osgi.internal.extender.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run > > > > > > (DependencyWaiterApplicationContextExecutor.java :131) > > > > > > at java.lang.Thread.run(Thread.java:595) > > > > > > Caused by: > > > > > org.springframework.beans.factory.BeanDefinitionStoreException : > > > > > > Unrecognized xbean namespace mapping: > > http://activemq.org/config/1.0 > > > > > > at > > > > > > > > > > > > > > > > org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement > > > > > > (XBeanNamespaceHandler.java :268) > > > > > > at > > > org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse > > > > > ( > > > > > > XBeanNamespaceHandler.java :155) > > > > > > at > > > org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse( > > > > > > XBeanNamespaceHandler.java :49) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement > > > > > > (BeanDefinitionParserDelegate.java :1246) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement > > > > > > (BeanDefinitionParserDelegate.java :1236) > > > > > > at > > > > > > > > > > > > > > > > org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions > > > > > ( > > > > > > XBeanBeanDefinitionDocumentReader.java :84) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions > > > > > > (DefaultBeanDefinitionDocumentReader.java :90) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions > > > ( > > > > > > XmlBeanDefinitionReader.java :468) > > > > > > at > > > > > > > > > > > > > > > > org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions > > > > > > (XBeanXmlBeanDefinitionReader.java :79) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions > > > > > ( > > > > > > XmlBeanDefinitionReader.java :363) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions > > > > > > (XmlBeanDefinitionReader.java:313) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions > > > > > ( > > > > > > XmlBeanDefinitionReader.java :290) > > > > > > at > > > > > > > > > > > > > > > > org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions > > > > > > (ResourceXmlApplicationContext.java :111) > > > > > > at > > > > > > > > > > > > > > > > org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions > > > > > ( > > > > > > ResourceXmlApplicationContext.java :104) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory > > > > > > (AbstractRefreshableApplicationContext.java :97) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory > > > ( > > > > > > AbstractApplicationContext.java :411) > > > > > > at > > > > > > > > > org.springframework.context.support.AbstractApplicationContext.refresh > > > > > ( > > > > > > AbstractApplicationContext.java:338) > > > > > > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext > > > .<init>( > > > > > > ResourceXmlApplicationContext.java:88) > > > > > > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext > > > > > > .<init>(ResourceXmlApplicationContext.java:76) > > > > > > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext > > > .<init>( > > > > > > ResourceXmlApplicationContext.java :72) > > > > > > at > > org.apache.xbean.spring.context.ResourceXmlApplicationContext > > > > > > .<init>(ResourceXmlApplicationContext.java:68) > > > > > > at > > > org.apache.activemq.xbean.BrokerFactoryBean.afterPropertiesSet ( > > > > > > BrokerFactoryBean.java:82) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods > > > > > > (AbstractAutowireCapableBeanFactory.java:1390) > > > > > > at > > > > > > > > > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean > > > > > ( > > > > > > AbstractAutowireCapableBeanFactory.java:1359) > > > > > > ... 13 more > > > > > > > > > > > > > > > > > > What am I doing wrong here?? > > > > > > > > > > > > > > > > > > -- > > > > > > Best Regards > > > > > > Jeff > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Best Regards > > > > > Jeff > > > > > > > > > > > > > > > > > > > > > -- > > > > Cheers, > > > > Guillaume Nodet > > > > ------------------------ > > > > Blog: http://gnodet.blogspot.com/ > > > > > > > > > > > > > > > -- > > > Cheers, > > > Guillaume Nodet > > > ------------------------ > > > Blog: http://gnodet.blogspot.com/ > > > > > > > > > > > -- > > Best Regards > > Jeff > > > > > > -- > > Cheers, > Guillaume Nodet > ------------------------ > Blog: http://gnodet.blogspot.com/ > -- Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/