http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-java-run-tomcat-application-server/

With Windows Azure, you can use a virtual machine to provide server capabilities. As an example, a virtual machine running on Windows Azure can be configured to host a Java application server, such as Apache Tomcat. On completing this guide, you will have an understanding of how to create a virtual machine running on Windows Azure and configure it to run a Java application server.

You will learn:

  • How to create a virtual machine that has a JDK already installed.
  • How to remotely log in to your virtual machine.
  • How to install a Java application server on your virtual machine.
  • How to create an endpoint for your virtual machine.
  • How to open a port in the firewall for your application server.

For purposes of this tutorial, an Apache Tomcat application server will be installed on a virtual machine. The completed installation will result in a Tomcat installation such as the following.

Note:

To complete this tutorial, you need a Windows Azure account. You can activate your MSDN subscriber benefits or sign up for a free trial.

To create a virtual machine

  1. Log in to the Windows Azure Management Portal.
  2. Click New, click Compute, click Virtual machine, and then click From Gallery.
  3. In the Virtual machine image select dialog, select JDK 7 (Preview) Windows Server 2012. Note that JDK 6 (Preview) Windows Server 2012 is available in case you have legacy applications that are not yet ready to run in JDK 7.
  4. Click Next.
  5. In the Virtual machine configuration dialog:
    1. Specify a name for the virtual machine.
    2. Specify the size to use for the virtual machine.
    3. Enter a name for the administrator in the User Name field. Remember this name and the password you will enter next, you will use them when you remotely log in to the virtual machine.
    4. Enter a password in the New password field, and re-enter it in the Confirm field. This is the Administrator account password.
    5. Click Next.
  6. In the next Virtual machine configuration dialog:
    1. For Cloud service, use the default Create a new cloud service.
    2. The value for Cloud service DNS name must be unique across cloudapp.net. If needed, modify this value so that Windows Azure indicates it is unique.
    3. Specify a region, affinity group, or virtual network. For purposes of this tutorial, specify a region such as West US.
    4. For Storage Account, select Use an automatically generated storage account.
    5. For Availability Set, select (None).
    6. Click Next.
  7. In the final Virtual machine configuration dialog:
    1. Accept the default endpoint entries.
    2. Click Complete.

To remotely log in to your virtual machine

  1. Log on to the Management Portal.
  2. Click Virtual machines.
  3. Click the name of the virtual machine that you want to log in to.
  4. Click Connect.
  5. Respond to the prompts as needed to connect to the virtual machine. When prompted for the administrator name and password, use the values that you provided when you created the virtual machine.

To install a Java application server on your virtual machine

You can copy a Java application server to your virtual machine, or install a Java application server through an installer.

For purposes of this tutorial, Tomcat will be installed.

  1. While logged on to your virtual machine, open a browser session to http://tomcat.apache.org/download-70.cgi.
  2. Double-click the link for 32-bit/64-bit Windows Service Installer. Using this technique, Tomcat will be installed as a Windows service.
  3. When prompted, choose to run the installer.
  4. Within the Apache Tomcat Setup wizard, follow the prompts to install Tomcat. For purposes of this tutorial, accepting the defaults is fine. When you reach the Completing the Apache Tomcat Setup Wizard dialog, you can optionally check Run Apache Tomcat, to have Tomcat started now. Click Finish to complete the Tomcat setup process.

To start Tomcat

If you did not choose to run Tomcat in the Completing the Apache Tomcat Setup Wizard dialog, start it by opening a command prompt on your virtual machine and running net start Tomcat7.

You should now see Tomcat running if you run the virtual machine's browser and open http://localhost:8080.

To see Tomcat running from external machines, you'll need to create an endpoint and open a port.

To create an endpoint for your virtual machine

  1. Log in to the Management Portal.
  2. Click Virtual machines.
  3. Click the name of the virtual machine that is running your Java application server.
  4. Click Endpoints.
  5. Click Add.
  6. In the Add endpoint dialog, ensure Add standalone endpoint is checked and then click Next.
  7. In the New endpoint details dialog:
    1. Specify a name for the endpoint; for example, HttpIn.
    2. Specify TCP for the protocol.
    3. Specify 80 for the public port.
    4. Specify 8080 for the private port.
    5. Click the Complete button to close the dialog. Your endpoint will now be created.

To open a port in the firewall for your virtual machine

  1. Log in to your virtual machine.
  2. Click Windows Start.
  3. Click Control Panel.
  4. Click System and Security, click Windows Firewall, and then click Advanced Settings.
  5. Click Inbound Rules and then click New Rule.

  1. For the new rule, select Port for the Rule type and then click Next.

  1. Select TCP for the protocol and specify 8080 for the port, and then click Next.

  1. Choose Allow the connection and then click Next.

  1. Ensure Domain, Private, and Public are checked for the profile and then click Next.

  1. Specify a name for the rule, such as HttpIn (the rule name is not required to match the endpoint name, however), and then click Finish.

At this point, your Tomcat web site should now be viewable from an external browser, using a URL of the form http://your_DNS_name.cloudapp.net, where your_DNS_name is the DNS name you specified when you created the virtual machine.

Application lifecycle considerations

  • You could create your own application web archive (WAR) and add it to the webapps folder. For example, create a basic Java Service Page (JSP) dynamic web project and export it as a WAR file, copy the WAR to the Apache Tomcat webapps folder on the virtual machine, then run it in a browser.
  • By default when the Tomcat service is installed, it will be set to start manually. You can switch it to start automatically by using the Services snap-in. Start the Services snap-in by clicking Windows Start, Administrative Tools, and then Services. To set Tomcat to start automatically, double-click the Apache Tomcat service in the Services snap-in and set Startup type to Automatic, as shown in the following.

    The benefit of having Tomcat start automatically is it will start again if the virtual machine is rebooted (for example, after software updates that require a reboot are installed).

Next steps

  • Learn about other services, such as Windows Azure Storage, service bus, SQL Database, and more that you may want to include with your Java applications, by viewing the information available at http://www.windowsazure.com/en-us/develop/java/.

How to run a (Tomcat)Java application server on a Azure virtual machine的更多相关文章

  1. [SQL in Azure] Provisioning a SQL Server Virtual Machine on Azure

    http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-provision-sql-server/ Provi ...

  2. [SQL in Azure] Getting Started with SQL Server in Azure Virtual Machines

    This topic provides guidelines on how to sign up for SQL Server on a Azure virtual machine and how t ...

  3. Web Server和Application Server之间的区别?

    An "application server" is a fuzzy concept. Really, it just means software that hosts plug ...

  4. Microsoft server software support for Microsoft Azure virtual machines

    http://support.microsoft.com/kb/2721672/en-us  Article ID: 2721672 - Last Review: November 22, 2014 ...

  5. Eclipse中run as run on server和run as java application

    一.run java application (作为Java应用程序运行)是运行 java main方法 run on server是启动一个web 应用服务器   二.两者的区别: Eclipse中 ...

  6. Java启动问题-Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:1099

    环境一直跑的挺好的,突然报这么一个错误,百思不得其解. 网上查询之后才想起来,自己当时为了IE能运行浪潮服务器的远程console,将环境变量里面的java换成了32位版本的. 修改jre版本与环境变 ...

  7. IDEA:Application Server was not connected before run configuration stop, reason: Unable to ping 1099

    原文链接 : http://blog.csdn.net/x6582026/article/details/70807269 最近第一次玩IDEA时碰到tomcat启动问题:Application Se ...

  8. 启动tomcat时 错误: 代理抛出异常 : java.rmi.server.ExportException: Port already in use: 1099的解决办法

    一.问题描述 今天一来公司,在IntelliJ IDEA 中启动Tomcat服务器时就出现了如下图所示的错误:

  9. 转】启动tomcat时 错误: 代理抛出异常 : java.rmi.server.ExportException: Port already in use: 1099的解决办法

    原博文出自于:http://www.cnblogs.com/xdp-gacl/p/5288399.html   感谢! 一.问题描述 今天一来公司,在IntelliJ IDEA 中启动Tomcat服务 ...

随机推荐

  1. Redis常用命令(一)

    Redis::__construct描述:创建一个Redis客户端范例:$redis = new Redis(); connect, open描述:实例连接到一个Redis.参数:host: stri ...

  2. 处理海量数据的高级排序之——堆排序(C++)

    在面对大数据量的排序时(100W以上量级数据),通常用以下三种的排序方法效率最高O(nlogn):快速排序.归并排序,堆排序.在这个量级上,其他冒泡,选择,插入等简单排序已经无法胜任,效率极低,跟前面 ...

  3. Java_Eclipse_Maven插件部署

    方法一:在线; Eclipse-help-Install New Software 1.下载地址: m2e - http://download.eclipse.org/technology/m2e/r ...

  4. zk 获取session,request,servletContext,response

    (参考:http://www.dotblogs.com.tw/rockywang/archive/2010/01/13/12995.aspx) HttpServletRequest request = ...

  5. C/C++中的实参和形参

    今天突然看到一道关于形参和实参的题,我居然不求甚解.藐视过去在我的脑海里只有一个参数的概念,对于形参和实参的区别还真的不知道,作为学习了几年C++的人来说,真的深深感觉对不起自己对不起C++老师  T ...

  6. 关于java多线程

    package testSynchronized; /** * * 当使用this也就是该文件中的testclass对象作为对象锁时, * 两个线程都使用该对象锁访问该对象的同步代码块, * 是顺序执 ...

  7. Mongodb数据库加密存储(python)

     需求: 不知道大家有没有遇到过这样的需求:自己的服务器出于对数据库安全的保护,需要对存储的数据进行加密保护.这样万一数据库被人拿到,别人也不能拿到数据库里面的内容.这里还有一个前提:前端的展示页面是 ...

  8. Unity学习疑问记录之时间变量

    1.Time.deltaTime 以秒计算,完成最后一帧的时间 放在Update()函数中的代码是以帧来执行的.如果我们需要物体的移动以秒来执行.我们需要将物体移动的值乘以Time.deltaTime ...

  9. C# Image 、 byte[] 、Bitmap之间的转化

    一.Byte[] 转 System.Drawing.Bitmap public static Bitmap CreateBitmap(byte[] originalImageData, int ori ...

  10. SPOJ 10628 Count on a tree(Tarjan离线LCA+主席树求树上第K小)

    COT - Count on a tree #tree You are given a tree with N nodes.The tree nodes are numbered from 1 to  ...