# Restart Application from API

**URL:** https://community.wowza.com/t/restart-application-from-api/37382
**Category:** Wowza Developer Dojo
**Tags:** wowza-streaming-server-java-api
**Created:** [June 12, 2012, 10:56am UTC](https://community.wowza.com/t/restart-application-from-api/37382 "2012-06-12T10:56:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Grant\_Keiser](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@Grant\_Keiser](https://community.wowza.com/u/Grant_Keiser)
#### Post date: [June 12, 2012, 10:56am UTC](https://community.wowza.com/t/restart-application-from-api/37382/1 "2012-06-12T10:56:42Z")

</div>

I am having trouble getting a successful restart done using either the API in a Http Provider or using the jmx api with this example [Sample Java class for creating a command line interface to control Wowza Media Server](http://community.wowza.com/t/-/34950). I am using an rtp stream with a .stream file in the content directory and in startupstreams.xml.

My understanding is that there is no need to explicitly call a method on appInstance to actually start the app (there is a shutdown but not a start method in the API) and that it will restart when a client attempts to connect. However I am getting a stream not found when attempting to connect after a shutdown. I then have to ssh into the instance and call restart on the Wowza process to get the stream working again.

Am I missing a restart equivalent in the API, or is there something else I’m missing? Here is what I’m doing to shutdown:

```auto
IServer server = Server.getInstance();	
	IApplication app1 = vhost.getApplication(server.getProperties()
		.getPropertyStr("PublishToApplication", "live"));
	IApplicationInstance instance = app1.getAppInstance("_definst_");
	instance.shutdown(false, false);

```

Thanks,

Grant

---

<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: [June 13, 2012, 11:57pm UTC](https://community.wowza.com/t/restart-application-from-api/37382/2 "2012-06-13T23:57:12Z")

</div>

Are you using StreamType “live” and starting the stream in StartUpStreams.xml? If so, you have to restart the stream after stopping the application. You can use the MediaCaster API

[https://www.wowza.com/docs/how-to-use-the-wowza-streaming-engine-java-api-to-start-and-stop-mediacaster-streams](https://www.wowza.com/docs/how-to-use-the-wowza-streaming-engine-java-api-to-start-and-stop-mediacaster-streams)

Richard

---

<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: [June 18, 2012, 5:58pm UTC](https://community.wowza.com/t/restart-application-from-api/37382/3 "2012-06-18T17:58:16Z")

</div>

You’re welcome, glad I could help.

Richard

---

<div class="post-metadata">

### Author: ![Grant\_Keiser](https://avatars.discourse-cdn.com/v4/letter/g/53a042/32.png) [@Grant\_Keiser](https://community.wowza.com/u/Grant_Keiser)
#### Post date: [June 14, 2012, 9:29am UTC](https://community.wowza.com/t/restart-application-from-api/37382/4 "2012-06-14T09:29:08Z")

</div>

Yes, I am using StartupStreams.xml. I wondered what the MediaCaster API was.

Thanks again.
