felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shamik Bandopadhyay <sham...@gmail.com>
Subject Re: Spring resource classpath issue
Date Wed, 15 Jun 2011 06:51:12 GMT
> I found that the bundle(taxonomyimplbundle) containing the resource file
> "/META-INF/spring/repo/test.db4o" was not the
> bundle(258,taxonomydaoimplbundle)  which need to load the file.

Not sure I understand this statement. How did you figure that ?
taxonomyimplbundle does contain the test.db4o in the location
mentioned. I don't think there's any need to export this package at
all since its under src/main/resource folder. You mentioned setting
the context loader at the right place. This is the part I'm not able
to comprehend, where exactly do I need to set. My understanding was if
I do it in the activator by loading the application context and
setting the thread context loader, app context will have visibility to
it. Morerover, the spring dm documentation mentions that it's smart
enough to deal with the context loader issue. I tried using
classpath*:/.../test.db40 , that didn't work out either.


2011/6/14 Tribon Cheng <tribon1980@gmail.com>:
> The context class loader you set through activator is not the one spring
> will use. It's not the same thread as the one throwing
> "java.io.FileNotFoundException".
>
> I found that the bundle(taxonomyimplbundle) containing the resource file
> "/META-INF/spring/repo/test.db4o" was not the
> bundle(258,taxonomydaoimplbundle)  which need to load the file.
>
> According to OSGI class loading mechanism,  You need to either import the
> package "META-INF.spring.repo" in the taxonomydaoimpl bundle or you can set
> the context class loader in the right place.
>
> Spring extender will not be responsible for this, it just collects the files
> under /META-INF/spring/*  and create new application context for each
> bundle, the files will not add to context class loader automatically.
>
>
>
> 2011/6/15 Shamik Bandopadhyay <shamikb@gmail.com>
>
>> Tribon, the Bundle-ClassPath in manifest file does contain "."  .
>> Here's my manifest file.
>>
>> Manifest-Version: 1.0
>> Export-Package: com.test.taxonomy.api.impl;uses:="org.springframew
>>  ork.transaction.annotation";version="1.0.0"
>> Bundle-ClassPath: .
>> Built-By: bandops
>> Tool: Bnd-0.0.357
>> Bundle-Name: Taxonomy Impl Bundle
>> Created-By: Apache Maven Bundle Plugin
>> Build-Jdk: 1.6.0_21
>> Bundle-Version: 1.0.0
>> Bnd-LastModified: 1308013351431
>> Embed-Transitive: true
>> Bundle-ManifestVersion: 2
>> Embed-Dependency: *;scope=compile|runtime;inline=true;artifactId=!spri
>>  ng|commons-logging
>> Import-Package: com.test.taxonomy.api.impl;resolution:=optional;ve
>>  rsion="1.0",javax.management;resolution:=optional,javax.net;resolutio
>>  n:=optional,javax.net.ssl;resolution:=optional,javax.xml.bind.annotat
>>  ion;resolution:=optional,org.apache.commons.logging;resolution:=optio
>>  nal,org.apache.tools.ant;resolution:=optional,org.apache.tools.ant.ty
>>  pes;resolution:=optional,org.apache.tools.ant.types.resources;resolut
>>  ion:=optional,org.apache.tools.ant.util.regexp;resolution:=optional,o
>>  rg.springframework.beans.factory;resolution:=optional;version="2.5",o
>>  rg.springframework.core;resolution:=optional;version="2.5",org.spring
>>  framework.core.io;resolution:=optional;version="2.5",org.springframew
>>  ork.dao;resolution:=optional;version="2.5",org.springframework.dao.su
>>  pport;resolution:=optional;version="2.5",org.springframework.transact
>>  ion;resolution:=optional;version="2.5",org.springframework.transactio
>>  n.annotation;resolution:=optional;version="2.5",org.springframework.t
>>  ransaction.support;resolution:=optional;version="2.5",org.springframe
>>  work.util;resolution:=optional;version="2.5"
>> Bundle-SymbolicName: taxonomyimplbundle
>>
>> 2011/6/14 Tribon Cheng <tribon1980@gmail.com>:
>> > Maybe you can check "BundleClasspath" in the manifest header file of your
>> > bundle.  does it include "."?
>> > 在 2011-6-14 下午10:26, <john.dunlap@exceter.com>写道:
>> >> Take a look at this,
>> >>
>> >
>> http://www.dynamicjava.org/articles/osgi-matters/3rd-party-components-with-osgi/11-osgi-matters/43-3rd-party-components-incompatibility-problems?tmpl=component&print=1&page=
>> >>
>> >> Quoting Shamik Bandopadhyay <shamikb@gmail.com>:
>> >>
>> >>> Well, that's the part which is puzzling. I don't see any reason why
>> >>> Spring would use a seperate classloader.I've even tried including the
>> >>> db4o file under
>> >>>
>> >
>> <input-resource>META-INF/spring/repo/test.db4o=target/classes/META-INF/spring/repo/test.db4o</input-reource>
>> >>> , but issue remains the same...
>> >>>
>> >>> On Mon, Jun 13, 2011 at 12:42 PM, <john.dunlap@exceter.com> wrote:
>> >>>> I'm no expert but my best guess would be that spring is trying to
load
>> > the
>> >>>> file from the wrong classloader. If I'm reading the spring source
>> > correctly,
>> >>>> it will attempt to load "classpath:META-INF/spring/repo/test.db4o"
>> from
>> >>>> Thread.currentThread().getContextClassLoader() and then from
>> >>>> ClassUtils.class.getClassLoader() if that fails. That's my 2 cents
>> > anyway.
>> >>>>
>> >>>> Quoting Shamik Bandopadhyay <shamikb@gmail.com>:
>> >>>>
>> >>>>> The file is in the same bundle and located inside
>> >>>>> src/resources/META-INF/spring/repo/test.db4o. I've confirmed
this in
>> >>>>> the generated bundle as well.
>> >>>>>
>> >>>>> On Mon, Jun 13, 2011 at 8:40 AM, Tribon Cheng <tribon1980@gmail.com>
>> >>>>> wrote:
>> >>>>>>
>> >>>>>> Resources are loaded in the same way as classes. Make sure
the file
>> is
>> >>>>>> under
>> >>>>>> the classpath, and is exported if it is used in different
bundle.
>> >>>>>> 在 2011-6-13 下午11:25,"Shamik Bandopadhyay" <shamikb@gmail.com>写道:
>> >>>>>>>
>> >>>>>>> Hi,
>> >>>>>>>
>> >>>>>>> I'm trying to deploy a spring based bundle in osgi (fuse
esb).In
>> >>>>>>> spring context, I'm referring to a db4o file which is
inside
>> > resources
>> >>>>>>> folder. As per my understanding, a maven project will
make sure
>> that
>> >>>>>>> any file available under resources folder will be available
in
>> > project
>> >>>>>>> classpath. I've kept the file under
>> >>>>>>> resources/META-INF/spring/repo/test.db4o.
>> >>>>>>>
>> >>>>>>> Here's the entry in spring context.
>> >>>>>>>
>> >>>>>>> <bean id="objectContainer"
>> >>>>>>> class="org.springmodules.db4o.ObjectContainerFactoryBean">
>> >>>>>>>    <property name="databaseFile"
>> >>>>>>> value="classpath:META-INF/spring/repo/test.db4o" />
>> >>>>>>> </bean>
>> >>>>>>>
>> >>>>>>> Once I install and try to start the application, I'm
getting the
>> >>>>>>> following exception.
>> >>>>>>>
>> >>>>>>> "java.io.FileNotFoundException: OSGi
>> >>>>>>> resource[classpath:META-INF/spring/repo/test.db4o|bnd.id
>> >>>>>>
>> >>>>>> =258|bnd.sym=taxonomydaoimplbundle]
>> >>>>>>>
>> >>>>>>> cannot be resolved to absolute file path because it
does not reside
>> > in
>> >>>>>>> the file system: bundle://258.0:1/META-INF/spring/repo/test.db4o"
>> >>>>>>>
>> >>>>>>> I've tried different combinations, but Felix doesn't
seem to
>> > recognize
>> >>>>>>> this file. Any pointer will be appreciated.
>> >>>>>>>
>> >>>>>>> - Thanks
>> >>>>>>>
>> >>>>>>>
>> ---------------------------------------------------------------------
>> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>> >>>>>>>
>> >>>>>>
>> >>>>>
>> >>>>> ---------------------------------------------------------------------
>> >>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>>> For additional commands, e-mail: users-help@felix.apache.org
>> >>>>>
>> >>>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>>> For additional commands, e-mail: users-help@felix.apache.org
>> >>>>
>> >>>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >>> For additional commands, e-mail: users-help@felix.apache.org
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>
>
> --
> Contribute to Enterprise Integration
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message