Deployment order of webapps in Jetty 9

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Deployment order of webapps in Jetty 9

John Preston
Can someone tell me which is the easiest way to get my deployment order for webapps in jetty 9. I understand that I can specify the order in one of the xml config files but I cant figure it out.

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment order of webapps in Jetty 9

Joakim Erdfelt-9
webapp load order isn't supported by jetty-deploy or the DeploymentManager.

But never fear, you can manually add the required webapps that need to come first, and then let the DeploymentManager handle the rest.

Lets assume you have a war called example.war that you want to ensure is deployed and started first.

Here's the process:

[~]$ cd my-base
[my-base]$ mkdir prewebapps
[my-base]$ cp ~/code/project/target/example-1.0-SNAPSHOT.war prewebapps/example.war
[my-base]$ mkdir etc
[my-base[$ cp ~/code/project/prewebapps.xml etc/prewebapps.xml
[my-base]$ echo "prewebapps.xml" >> start.ini
[my-base]$ cat etc/prewebapps.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
  <Call name="addHandler">
    <Arg>
      <New class="org.eclipse.jetty.webapp.WebAppContext">
        <Set name="contextPath">/example</Set>
        <Set name="war"><Property name="jetty.base" default="."/>/prewebapps/example.war</Set>
      </New>
    </Arg>
  </Call>
</Configure>


The key points:
  • Put the example.war into a directory that is NOT the ${jetty.base}/webapps/ directory
    (as you don't want it to be picked up by the standard jetty-deploy / DeploymentManger techniques)
  • You are configuring the existing "Contexts" (id) to manually add those webapps.
    This means you don't have a separate XML for each war file (like you would with the jetty-deploy techniques)
    Instead what was a separate XML is now embedded in this ${jetty.base}/etc/prewebapps.xml file.

Good luck


--
Joakim Erdfelt <[hidden email]>
Expert advice, services and support from from the Jetty & CometD experts

On Fri, Oct 17, 2014 at 7:56 AM, John Preston <[hidden email]> wrote:
Can someone tell me which is the easiest way to get my deployment order for webapps in jetty 9. I understand that I can specify the order in one of the xml config files but I cant figure it out.

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment order of webapps in Jetty 9

John Preston
YeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaH!! I owe you man! Works like a charm.

On Fri, Oct 17, 2014 at 11:03 AM, Joakim Erdfelt <[hidden email]> wrote:
webapp load order isn't supported by jetty-deploy or the DeploymentManager.

But never fear, you can manually add the required webapps that need to come first, and then let the DeploymentManager handle the rest.

Lets assume you have a war called example.war that you want to ensure is deployed and started first.

Here's the process:

[~]$ cd my-base
[my-base]$ mkdir prewebapps
[my-base]$ cp ~/code/project/target/example-1.0-SNAPSHOT.war prewebapps/example.war
[my-base]$ mkdir etc
[my-base[$ cp ~/code/project/prewebapps.xml etc/prewebapps.xml
[my-base]$ echo "prewebapps.xml" >> start.ini
[my-base]$ cat etc/prewebapps.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
  <Call name="addHandler">
    <Arg>
      <New class="org.eclipse.jetty.webapp.WebAppContext">
        <Set name="contextPath">/example</Set>
        <Set name="war"><Property name="jetty.base" default="."/>/prewebapps/example.war</Set>
      </New>
    </Arg>
  </Call>
</Configure>


The key points:
  • Put the example.war into a directory that is NOT the ${jetty.base}/webapps/ directory
    (as you don't want it to be picked up by the standard jetty-deploy / DeploymentManger techniques)
  • You are configuring the existing "Contexts" (id) to manually add those webapps.
    This means you don't have a separate XML for each war file (like you would with the jetty-deploy techniques)
    Instead what was a separate XML is now embedded in this ${jetty.base}/etc/prewebapps.xml file.

Good luck


--
Joakim Erdfelt <[hidden email]>
Expert advice, services and support from from the Jetty & CometD experts

On Fri, Oct 17, 2014 at 7:56 AM, John Preston <[hidden email]> wrote:
Can someone tell me which is the easiest way to get my deployment order for webapps in jetty 9. I understand that I can specify the order in one of the xml config files but I cant figure it out.

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Deployment order of webapps in Jetty 9

malini
This post has NOT been accepted by the mailing list yet.
In reply to this post by Joakim Erdfelt-9
The method works as expected. Is there any way in which the order that can be ensured without modifying "start.ini" file.

Can we ensure order using deployment descriptor file?

Thanks in advance :-)