Caucho maker of Resin Server | Application Server (Java EE Certified) and Web Server


 

Resin Documentation

Feb 2012: Leading industry analyst names Caucho as "Visionary" vendor for Enterprise Application Servers.
Feb 2012: NetCraft survey says Resin experiencing strong growth in last year and used in number of the Million Busiest Sites.
home company blog wiki docs 
app server web server 
health cloud java ee pro 
 Resin Server | Application Server (Java EE Certified) and Web Server
 

deployment with ant/maven


Ant/Maven Deployment

With remote deployment, you can use an ant or maven task to deploy a .war file to a running Resin instance. This will require some configuration of the resin.xml to enable deployment. For security reasons, remote deployment and administration is disabled by default, so you will need to enable the features to use them.

  • Enable remote administration (the HMTP service).
  • Add at least one admin user in AdminAuthenticator.
  • Enable the remote deploy service.

The first step is enabling remote administration, so you can manage the server remotely, either with eclipse, or ant, or maven. If disabled, Resin will ignore all remote administration requests. The disabled error message will be something like "Failed to connect to HMTP because HMTP service has not been enabled." In the resin.xml, the <resin:RemoteAdminService> tag enables remote administration:

Example: resin.xml enable remote administration
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="urn:java:com.caucho.resin">
       ...

  <resin:AdminAuthenticator>
     <resin:user name="harry" password="..."/>
  </resin:AdminAuthenticator>

  <cluster id="">

    <resin:RemoteAdminService/>
    <resin:DeployService/>

    ...
  </cluster>
</resin>

The second step is adding at least one administration user, so only authorized administrators can update the server. The <resin:AdminAuthenticator> tag configures administrators. If no administrators are added, Resin will reject any remote administration requests.

The third step is enabling the deploy service itself with the <resin:DeployService> tag. The deploy service is responsible for managing uploads of new applications and distributing them to the servers in the cluster.

When troubleshooting, it's helpful to know that Resin uses BAM/HMTP to connect the deployment client with the deployment server. The <resin:RemoteAdminService> enables BAM/HMTP. If the server is down or the remote admin service isn't enabled, the error messages will complain that the BAM/HMTP connection is not allowed.

Maven Deploy Client

Configuring the Maven Plugin in a pom.xml file
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test</groupId>
  <artifactId>test</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>test Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <dependencies>
  ...
  </dependencies>

  <pluginRepositories>
    <pluginRepository>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </snapshots>
      <id>caucho</id>
      <name>Caucho</name>
      <url>http://caucho.com/m2-snapshot</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <finalName>foo</finalName>

    <plugins>
      <plugin>
        <groupId>com.caucho</groupId>
        <artifactId>resin-maven-plugin</artifactId>
        <version>4.0-SNAPSHOT</version>
        <configuration>
          <server>127.0.0.1</server>
          <port>8086</port>
          <user>foo</user>
          <password>test</password>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
      
Maven Mojo Reference
MOJOPARAMETER NAMESYSTEM PROPERTYREQUIRED?DEFAULTDESCRIPTION
COMMON PROPERTIES FOR ALL MOJOSserverresin.serverYesN/AThe IP or address of the Resin server
portresin.portYesN/AThe port of the Resin server's HTTP port
userresin.userYesN/AThe user to use when logging into the Resin server
passwordresin.passwordYesN/AThe password to use when logging into the Resin server
commitMessageresin.commitMessageNoN/AThe commit message to log for any changes to the application repository
RESIN:UPLOAD-WARwarFileresin.warFileYes${project.build.directory}/ ${project.build.finalName}.war (the war file produced for the project)The war file to upload to the Resin server
stageresin.stageNo"default"The stage to use for the deployed application
virtualHostresin.virtualHostNo"default"The virtual host to use for the deployed application
contextRootresin.contextRootYes/${project.build.finalName}
(the "final name" of the project)
The context root of the deployed application
versionresin.versionNoN/AThe version to use for the deployed application
archiveresin.archiveNofalseWhen set to true, an archive tag is set in addition to the main tag. Can also be an explicit tag.
writeHeadresin.writeHeadNotrueWhen set to true and using versioning, a "head" tag is also set.
RESIN:COPY-TAGstageresin.stageNo"default"The stage of the target tag
virtualHostresin.virtualHostNo"default"The virtual host of the target tag
contextRootresin.contextRootYes (if tag not given)/${project.build.finalName}
(the "final name" of the project)
The context root of the target tag
versionresin.versionNoN/AThe version of the target tag
sourceStageresin.sourceStageNo"default"The stage of the source tag
sourceVirtualHostresin.sourceVirtualHostNo"default"The virtual host of the source tag
sourceContextRootresin.sourceContextRootYes (if sourceTag not given)N/AThe context root of the source tag
sourceVersionresin.sourceVersionNoN/AThe version of the source tag
tagresin.tagYes (if contextRoot not given)N/AAn explicit target tag
sourceTagresin.sourceTagYes (if sourceContextRoot not given)N/AAn explicit source tag
RESIN:DELETE-TAGstageresin.stageNo"default"The stage of the tag to be deleted
virtualHostresin.virtualHostNo"default"The virtual host of the tag to be deleted
contextRootresin.contextRootYes (if tag not given)/${project.build.finalName}
(the "final name" of the project)
The context root of the tag to be deleted
versionresin.versionNoN/AThe version of the tag to be deleted
tagresin.tagYes (if contextRoot not given)N/AAn explicit tag to be deleted
RESIN:QUERY-TAGS stageresin.stageYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given"default"The query pattern for the stage portion of tags in the repository
virtualHostresin.virtualHostYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given"default"The query pattern for the virtual host portion of tags in the repository
contextRootresin.contextRootYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given/${project.build.finalName}
(the "final name" of the project)
The query pattern for the context root portion of tags in the repository
versionresin.versionYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be givenN/AThe query pattern for the version portion of tags in the repository
patternresin.patternYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be givenN/AAn explicit query pattern for entire tags in the repository

Ant Deploy Client

note
Note
Please note that ant plugin has been moved to a new home: https://github.com/caucho/ant-plugin. Current snapshot can be downloaded from 'target' directory at https://github.com/caucho/ant-plugin.
Using the Ant tasks
<project xmlns:resin="antlib:com.caucho.ant">
  <-- if resin-ant.jar is not installed locally -->
  <taskdef uri="antlib:com.caucho.ant"
           resource="com/caucho/ant/antlib.xml"
           classpath="path/to/resin-ant.jar"/>

  <resin:upload-war
                      resinHome="${resin.home}"
                      server="localhost"
                      port="8086"
                      user="foo"
                      password="test"
                      warFile="/tmp/caucho/qa/foo.war"
                      context="bar"
                      logLevel="finer"/>
      
Ant Task Reference
TASK NAMEPARAMETER NAMEREQUIRED?DEFAULTDESCRIPTION
COMMON PROPERTIES FOR ALL TASKSserverYesN/AThe IP or address of the Resin server
resinHomeYesN/APath to Resin Installation
resinConfNo${resin.home}/resin.xmlPath to Resin Configuration
portYesN/AThe port of the Resin server's HTTP port
userYesN/AThe user to use when logging into the Resin server
passwordYesN/AThe password to use when logging into the Resin server
messageNoN/AThe commit message to log for any changes to the application repository
RESIN-UPLOAD-WAR (COM.CAUCHO.ANT.RESINUPLOADWAR)warFileYesN/AThe war file to upload to the Resin server
contextNo/[war file prefix]The context root of the deployed application
hostNo"default"The virtual host to use for the deployed application
stageNo"default"The stage to use for the deployed application
versionNoN/AThe version to use for the deployed application
RESIN-COPY-TAG (COM.CAUCHO.ANT.RESINCOPYTAG)sourceContextYesN/AThe context root of the source tag
sourceHostNo"default"The virtual host of the source tag
sourceStageNo"default"The stage of the source tag
source-versionNoN/AThe version of the source tag
targetContextYesN/AThe context of the target tag
targetHostNo"default"The virtual host of the target tag
targetStageNo"default"The stage of the target tag
targetVersionNoN/AThe version of the target tag
RESIN-DELETE-TAG (COM.CAUCHO.ANT.RESINDELETETAG)contextYes (if tag not given)N/AThe context root of the tag to be deleted
hostNo"default"The virtual host of the tag to be deleted
stageNo"default"The stage of the tag to be deleted
versionNoN/AThe version of the tag to be deleted
tagYes (if context not given)N/AAn explicit tag to be deleted
RESIN-QUERY-TAGS (COM.CAUCHO.ANT.RESINQUERYTAGS)contextYes (At least one pattern (either stage, host, context, version, or pattern) must be given".*"The query pattern for the context root portion of tags in the repository
hostYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given"default"The query pattern for the virtual host portion of tags in the repository
stageYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be given"default"The query pattern for the stage portion of tags in the repository
versionYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be givenN/AThe query pattern for the version portion of tags in the repository
patternYes (At least one pattern (either stage, virtualHost, contextRoot, version, or pattern) must be givenN/AAn explicit query pattern for entire tags in the repository

Copyright © 1998-2012 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology.