Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5993743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:43:06+00:00 2026-05-22T23:43:06+00:00

at the moment i’m developing an OSGi based WebApp with Jetty and Equinox (see:

  • 0

at the moment i’m developing an OSGi based WebApp with Jetty and Equinox (see: http://wiki.eclipse.org/Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit).
Everything ist fine so far but i can’t get access to some files/resources of my own bundle.
The location/path is “configuration/data/config.csv” and “configuration/data/data.zip”.
I have tested everything:

context.getBundleContext().getBundle().getEntry("config.csv");
context.getBundleContext().getBundle().getResource("config.csv");
this.getClass().getClassLoader().getResource("config.csv");
context.getBundleContext().getDataFile("config.csv");

And of course all possible path variants like: “configuration/data/config.csv”, “/configuration/data/config.csv”, “\configuration/data/config.csv”, “/config.csv”.
Moreover i have added the folders to the OSGi classpath (in MANIFEST.MF):

Bundle-ClassPath: .,
 configuration/data/

The resulting URL looks always somthing like this (or null): “configuration/CBR-Data/config.csv” and when i transfer it to an File object “D:\configuration\CBR-Data\config.csv”.

But what i really don’t understand is that the properties file for one of my DS is loaded perfectly:
<properties entry="configuration/dsconfig.properties"/>

Has someone an idea/tip or something else? I’m driving crazy…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:43:07+00:00Added an answer on May 22, 2026 at 11:43 pm

    You are correctly retrieving the resource from the bundle. I’ll suggest to get familiar with the difference between getEntry(), getResource() and getDataFile().

    Because methods returns you correct URLs, this means that the resource are correctly located and the problem is in how you read them.

    The two ways to use them are:

    1. Open InputStream from the URL directly:
    
        URL configURL = context.getBundleContext().getBundle().getEntry("configuration/data/config.csv");
        if (configURL != null) {
            InputStream input = configUrl.openStream();
            try {
                // process your input here or in separate method
            } finally {
                input.close();
            }
        }
       
    1. Convert the URL to File. This approach is not recommended, because it makes the assumption that the Bundle is deployed as directory (and not in archive). It is however helpful if you must deal with legacy libraries which requires you to use File objects. To convert to File you cannot use URL.getPath() method, because Equinox has its own format for the URLs. You should use org.eclipse.core.runtime.FileLocator class to resolve to a File. The FileLocator.getBundleFile(Bundle) does exactly what you want.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At this moment I think about authentication in my web app based on Strust2.
At this moment we are building a new architecture that is based on the
At the moment I have a check to see if a string has specific
At the moment I'm trying to run the example given here http://jqueryui.com/demos/animate/#demo If I
At the moment I'm using DatePicker (view-source:http://jqueryui.com/demos/datepicker/default.html) but I'm having difficulties adding Timepicker addon
At moment I want to implement picture upload without using any plug-ins. My upload
At the moment my code (PHP) has too many SQL queries in it. eg...
At the moment I am working on a project admin application in C# 3.5
At the moment we use HSQLDB as an embedded database, but we search for
At the moment, I'm creating an XML file in Java and displaying it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.