Results 1 to 10 of 14

Thread: Spring resource classpath issue

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    27

    Default Spring resource classpath issue

    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
    src/main/resources/repo/test.db4o.

    Here's the entry in spring context.

    <bean id="objectContainer"
    class="org.springmodules.db4o.ObjectContainerFacto ryBean">
    <property name="databaseFile"
    value="classpath:/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:/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/repo/test.db4o"

    I've tried different combinations, but Felix doesn't seem to recognize
    this file. Any pointer will be appreciated.

    - Thanks

  2. #2
    Join Date
    Sep 2006
    Location
    Russia
    Posts
    28

    Default

    Try to write:
    <property name="databaseFile" value="classpath:repo/test.db4o" />

  3. #3
    Join Date
    Feb 2008
    Posts
    27

    Default

    Quote Originally Posted by polosatiy View Post
    Try to write:
    <property name="databaseFile" value="classpath:repo/test.db4o" />
    I tried out all possible combinations, but doesn't seem to work. I even tried <property name="databaseFile" value="classpath*:repo/test.db4o" /> w/o any luck.

  4. #4
    Join Date
    Sep 2006
    Location
    Russia
    Posts
    28

    Default

    Quote Originally Posted by back2grave View Post
    I tried out all possible combinations, but doesn't seem to work. I even tried <property name="databaseFile" value="classpath*:repo/test.db4o" /> w/o any luck.
    Show manifest of your bundle.

  5. #5
    Join Date
    Feb 2008
    Posts
    27

    Default

    Quote Originally Posted by polosatiy View Post
    Show manifest of your bundle.
    Here's the manifest file entry :

    Manifest-Version: 1.0
    Export-Package: com.test.taxonomy.dao.api;uses:="com.test.taxo
    nomy.message,com.test.taxonomy.model";version="1.0 .0"
    Bundle-ClassPath: .,slf4j-api-1.6.1.jar,spring-modules-db4o-0.9.jar,co
    mmons-lang-2.5.jar,slf4j-simple-1.6.1.jar,commons-logging-1.1.1.jar,c
    ommons-collections-3.2.1.jar,db4o-7.12.jar
    Built-By: bandops
    Tool: Bnd-0.0.357
    Bundle-Name: Taxonomy Dao Impl Bundle
    Created-By: Apache Maven Bundle Plugin
    Build-Jdk: 1.6.0_21
    Bundle-Version: 1.0.0
    Bnd-LastModified: 1308173187970
    Embed-Transitive: true
    Bundle-Activator: com.test.taxonomy.dao.impl.activator.TaxonomyDao
    ImplActivator
    Bundle-ManifestVersion: 2
    Embed-Dependency: *;scope=compile|runtime;artifactId=!spring|co
    mmons-logging|org.apache.felix.framework|taxonomymessage bundle|taxono
    mymodelbundle
    Import-Package: com.test.taxonomy.dao.api;resolution:=optional;ver
    sion="1.0",com.test.taxonomy.message;version="1.0. 0",com.test
    .taxonomy.model;version="1.0.0",javax.management;r esolution:=optional
    ,javax.net;resolution:=optional,javax.net.ssl;reso lution:=optional,ja
    vax.servlet;resolution:=optional,org.apache.avalon .framework.logger;r
    esolution:=optional,org.apache.log;resolution:=opt ional,org.apache.lo
    g4j;resolution:=optional,org.apache.tools.ant;reso lution:=optional,or
    g.apache.tools.ant.types;resolution:=optional,org. apache.tools.ant.ty
    pes.resources;resolution:=optional,org.apache.tool s.ant.util.regexp;r
    esolution:=optional,org.osgi.framework;resolution: =optional;version="
    1.5",org.springframework.beans.factory;resolution: =optional;version="
    2.5",org.springframework.context.support;resolutio n:=optional;version
    ="2.5",org.springframework.core;resolution:=option al;version="2.5",or
    g.springframework.core.io;resolution:=optional;ver sion="2.5",org.spri
    ngframework.dao;resolution:=optional;version="2.5" ,org.springframewor
    k.dao.support;resolution:=optional;version="2.5",o rg.springframework.
    transaction;resolution:=optional;version="2.5",org .springframework.tr
    ansaction.annotation;resolution:=optional;version= "2.5",org.springfra
    mework.transaction.support;resolution:=optional;ve rsion="2.5",org.spr
    ingframework.util;resolution:=optional;version="2. 5"
    Bundle-SymbolicName: taxonomydaoimplbundle

  6. #6
    Join Date
    Sep 2006
    Location
    Russia
    Posts
    28

    Default

    Does your bundle contains "repo/test.db4o" in jar file?

    That's very strange behavior. Here is my example:

    Code:
    <bean id="settingsBean" class="ru.test.MyBean">
            <property name="settings" value="classpath:ru/test/beansettings.xml"/>
    </bean>
    Code:
    class MyBean {
        private Resource settings;
    }
    and it's works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •