Snippets

MICO FP7 Project WAR remote deployment + debugging

Created by Thomas Köllmer last modified

Enable Remote Deployment and Debugging

Prepare Platform

Don't do this on a public environment without modifying the credentials! (better: don't do it at all)

Install manager-tools:

apt-get install tomcat7-admin

Create User for remote deployment

Edit /etc/tomcat7/tomcat-users.xml

Insert:

 <role rolename="admin-gui" />
 <role rolename="admin-script" />
 <role rolename="manager-gui" />
 <role rolename="manager-script" />
 <user username="tom" password="cat" roles="manager-gui,admin-gui,manager-script,admin-script" />

Increase allowed update file size

Edit /usr/share/tomcat7-admin/manager/WEB-INF/web.xml. The absolute Minimum is 60MB...

<multipart-config>
  <!-- 500MB max -->
  <max-file-size>524288000</max-file-size>
  <max-request-size>524288000</max-request-size>
  <file-size-threshold>0</file-size-threshold>
</multipart-config>

Enable JPDA remote Debugging

Edit /etc/default/tomcat7

Uncomment:

JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

Remote debugging will be available at port 8000. Don't to forget to set the port forwarding inside VirtualBox accordingly!

Prepare Maven Tomcat 7 deployment

Add deployment credential to Maven settings

To avoid storing the credentials inside the version-controlled pom.xml, define a server in the ´.m2/settings.xml`:

<server>
  <id>mico-deployment</id>
  <username>tom</username>
  <password>cat</password>
</server>

Modify pom.xml

Add something like

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <url>http://mico-platform:8080/manager/text</url>
        <server>mico-deployment</server>
        <update>true</update>
    </configuration>
</plugin>

See https://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/deploy-mojo.html for the available fields.

Debug

IntelliJ

  • add a new Remote configuration.
  • Host: mico-platform
  • Port: 8000

Comments (0)