Payara Autodeploy with the Eclipse Manik Plugin

Manik-Hot-Deploy is a plugin for the Eclipse IDE which brings auto-deploy and hot-deploy functionallity to the development of web applications. The plugin is Open Source and supports Glassfish, Payara, JBoss, Wildfly and other application servers.

With the latest Release 1.0.6 the plugin improves the Payara Autodeploy support. The new version provides a setting for the target folder with a default setting for maven projects.

To enable the autodeploy feature for Payara you also have to set ‘autodeploy-enabled=true in the ‘das-config’ section of the domain.xml file.

<das-config dynamic-reload-enabled="true" autodeploy-enabled="true"></das-config>

Also hot-deployment is supported for Payara, Wildfly and other application servers. Find the full details on the Wikipage on Github.

Payara – Mail Resources

Running an application in Payara you can use a Mail Resource to send mails via SMTP.

In your Java EE code you can inject a Mail Resource by its name:

@Resource(lookup = "mail/my.mail.session")
....
Transport trans = mailSession.getTransport("smtp");
trans.connect();
.....

The Mail resource can be declared in the Payra Web Admin Console in the section “Resources ->JavaMail Sessions”.

Or you can define a mail resource directly in the domain.xml file:

....
 <resources>
  ...
  <mail-resource auth="false" host="smarthost" from="info@foo.com" user="admin" jndi-name="mail/my.mail.session"></mail-resource>
  </resources>
  <servers>
    <server config-ref="server-config" name="server">
      ....
      <resource-ref ref="mail/my.mail.session"></resource-ref>
    </server>
  </servers>
....

If you define the mail resource directyl in your domain.xml file take care about the ‘resource-ref’ declaration in the seciton ‘<servers>’. If you miss this, than your application will not find the mail resource to be injected!

Running Payara on Docker in Debug Mode

The Payara project provide a well maintained docker image on Docker Hub. Since version 5.192 you can easily create a docker image which runs Payara in Debug mode. You need just to add the environment variable “PAYARA_ARGS”

FROM payara/server-full:5.192
...
ENV PAYARA_ARGS --debug

COPY my-example.war $DEPLOY_DIR

Or you can also set the environment in your docker-compose.yml file:

version: "3.6"
services:
....  
  my-server:
    image: payara/server-full:5.192
    environment:
      PAYARA_ARGS: "--debug"
    ports:
      - "8080:8080"
      - "4848:4848"
      - "8181:8181"
      - "9009:9009"
....

After that Payara starts in Debug-Mode and listens to port 9009.