# How to access configuration from server listener (IServerNotify2)?

**URL:** <https://community.wowza.com/t/how-to-access-configuration-from-server-listener-iservernotify2/42694>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [April 9, 2014, 9:38am UTC](https://community.wowza.com/t/how-to-access-configuration-from-server-listener-iservernotify2/42694 "2014-04-09T09:38:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![B\_B1](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@B\_B1](https://community.wowza.com/u/B_B1)\
**Post date:** [April 9, 2014, 9:38am UTC](https://community.wowza.com/t/how-to-access-configuration-from-server-listener-iservernotify2/42694/1 "2014-04-09T09:38:22Z")

</div>

Hello,

trying to access configuration in server listeners methods:

onServerConfigLoaded(IServer server) and onServerCreate(IServer server)

server.getProperties().get(‘key’) gives me null;

server.getProperties().getAllAsStrings() and iterating over result gives me null pointer exception;

same with getManagerProperties().

server.getConfig(path) gives me whole xml as a string (??)

wowzaStreamingEngine 4.0.1

How can i access properties from Server.xml config?

- bonus question: how to access applications configs from this server listener ?

---

<div class="post-metadata">

**Author:** ![B\_B1](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@B\_B1](https://community.wowza.com/u/B_B1)\
**Post date:** [April 10, 2014, 12:41pm UTC](https://community.wowza.com/t/how-to-access-configuration-from-server-listener-iservernotify2/42694/2 "2014-04-10T12:41:00Z")

</div>

solved by creating app instance on server startup. Will it create some additional problems?

```auto
private WMSProperties getAppConfig(String appName, String vhostName) {
    IVHost vhost = VHostSingleton.getInstance(vhostName, true) ;
    Application app = new Application(appName, vhost);
    IApplicationInstance appi = app.getAppInstance(appName);
    return appi.getProperties();
}

```

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 10, 2014, 11:47am UTC](https://community.wowza.com/t/how-to-access-configuration-from-server-listener-iservernotify2/42694/3 "2014-04-10T11:47:17Z")

</div>

Hi,

You can get and set properties like this:

```auto
server.getProperties().getPropertyStr("key");
		
server.getProperties().setProperty("key", "someKey");

```

This does not write to files, it is only in memory. You can do the same with most other objects in Wowza as well.

Richard

---

<div class="post-metadata">

**Author:** ![Roger\_Littin1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Roger\_Littin1](https://community.wowza.com/u/Roger_Littin1)\
**Post date:** [April 11, 2014, 10:07am UTC](https://community.wowza.com/t/how-to-access-configuration-from-server-listener-iservernotify2/42694/4 "2014-04-11T10:07:31Z")

</div>

> solved by creating app instance on server startup. Will it create some additional problems?
> 
> ```auto
> private WMSProperties getAppConfig(String appName, String vhostName) {
> IVHost vhost = VHostSingleton.getInstance(vhostName, true) ;
> Application app = new Application(appName, vhost);
> IApplicationInstance appi = app.getAppInstance(appName);
> return appi.getProperties();
> }
> 
> ```

Hi,

This method will work if you are just reading properties that are set in the Application.xml however, you wont be able to modify any ans you application has not been fully started.

You should use

```auto
IApplication app = vhost.getApplication(appName);

```

This will start the application properly.

Roger.
