URL Resources and Properties - Websphere

This is a discussion on URL Resources and Properties - Websphere ; Hi, I was reading the book "IBM WebSphere: Deployment and advanced configuration" in which the authors offer an alternative to loading properties from the classpath (getResourceAsStream) and directly from File (using the java.io API). This alternative is using URL's to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: URL Resources and Properties

  1. URL Resources and Properties

    Hi,

    I was reading the book "IBM WebSphere: Deployment and advanced
    configuration" in which the authors offer an alternative to loading
    properties from the classpath (getResourceAsStream) and directly from
    File (using the java.io API).

    This alternative is using URL's to lookup property files, which are
    defined as references to URL Connection factories and are mapped to
    installation-specific URL resources. They claim that the URL reference
    does not require special application access permissions since the file
    is read by WAS runtime.

    I have created an URL (URL Providers > Default URL Provider)with the
    following properties:
    name = TestProperty
    jndiName = url/test/TestProperty
    description = Test for a URL that references a file on the filesystem
    spec = file:///e:/test/test.properties
    category = Test

    The application code is as follows:
    URL specifiedUrl = (URL)ctx.lookup("java:comp/env/url/test/TestProperty");
    Properties props = new Properties();
    System.out.println("SpecifiedURL=" + specifiedUrl);
    props.load(specifiedUrl.openStream());

    The application is successfull in looking up the URL in JNDI, but when
    it wants to access the stream it gets an
    java.security.AccessControlException on openStream.

    Am I missing something or should explicit permission be given to the
    application through the use of the was.policy file? The last solution
    defeats the purpose of transparent switching between file or http access.

    Anyone?

    Thanks,

    Martijn

  2. Re: URL Resources and Properties

    Sorry not to answer your question, but I have read an article related to
    this feature, and it is very interesting, BUT is this feature included in
    the J2EE specifications or is it an IBM WAS facility. When developing a J2EE
    application, I have to be sure to be portable (currently WAS, Weblogic and
    Oracle IAS) but I did not find anything similar to that in the other
    Application Servers.

    So is it a standardized feature or not ? If not I unfortunately cannot use
    it


    Jacques Desmazieres



+ Reply to Thread