Megosztás a következőn keresztül:


Creating Azure Package of Tomcat with Azure SDK 1.8

Although there are already several posts about creating Windows Azure packages (notably here, I thought it about time for a quick update with some specifics for use with the Windows Azure SDK version 1.8 (https://www.windowsazure.com/en-us/develop/java/java-home/download-for-windows/).

This will be a brief guide overview of how to deploy Tomcat with a sample application.  For this example I will use JPetStore (https://sourceforge.net/projects/ibatisjpetstore/).

While it would be great to post one huge be-all-to-end-all solution, a trusty team of lawyers have assured me that this isn't in my best interest.  :)

Information provided is for educational purposes and comes with no warranty.

Prerequisites

To build everything, we will need Apache ANT, Oracle Java SDK, and the Windows Azure SDK.  What we will be building will be an Azure package that will contain the Oracle Java SDK, Apache Tomcat, and JPetStore.  It is assumed that you have downloaded the following:

 

 

Apache ANT: https://ant.apache.org/

Oracle Java SDK: https://www.oracle.com/technetwork/java/javase/downloads/index.html

Tomcat: https://tomcat.apache.org/

Windows Azure SDK v1.8: https://go.microsoft.com/fwlink/?linkid=252838&clcid=0x409

JPetStore : https://sourceforge.net/projects/ibatisjpetstore/

 

Similarly, I am assuming that you know how to install Java and ANT and have already done so on your machine (as I am going to drive all of this via some ANT scripts). 

Plan

Below is an attached ZIP file with the directory structure.  There will be an ANT file that a first makes a call to build the application (JPetStore) and then creates an Azure Package. 

For getting this example to work, I have create a sample and build.xml file for driving the build of JPetStore.  The file assumes that the JPetStore source code is located in the JavaWebApp folder inside a directory called src.  It also assumes that you have obtained runtime and buildtime dependencies (which I cannot provide for legal reasons).  :(  The directory structure should look like:

  • JavaWebApp
    • lib
      • buildtime
        • servlet.jar
      • runtime
        • all runtime dependencies of the app
    • src
      • {contains java source code, properties,etc... }
    • WebContent
      • {contains jsp, html, images, etc....}

 

 

After that gets built (or better - your application), then it needs to be put in an Azure Package.  As there have been other posts about this, I am not going to get into too much deep details here about the whole process.  Short version: The attached zip has a ANT file that should drive this process.  You will need to add the contents of the appropriate JDK and Tomcat installation to suit your needs. Likewise, you should modify the build.xml file so that it will deploy your application.

 

To build all of this, just open a command type ant.  

 

 

JPetStore.zip