Search code examples
websphere-liberty

Migrating URLs from WebSphere Traditional Application Server to Liberty


I'm working on migrating a complex application to Liberty and it uses property files that use the WAS URL resource. Is there a way, without re-writing anything in the application so that it will run in Liberty? How can I define the URL in the server.xml ?


Solution

  • Did you try using jndiURL like this:

     <jndiURLEntry jndiName="myFirstJNDIEntry" value='"file:///myDirectory/myConfigFile.properties"' />
    

    And access it in code like:

    @Resource(name="myFirstJNDIEntry")
    private URL propsURL;
    

    It is discussed in this Redbook Microservices Best Practices for Java and in documentation JNDI URL Entry (jndiURLEntry)