Hello Michiel, Thanks for your quick support. Unfortunately, that was a typo in my post :( I checked my config again and it's the following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <bean id="helloWorld" class="org.damiox.test.bundle2.HelloWorld" init-method="niam"> </bean> </blueprint> Please remember that I'm running this example through Eclipse. I think that shouldn't be an issue as I was able to run another bundle with an Activator... At this point, I'm trying to use Blueprint as Spring. I think the above blueprint config xml file should create an object instance of type "HelloWorld", is that right? Thanks, Damian On Fri, Nov 30, 2012 at 11:55 AM, Michiel Vermandel <[email protected]>wrote: > Hi, > > It is maybe a typo but I saw "HelloW2orld" in the blueprint xml you > posted. > Is that only in your post? > > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> > <bean id="helloWorld" class="org.damiox.test.bundle2.HelloW2orld" > init-method="niam"> > </bean> > </blueprint> > > Regards, > > Michiel > > ----------------- > http://www.codessentials.com - Your essential software, for free! > Follow us at http://twitter.com/#!/Codessentials > ------------------------------ > *From:* Damian Nardelli <[email protected]> > *To:* [email protected]; Michiel Vermandel <[email protected]> > *Sent:* Friday, November 30, 2012 3:24 PM > *Subject:* Re: Getting a ClassNotFoundException when starting my bundle > > Hello, > > I just tried that but it didn't work: > > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > Bundle-Name: Bundle2 > Bundle-SymbolicName: Bundle2 > Bundle-Version: 1.0.0.qualifier > Import-Package: org.osgi.framework > Export-Package: org.damiox.test.bundle2 > Bundle-ClassPath: . > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > > Thanks in advance, > Damian > > On Fri, Nov 30, 2012 at 5:37 AM, Michiel Vermandel <[email protected]>wrote: > > Hi, > > I think you need to export the package of your class. > > Your manifest should include something like: > > Export-Package: org.damiox.test.bundle2 > > regards, > > Michiel > > > ----------------- > http://www.codessentials.com - Your essential software, for free! > Follow us at http://twitter.com/#!/Codessentials > ------------------------------ > *From:* Damian Nardelli <[email protected]> > *To:* [email protected] > *Sent:* Friday, November 30, 2012 4:37 AM > *Subject:* Getting a ClassNotFoundException when starting my bundle > > Hello guys, > > I'm getting a ClassNotFoundException when trying to start an OSGI > blueprint bundle called "Bundle2" in JBOSS AS7 > (jboss-as-7.2.0.Alpha1-SNAPSHOT): > > 00:21:27,444 DEBUG > [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint > Extender: 2) Running blueprint container for bundle Bundle2 in state Unknown > 00:21:27,444 INFO [org.jboss.osgi.framework] (MSC service thread 1-4) > JBOSGI011002: Bundle started: Bundle2:1.0.0.201211300021 > 00:21:27,446 DEBUG > [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint > Extender: 2) Sending blueprint container event > BlueprintEvent[type=CREATING] for bundle Bundle2 > 00:21:27,479 DEBUG > [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint > Extender: 2) Tracking service references: [] > 00:21:27,480 DEBUG > [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint > Extender: 2) Instantiating components: [blueprintContainer, > blueprintBundle, blueprintBundleContext, blueprintConverter, helloWorld] > 00:21:27,480 DEBUG [org.apache.aries.blueprint.di.AbstractRecipe] > (Blueprint Extender: 2) Unable to load class > org.damiox.test.bundle2.HelloWorld from recipe > BeanRecipe[name='helloWorld'], trying to load a nested class > org.damiox.test.bundle2$HelloWorld > 00:21:27,481 ERROR [org.apache.aries.blueprint.di.AbstractRecipe] > (Blueprint Extender: 2) Unable to load class > org.damiox.test.bundle2.HelloWorld from recipe BeanRecipe[name='helloWorld'] > 00:21:27,481 WARN [org.apache.aries.blueprint.container.BeanRecipe] > (Blueprint Extender: 2) Object to be destroyed is not an instance of > UnwrapperedBeanHolder, type: null > 00:21:27,482 ERROR > [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint > Extender: 2) Unable to start blueprint container for bundle Bundle2: > org.osgi.service.blueprint.container.ComponentDefinitionException: Unable > to load class org.damiox.test.bundle2.HelloWorld from recipe > BeanRecipe[name='helloWorld'] > at > org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:195) > at > org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:161) > at > org.apache.aries.blueprint.container.BeanRecipe.loadClass(BeanRecipe.java:245) > at > org.apache.aries.blueprint.container.BeanRecipe.getType(BeanRecipe.java:891) > at > org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:319) > at > org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:802) > at > org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:783) > at > org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > [rt.jar:1.6.0_35] > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > [rt.jar:1.6.0_35] > at > org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88) > at > org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245) > at > org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183) > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:648) > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:340) > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:242) > at > org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48) > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) > [rt.jar:1.6.0_35] > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > [rt.jar:1.6.0_35] > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > [rt.jar:1.6.0_35] > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) > [rt.jar:1.6.0_35] > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) > [rt.jar:1.6.0_35] > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > [rt.jar:1.6.0_35] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > [rt.jar:1.6.0_35] > at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35] > Caused by: java.lang.ClassNotFoundException: > org.damiox.test.bundle2.HelloWorld from [Module > "deployment.Bundle2.jar:main" from Service Module Loader] > at > org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) > [jboss-modules.jar:1.1.3.GA <http://1.1.3.ga/>] > at > org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) > [jboss-modules.jar:1.1.3.GA <http://1.1.3.ga/>] > at > org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) > [jboss-modules.jar:1.1.3.GA <http://1.1.3.ga/>] > at > org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) > [jboss-modules.jar:1.1.3.GA <http://1.1.3.ga/>] > at > org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:132) > [jboss-modules.jar:1.1.3.GA <http://1.1.3.ga/>] > at > org.jboss.osgi.framework.internal.HostBundleRevision.loadClass(HostBundleRevision.java:121) > [jbosgi-framework-core-2.0.1.Final.jar:2.0.1.Final] > at > org.jboss.osgi.framework.internal.AbstractBundleState.loadClass(AbstractBundleState.java:444) > [jbosgi-framework-core-2.0.1.Final.jar:2.0.1.Final] > at > org.jboss.osgi.framework.internal.HostBundleState.loadClass(HostBundleState.java:102) > [jbosgi-framework-core-2.0.1.Final.jar:2.0.1.Final] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:388) > at > org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:410) > at > org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113) > at > org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168) > ... 24 more > > > "Bundle2" is a very simple bundle that I developed just to analyze how > OSGI blueprint works. This bundle contains only 1 class: > org.damiox.test.bundle2.HelloWorld. > The blueprint xml file (OSGI-INF/blueprint/config.xml) is detailed below: > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> > <bean id="helloWorld" class="org.damiox.test.bundle2.HelloW2orld" > init-method="niam"> > </bean> > </blueprint> > > And the MANIFEST.MF is the following: > > Manifest-Version: 1.0 > Bundle-ManifestVersion: 2 > Bundle-Name: Bundle2 > Bundle-SymbolicName: Bundle2 > Bundle-Version: 1.0.0.qualifier > Import-Package: org.osgi.framework > Bundle-ClassPath: . > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > > I'm running the JBoss Server through Eclipse Juno and starting my bundle > from there. > Why is it failing? This is driving me nuts :) > > Regards > Damian > > > > > > >
