Академический Документы
Профессиональный Документы
Культура Документы
of Contents
General Info
Introduction 1.1
General Info 1.2
Getting Started 1.3
Build Instructions 1.4
Release Notes 1.5
Payara Server 4.1.1.163 Release Notes 1.5.1
Technical Documentation
Core Documentation 2.1
JACC 2.1.1
Extended Documentation 2.2
Application Deployment 2.2.1
Deployment Descriptor Files 2.2.1.1
Elements of the Decriptor Files 2.2.1.2
Advanced JDBC 2.2.2
Log JDBC Calls 2.2.2.1
Slow SQL Logger 2.2.2.2
SQL Trace Listeners 2.2.2.3
JBatch 2.2.3
JCache 2.2.4
Hazelcast 2.2.5
Health Check Service 2.2.6
Asadmin Commands 2.2.6.1
Configuration 2.2.6.2
Notification Service 2.2.7
Asadmin Commands 2.2.7.1
Request Tracing Service 2.2.8
1
Asadmin Commands 2.2.8.1
Configuration 2.2.8.2
Asadmin Recorder Service 2.2.9
JMX Monitoring Service 2.2.10
Configuration 2.2.10.1
Asadmin Commands 2.2.10.2
Phone Home 2.2.11
Asadmin Commands 2.2.11.1
System Properties 2.2.12
Classloading 2.2.13
Production Ready Domain 2.2.14
User Guides 2.3
Payara Server Domain Backup 2.3.1
Restore a Payara Server Domain 2.3.2
Upgrade Payara Server 2.3.3
Payara Micro Documentation 2.4
Starting an Instance 2.4.1
Deploying Applications 2.4.2
From the Command Line 2.4.2.1
Programmatically 2.4.2.2
During Bootstrap 2.4.2.2.1
To a Bootstrapped Instance 2.4.2.2.2
Using an asadmin Command 2.4.2.2.3
From a Maven Repository 2.4.2.2.4
Configuring an Instance 2.4.3
From the Command Line 2.4.3.1
Programmatically 2.4.3.2
Packaging as an Uber Jar 2.4.3.3
Via System Properties 2.4.3.4
Alternate Keystores for SSL 2.4.3.5
Stopping an Instance 2.4.4
Automatic Clustering 2.4.5
Maven Support 2.4.6
HTTP(S) Auto-Binding 2.4.7
2
Running asadmin Commands 2.4.8
Running Callable Objects 2.4.9
Logging to a file 2.4.10
Remote CDI Events 2.4.11
Payara Micro Appendices 2.4.12
Command Line Options 2.4.12.1
Payara Micro API 2.4.12.2
Configuration Methods 2.4.12.2.1
Operation Methods 2.4.12.2.2
Javadoc 2.4.12.2.3
Appendices
History of Release Notes 3.1
Payara Server 4.1.1.163 Release Notes 3.1.1
Payara Server 4.1.1.162 Release Notes 3.1.2
Payara Server 4.1.1.161.1 Release Notes 3.1.3
Payara Server 4.1.1.161 Release Notes 3.1.4
Payara Server 4.1.1.154 Release Notes 3.1.5
Payara Server 4.1.153 Release Notes 3.1.6
Payara Server 4.1.152.1 Release Notes 3.1.7
Payara Server 4.1.152 Release Notes 3.1.8
Payara Server 4.1.151 Release Notes 3.1.9
Payara Server 4.1.144 Release Notes 3.1.10
3
Introduction
Payara Server began life in 2014, derived from GlassFish 4.1. Since then, Payara Server
has been refined with bug fixes, enhanced with new features, and has grown a strong
community following. The documentation here will be updated with all the significant
changes made with each new release.
User Guides
Payara Server is released on a quarterly cadence and versioned with the year and quarter
number to reflect that:
4
Introduction
5
General Info
Release Strategy
Payara has a release every quarter. Each release incorporates fixes and enhancements
from the Payara team, GlassFish upstream, and the community.
Naming Strategy
The payara naming strategy works off of the pre-existing GlassFish Strategy. The Payara
naming strategy is to append the year and quarter as the final dot version of the release. For
example, for the Payara release built on GlassFish 4.1, released in quarter 3 of 2015, the
version number would be payara-4.1.153.
In the case of updates, we will simply attach an additional point number to the end of the
version number described above. For example, if a patch is released for Payara 4.1.152, the
version number would be 4.1.152.1. This will be in addition to any extra point releases that
Oracle do for GlassFish, so it's possible for a version number to be something like
4.1.1.152.1!
Releases will also have a name attached to the release. For example, the name attached to
Payara 4.1.152 is #badassfish.
6
General Info
Work Strategy
From Payara 4.1.152 onwards, we will be implementing a strategy concerning pulling in
changes from the GlassFish upstream, and to making changes late into a release's
development time.
Change Freeze
Two to three weeks before a release, we will implement a change freeze. This means that
no new features or changes will go into the coming release of Payara. The remaining two to
three weeks will be used for finding any bugs brought on by changes and fixes implemented
for the coming release. If any bugs are found, these will be corrected before the release; if
we can't fix it before the release date, we will simply revert the change that caused the bug
(pending a review).
If a bug fix is committed to the GlassFish upstream during our change freeze, we will
consider pulling in that solitary commit before the release.
GitHub
The Payara project is hosted on GitHub, allowing us to make use of the various tools GitHub
has integrated for managing projects. GitHub also makes allowing the community access to
view and edit the source code very easy and public.
How to Contribute
We make use of the Fork and Pull model (see here: https://help.github.com/articles/using-
pull-requests/). This means that if you want to make any changes, you'll need to fork the
Payara project and make your changes in your own repository. You will then need to create
a pull request back into the Payara project's master branch to merge your changes into the
main project.
7
General Info
Before we merge your pull request though, you must read and sign the Individual Contributor
License Agreement (CLA) before sending it to us at the address specified on the document,
or as an email attachment to info@payara.co.
Once we've received the CLA and checked it for any mistakes, we'll allow any pull requests
you've made to start being merged.
In most cases, pull requests will not be merged immediately. This is to allow the Payara
team, and other members of the community, to review and dliberate over any of the changes
made; we will typically wait 2-3 days before merging any pull requests.
Issue Tracking
We make use of GitHub's integrated issue tracker to allow the community to create
enhancement and bug fix requests. The only requirements to create a bug fix or
enhancement request is a GitHub account, and a reproducible bug or idea for an
enhancement; you do not need to sign the CLA to create an enhancement or bug fix
request.
Someone on the Payara team, or someone from the community, will then investigate and
converse with you about the enhancement request or bug.
We also attach labels and milestones to issues to help both us, and the community, search
through and track issues.
Documentation
We make use of GitHub's in-built wiki to store and host our technical documentation about
Payara, as well as general information (such as this document) about the Payara project.
For technical documentation, we only store documentation that we have written, which
typically pertains to new or modified features and commands made by us or the community;
we do not host GlassFish documentation, nor will we rewrite it for unmodified modules.
8
Getting Started
Contents
1. Overview
2. Downloading Payara Server
3. Starting Payara Server
4. Accessing the Administration Console
5. Deploying an Application
5.1 Deploying using Asadmin
5.2 Deploying using Administration console
1. Overview
This page covers how to download Payara Server, start Payara Server, access the
Administration Console, deploy an application and how to access the deployed application.
$ Payara_installed_directory/bin/asadmin start-domain
This will start domain1, which is the default domain included with Payara Server. If you
wanted to start a different domain, the domain name would need to be specified. An
example can be seen below:
$ asadmin start-domain your_domain_name
9
Getting Started
Once the server is up and running, type this URL http://localhost:4848 in your browser to
access the Administration Console. This is the default URL for accessing the Administration
Console.
5. Deploying an Application
In order for a web application to run, it must be first deployed on an application server such
as Payara Server.
10
Build Instructions
Prerequisites
To build and run Payara, your environment must be set up with the following:
You can also optionally add the Maven bin folder to the PATH environment variable as well,
and the documentation will assume that you have done so.
Configuring Maven
If using JDK 7, you will need to increase the heap size and PermGen size to prevent the
build process from running out of memory.
11
Build Instructions
-Xmx1024m -XX:MaxPermSize=512m
If using JDK 8, PermGen has been replaced by Metaspace, which can increse its maximum
size on its own, so you only need to increase the heap size:
-Xmx1024m
This will download the Payara source code, and initialise git, in a directory called Payara.
Building Payara
With your Git Bash or terminal window, navigate into the downloaded Payara directory, and
run:
This will build Payara and run the integrated GlassFish unit tests. To save a bit of time, you
can skip these tests by appending the skipTests flag to the install command like so:
cd appserver/extras/embedded/payara-micro
mvn clean install -DskipTests
After the build has completed the Payara Micro jar is in the target directory.
12
Build Instructions
13
Release Notes
Release notes
Detailed information about features and fixes in every release.
2015
2014
14
Payara Server 4.1.1.163 Release Notes
Release Highlights
The 163 release of Payara will feature a couple of new tech previews. These are new
features added to Payara which we do not recommend are used on production systems.
Request Tracing is a new service that will allow Payara to track and log information about
the requests it handles. Payara now offers a JMX Monitoring Service. Once configured,
Payara Server will monitor and log the values of attributes that have been listed for
monitoring.
Updated Modules
ibm.jbatch.container.version 1.0.1.payara-p2
Hazelcast 3.6.4
Grizzly 2.3.25
mimepull 1.9.6
javax.batch-api.version 1.0.1
jbatch.container.version 1.0.1
jbatch.spi.version 1.0.1
Weld 2.3.5.Final
Tyrus 1.13
New Features
This section details the newly developed additions to Payara Server.
Enhancements
15
Payara Server 4.1.1.163 Release Notes
This section details the issues marked as enhancements that have been implemented for
this release.
16
Payara Server 4.1.1.163 Release Notes
Fixed Issues
This section details the issues marked as bugs that have been fixed for this release.
Payara Fixes
This section details the fixes implemented by the Payara team or community.
244/PAYARA-470 - JTS recovery hangs for the full length of the recovery timeout and
then succeeds
PAYARA-580 -Investigate Closed Entity Factory possible bug
PAYARA-682 - Properties substitustion does not work when EJB module with
application-scoped datasource is deployed
794/PAYARA-776 - Windows service is named "domain1 GlassFish Server"
798/PAYARA-775 - Unwrapping principal interferes with JASPIC's register session
799/PAYARA-710 - Fix CVE-2012-2098
807/PAYARA-643 - The JMS Availability tab contains a deep link to Oracle docs
808/PAYARA-594 - Spurious AllPermission warning
812/PAYARA-382 - Fix GitHub issue 384 spurious SEVERE log message when
deploying WebService
816/PAYARA-742 - Eclipselink generates broken SQL for Informix
822/PAYARA-355 - thousands of ClassNotFound warnings while deploying an EAR with
many WAR's
825/PAYARA-800 - Payara Micro Maven Deployer gives a FileNotFoundException
828/PAYARA-794 - NPE in LazyBootPersistenceManager if configured JNDI name does
not point to a valid datasource
829/PAYARA-803 - No LoginModules configured for jdcbRealm on Payara Micro
831/PAYARA-802 - Payara Domain is missing -Djavax.xml.accessExternalSchema=all
834/PAYARA-799 - The exception: "java.lang.IllegalArgumentException: PWC2788:
setAttribute: Non-serializable attribute" will occur when a web-fragment.xml with is
found
835/PAYARA-724 - The admin console does not render escape characters on the log
levels page
837/PAYARA-639 - Weld NPE when invalidating sessions
845/PAYARA-664 - NullPointerException during WebDirContext.lookupFromJars
probably caused by race conditions
847/PAYARA-734 - Admin console should spit out a warning if JMS destination name
contains a forward slash
17
Payara Server 4.1.1.163 Release Notes
18
Payara Server 4.1.1.163 Release Notes
Upstream Fixes
There have been no upstream fixes brought in for this release.
Known Issues
Known issues can be seen on our GitHub issues page here:
https://github.com/payara/Payara/issues
19
Core Documentation
Core Documentation
Documentation of core features, shared with GlassFish Server 4 Open Source Edition.
References
GlassFish Server 4 Open Source Edition documentation
20
JACC
Core Documentation
JACC stands for Java Authentication Contract for Containers. It's defined in JSR 115 and all
Java EE complaint servers are mandated to provide a default JACC Policy.
The next thing to do is to tell Payara you want to use that specific JACC provider. For that
purpose, you have to execute the following commands in the asadmin CLI: create-jacc-
provider --
policyConfigurationFactoryProvider=com.example.CustomPolicyConfigurationFactory --
policyProvider=com.example.CustomPolicy --target=server-config custom-provider set
configs.config.server-config.security-service.jacc=custom-provider
create-jacc-provider --policyConfigurationFactoryProvider=com.example.CustomPolicyConf
igurationFactory --policyProvider=com.example.CustomPolicy --target=server-config cust
om-provider
set configs.config.server-config.security-service.jacc=custom-provider
<security-service jacc="custom-provider">
<jacc-provider policy-provider="com.example.CustomPolicy" name="custom-provider" p
olicy-configuration-factory-provider="com.example.CustomPolicyConfigurationFactory"></
jacc-provider>
<!-- More providers can be defined -->
</security-service>
As you can derive from the XML excerpt, more JACC providers can be defined (by default,
simple and default are already defined), but only one will be used at runtime, specified
21
JACC
22
Extended Documentation
Extended Documentation
Documentation of all the features added on top of GlassFish Server 4 Open Source Edition.
23
Application Deployment
Application Deployment
You can deploy the applications to Payara Server in the same way as to GlassFish Server
4.1 Open Source Edition. Payara Server does not modify this process, it only adds some
improvements, so it is safe to refer to the GlassFish Server Application Deployment guide in
GlassFish Server 4 Open Source Edition documentation
24
Deployment Descriptor Files
glassfish-application.xml
glassfish-application
classloading-delegate
enable-implicit-cdi
25
Elements of the Decriptor Files
classloading-delegate
With this option, the libraries included in the EAR assembly will override libraries included in
Payara Server distribution. For more information about how Payara Server loads the
required classes and libraries, see the Classloading section.
enable-implicit-cdi
Configure whether the implicit CDI scanning, as defined by CDI 1.1, is in place for all
modules inside the EAR assembly. The default value is true . If implicit CDI scanning
causes problems for an EAR assembly, the value false will disable implicit CDI scanning
for all CDI modules inside the EAR assembly. This value can be forcibly overridden during
deployment, either by an argument to asadmin deploy command, or by a checkbox in the
web admin console.
26
Advanced JDBC
Payara Server 161 (4.1.1.161) and Payara Micro 161 introduce new capabilites for
advanced JDBC connection pool configuration and diagnostics.
27
Advanced JDBC
28
Log JDBC Calls
From Payara 161 (4.1.1.162) tracing of all SQL calls through a Payara Server connection
pool is possible, with the time taken to execute the call also recorded. SQL Tracing is ideal
fo debugging those hard to pin down performance issues during the development phase and
as all SQL is visible SQL tracing is also a great way to see the SQL generated out of your
JPA code. With "Log JDBC Calls" configured on the connection call each call into the
Connection pool is timed and logged to the server log at FINE level. A typical log message
with Log JDBC Enabled is shown below;
[#|2016-02-04T18:51:01.467+0000|FINE|Payara 4.1|javax.enterprise.resource.sqltrace.com
.sun.gjc.util|_ThreadID=35;_ThreadName=http-listener-1(5);_TimeMillis=1454611861467;_L
evelValue=500;ClassName=com.sun.gjc.util.SQLTraceLogger;MethodName=sqlTrace;|
PoolName=DerbyPool | ExecutionTime=1ms | ClassName=org.apache.derby.client.net.NetCo
nnection40 | MethodName=prepareStatement | arg[0]=SELECT ID, AGE, BIO, BIRTHDATE, BIRT
HDAY, DATEFORMAT, DATEOFBIRTH, DATEOFHIRE, EMAIL, HIREDATE, HIREDAY, MEMBERAGE, NAME,
TODAYSDATE FROM MEMBERENTITY WHERE (NAME = ?) | arg[1]=1003 | arg[2]=1007 | |#]
[#|2016-02-04T18:51:01.467+0000|FINE|Payara 4.1|javax.enterprise.resource.sqltrace.com
.sun.gjc.util|_ThreadID=35;_ThreadName=http-listener-1(5);_TimeMillis=1454611861467;_L
evelValue=500;ClassName=com.sun.gjc.util.SQLTraceLogger;MethodName=sqlTrace;|
PoolName=DerbyPool | ExecutionTime=0ms | ClassName=com.sun.gjc.spi.jdbc40.PreparedSt
atementWrapper40 | MethodName=setString | arg[0]=1 | arg[1]=test | |#]
[#|2016-02-04T18:51:01.468+0000|FINE|Payara 4.1|javax.enterprise.resource.sqltrace.com
.sun.gjc.util|_ThreadID=35;_ThreadName=http-listener-1(5);_TimeMillis=1454611861468;_L
evelValue=500;ClassName=com.sun.gjc.util.SQLTraceLogger;MethodName=sqlTrace;|
PoolName=DerbyPool | ExecutionTime=1ms | ClassName=com.sun.gjc.spi.jdbc40.PreparedSt
atementWrapper40 | MethodName=executeQuery | |#]
[#|2016-02-04T18:51:01.483+0000|FINE|Payara 4.1|javax.enterprise.resource.sqltrace.com
.sun.gjc.util|_ThreadID=35;_ThreadName=http-listener-1(5);_TimeMillis=1454611861483;_L
evelValue=500;ClassName=com.sun.gjc.util.SQLTraceLogger;MethodName=sqlTrace;|
PoolName=DerbyPool | ExecutionTime=0ms | ClassName=com.sun.gjc.spi.jdbc40.PreparedSt
atementWrapper40 | MethodName=close | |#]
You can see in the log messages that the prepareStatement, setString, executeQuery and
close methods are all logged along with their execution times and their parameters. This
gives exceptional debugging capabilites for tracking down database connection related
issues.
WARNING: This is a feature best used for development due to the volume of trace that is
produced.
29
Log JDBC Calls
Deployment
In Java EE 7 a JDBC datasource can be deployed by adding annotations to a JavaEE
component. The Log JDBC Calls setting can be configured via these annotations. Using
annotations is the best way to enable SQL Tracing through logging of the JDBC calls.
@DataSourceDefinition(
name = "java:app/MyApp/MyDS",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:mem:test",
properties = {"fish.payara.log-jdbc-calls=true"})
30
Log JDBC Calls
<data-source>
<name>java:global/ExampleDataSource</name>
<class-name>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</class-name>
<server-name>localhost</server-name>
<port-number>3306</port-number>
<database-name>mysql</database-name>
<user>test</user>
<password>test</password>
<!-- Example of how to use a Payara specific custom connection pool setting -->
<property>
<name>fish.payara.log-jdbc-calls</name>
<value>true</value>
</property>
</data-source>
31
Slow SQL Logger
Administration Console
To configure slow SQL logging on a connection pool via the administration console, navigate
to the Connection Pool's Advanced Properties tab. Then specify the Slow Query Log
Threshold time in seconds or use a decimal value to signify milliseconds. The value (-1)
disables slow SQL logging feature.
32
Slow SQL Logger
asadmin
The Slow Query log Threshold Time for a connection pool can also be configured via
asadmin using the set command to set the slow-query-threshold-in-seconds property of your
connection pool. For example the command below sets the threshold on the __TimerPool to
50 seconds.
You can also set the threshold time to milliseconds simply by passing a decimal value.
Below is a example of setting the threshold on the __TimerPool to 200 millseconds.
Deployment
In Java EE 7 a JDBC datasource can be deployed by adding annotations to a JavaEE
component. The Slow Query Threshold time can be configured via these annotations. Using
annotations is the best way to configure the Slow SQL Query logger on Payara Micro.
@DataSourceDefinition(
name = "java:app/MyApp/MyDS",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:mem:test",
properties = {"fish.payara.slow-query-threshold-in-seconds=5"})
33
Slow SQL Logger
<data-source>
<name>java:global/ExampleDataSource</name>
<class-name>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</class-name>
<server-name>localhost</server-name>
<port-number>3306</port-number>
<database-name>mysql</database-name>
<user>test</user>
<password>test</password>
<!-- Example of how to use a Payara specific custom connection pool setting -->
<property>
<name>fish.payara.slow-query-threshold-in-seconds</name>
<value>5</value>
</property>
</data-source>
Example trace
Below is an example WARNING for a slow query from the Server Log.
[#|2016-02-01T22:39:29.289+0000|WARNING|Payara 4.1|javax.enterprise.resource.sqltrace.
com.sun.gjc.util|_ThreadID=61;_ThreadName=http-listener-1(2);_TimeMillis=1454366369289
;_LevelValue=900;|
SQL Query Exceeded Threshold Time: 5000(ms): Time Taken: 10000(ms)
Query was SELECT ID, AGE, BIO, BIRTHDATE, BIRTHDAY, DATEFORMAT, DATEOFBIRTH, DATEOFHIR
E, EMAIL, HIREDATE, HIREDAY, MEMBERAGE, NAME, TODAYSDATE FROM MEMBERENTITY WHERE (NAME
= ?);
34
Slow SQL Logger
Rows(DatasourceCallQueryMechanism.java:694)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows
FromTable(ExpressionQueryMechanism.java:2740)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows
(ExpressionQueryMechanism.java:2693)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAl
lQuery.java:559)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(Objec
tLevelReadQuery.java:1175)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQue
ry.java:1134)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:460)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(Object
LevelReadQuery.java:1222)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(U
nitOfWorkImpl.java:2896)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstract
Session.java:1857)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstract
Session.java:1839)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstract
Session.java:1804)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:
258)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:473
)
at fish.payara.team.info.controllers.MemberSessionBean.getTeamMemberByName(MemberS
essionBean.java:35)
35
SQL Trace Listeners
Payara Server 161 (4.1.1.162) provides support for custom SQL Trace Listeners. A SQL
Trace Listener is registered against a datasource and is called after each method call on the
Payara Server connection pool. SQL Trace Listeners enable a developer to track all calls to
the database and can be used to develop custom Auditing, Error handling or monitoring.
SQL Trace Listeners can be enabled globally on a datasource if you class is on the server
classpath or can be enabled on an application specific datasource deployed within a WAR or
EAR deployment, in which case the class only needs to be on the classpath of your
application i.e. contained within your WAR or EAR.
To write a listener you just need to implement the interface and override the sqlTrace
method. The SQLTraceRecord contains information about the call to the JDBC driver. Each
of the properties below has a getter on the SQLTraceRecord class;
36
SQL Trace Listeners
/**
* Thread ID from which SQL statement originated.
*/
private long threadID;
/**
* Thread Name from which SQL statement originated.
*/
private String threadName;
/**
* Pool Name in which the SQL statement is executed.
*/
private String poolName;
/**
* Type of SQL query. Could be PreparedStatement, CallableStatement or
* other object types.
*/
private String className;
/**
* Method that executed the query.
*/
private String methodName;
/**
* Time of execution of query.
*/
private long timeStamp;
/**
* Parameters of the method that executed the SQL query. Includes information
* like SQL query, arguments and so on.
*/
private Object[] params;
37
SQL Trace Listeners
public SQLTraceLogger() {
38
SQL Trace Listeners
Deployment
In Java EE 7 a JDBC datasource can be deployed by adding annotations to a JavaEE
component. SQL Trace Listener classes can be configured via these annotations. .
@DataSourceDefinition(
name = "java:app/MyApp/MyDS",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:mem:test",
properties = {"fish.payara.sql-trace-listeners=fish.payara.examples.payaramicro.da
tasource.example.CustomSQLTracer"})
<data-source>
<name>java:global/ExampleDataSource</name>
<class-name>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</class-name>
<server-name>localhost</server-name>
<port-number>3306</port-number>
<database-name>mysql</database-name>
<user>test</user>
<password>test</password>
<!-- Example of how to use a Payara specific custom connection pool setting -->
<property>
<name>fish.payara.sql-trace-listeners</name>
<value>fish.payara.examples.payaramicro.datasource.example.CustomSQLTracer</v
alue>
</property>
</data-source>
39
JBatch
Contents
1. Overview
2. Documentation Conventions
3. Defining a Schema name
3.1 Defining a Schema name through the Admin Console
3.2 Defining a Schema name using Asadmin
3.3 Defining a Schema name in the domain.xml file
3.4 Specifying a Blank Schema Name
4. Setting a Table Prefix and/or Suffix
4.1 Setting a Table Prefix and/or Suffix through the Admin Console
4.2 Setting a Table Prefix and/or Suffix using Asadmin
4.3 Setting a Table Prefix and/or Suffix in the domain.xml file
5. Using MySQL, PostgreSQL, Oracle, or DB2 with JBatch
5.1 Usage Restrictions
5.2 MySQL
6. Altered Asadmin Commands
6.1 set-batch-runtime-configuration
1. Overview
This page shall cover how to use the additional JBatch functionality in Payara 4.1.1.162.
2. Documentation Conventions
${Product-Root} - This is the root of the Payara server directory, referring to where you have
Payara installed.
${Domain} - This refers to the name of your Payara domain.
40
JBatch
This command expects the Admin Server to be listening on port 4848. If it is not, use the -p
option to specify the port, for example:
asadmin -p 5048 set-batch-runtime-configuration -d jdbc/__default --target cluster1 -n
test
Note - If you're editing the domain.xml of a domain that has not been started at
least once, the batch-runtime-configuration tag will not exist and you will have to
add it in yourself
41
JBatch
If you specify a blank schema name, then the schema name will depend on the type of
database being used. MySQL will use test, whereas Derby, Oracle, DB2 and PostgreSQL
will use the username of the JDBC connection pool resource associated with the JDBC
resource to which JBatch is configured to use. Take note that this only applies if you
explicitly specify the schema name as blank; the schema name will still default to APP if not
overwritten.
This command expects the Admin Server to be listening on port 4848. If it is not, use the -p
option to specify the port, for example:
asadmin -p 5048 set-batch-runtime-configuration -d jdbc/__default --target cluster1 --
tablePrefix PRE --tableSuffix SFX
42
JBatch
Note - If you're editing the domain.xml of a domain that has not been started at
least once, the batch-runtime-configuration tag will not exist and you will have to
add it in yourself
43
JBatch
5.2 MySQL
For MySQL database use, it is recommended the following additional property be set:
6.1 set-batch-runtime-configuration
Sets the batch runtime configuration settings. This command requires the admin server to be
running.
44
JBatch
The instance
or cluster to
set the
--target server No
JBatch
configuration
of.
Sets the
name of the
Yes, or specify
--datasourcelookupname -d datasource
executorServiceLookupName
to lookup
and use.
Sets the
name of the
-- executor Yes, or specify
-x
executorservicelookupname service to datasourceLookupName
lookup and
use.
Sets the
name of the
database
--schemaName -n APP No
schema that
holds the
batch tables.
Sets the
prefix to
--tablePrefix apply to the No
batch table
name.
Sets the
suffix to
--tableSuffix apply to the No
batch table
name.
45
JCache
Contents
1. Overview
2. Documentation Conventions
3. Using JCache in your Applications
3.1 Accessing the JSR107 Caching Provider and Cache Manager
3.1.1 Using Injection
3.2 Creating a Cache using Injection
3.2.1 Creating a custom Cache using Injection
3.3 Using JCache Annotations
4. Appendices
4.1 NamedCache Annotation
1. Overview
This page covers how to use the JCache functionality in Payara 4.1.1.162.
JSR107 (JCache) is implemented in Payara by Hazelcast.
2. Documentation Conventions
Any paths listed throughout the documentation will use the Unix/Linux file path structure
(forward slashes).
46
JCache
import javax.cache.spi.CachingProvider;
import javax.cache.CacheManager;
...
Context ctx = new InitialContext();
CachingProvider provider = (CachingProvider) ctx.lookup("payara/CachingProvider");
CacheManager manager = (CacheManager) ctx.lookup("payara/CacheManager");
import javax.cache.CacheManager;
import javax.cache.spi.CachingProvider;
import javax.inject.Inject;
...
@Inject
CacheManager manager;
@Inject
CachingProvider provider;
import javax.inject.Inject;
import javax.cache.Cache;
...
@Inject
Cache cache;
The name of this cache will be the canonical name of the class it is created in. Caches
created in this way will also have JMX statistics and management enabled.
47
JCache
You can determine the name and other attributes of a cache created through injection using
the @NamedCache annotation.
You can specify the desired custom values as a comma separated list of parameters of the
NamedCache annotation when creating a cache.
For example, to inject a cache with a custom name and with JMX management enabled:
import fish.payara.cdi.jsr107.impl.NamedCache;
import javax.inject.Inject;
import javax.cache.Cache;
...
@NamedCache(cacheName = "custom", managementEnabled = true)
@Inject
Cache cache;
The full array of parameters can be seen in the NamedCache section of the appendices.
4. Appendices
48
JCache
49
Hazelcast
Contents
1. Overview
2. Documentation Conventions
3. Enabling Hazelcast
3.1 Enabling Hazelcast through the Admin Console
3.2 Enabling Hazelcast using Asadmin
3.3 Enabling Hazelcast in the domain.xml file
4. Configuring Hazelcast
4.1 Configuring Hazelcast with the Admin Console
4.2 Configuring Hazelcast using Asadmin
4.3 Configuring Hazelcast in the domain.xml file
5. Using Hazelcast in your applications
5.1 Accessing the JNDI registered Hazelcast Instance
6. Using Hazelcast for Web and EJB container Persistence
6.1 Setting Hazelcast as the Persistence Provider through the Admin Console
6.1.1 For the Web Container
6.1.2 For the EJB Container
6.2 Setting Hazelcast as the Persistence Provider using Asadmin
6.2.1 For the Web Container
6.2.2 For the EJB Container
6.3 Setting Hazelcast as the Persistence Provider in the domain.xml file
6.3.1 For the Web Container
6.3.2 For the EJB Container
7. Asadmin Commands
7.1 set-hazelcast-configuration
7.2 get-hazelcast-configuration
7.3 list-hazelcast-members
7.4 restart-hazelcast
1. Overview
This page covers how to use the Hazelcast functionality in Payara 4.1.1.162.
Hazelcast is an In-Memory Data Grid, providing Web and EJB session persistence, and
implementing JSR107 (JCache) in Payara Server.
50
Hazelcast
2. Documentation Conventions
${Product-Root} - This is the root of the Payara server directory, referring to where you have
Payara installed.
${Domain} - This refers to the name of your Payara domain.
${Target} - This refers to the name of an instance or cluster.
... - Denotes a skipping of unrelated code that would be present in the actual file or
program.
${Cluster-Config} - This refers to the name of a cluster configuration.
3. Enabling Hazelcast
In the default domain configuration of Payara, Hazelcast is not enabled. It can be enabled
either through the Admin Console, using a command line asadmin command, or through
editing the domain.xml file.
Click on the cluster, standalone instance, or Admin Server instance (server) to load the
General Information page of the cluster or instance.
Click on the Hazelcast tab to see the Hazelcast Configuration page.
Check the Enabled box, and save your changes
If no target is specified, the command will enable Hazelcast on the Admin Server instance.
To enable Hazelcast on another instance or cluster, use the --target option like so:
51
Hazelcast
The dynamic option of the asadmin command defaults to false, so to enable Hazelcast
without requiring a restart of the target instance/cluster, use --dynamic=true:
Note - If you're editing the domain.xml of a domain that has not been started at
least once, this tag will not exist and you will have to add it in yourself
4. Configuring Hazelcast
Payara Server supports configuring Hazelcast through the Admin Console or domain.xml
file, or by using a Hazelcast configuration file. Using a Hazelcast configuration file will cause
the settings in the Admin Console and domain.xml file to be ignored, with any parameters
not specified in the configuration file reverting to the Hazelcast defaults, even if they are
specified in the Admin Console or domain.xml (Note - the Hazelcast defaults are not
necessarily the same as the Payara Hazelcast defaults).
Click on the cluster, standalone instance, or Admin Server instance (server) to load the
General Information page of the cluster or instance.
Click on the Hazelcast tab to see the Hazelcast Configuration page.
From here, the following configuration options are available to you (excluding the
Enabled property detailed above):
52
Hazelcast
Property Description
Enter your required values, and click Save. Restarting the domain or instance/cluster is not
necessary for any changes made to take effect.
The following example demonstrates setting all of the options on a cluster called cluster1:
asadmin set-hazelcast-configuration --enabled=true --target=cluster1 --dynamic=true -f
hazelcast-config.xml --startport=5902 -g 224.2.2.3 --multicastport=6666 -j
payara/Hazelcast
53
Hazelcast
Admin
Property Console Description
Equivalent
<config name="server-config">
...
<hazelcast-runtime-configuration enabled="true" hazelcast-configuration-file="haze
lcast-configuration.xml" start-port="5666" multicast-group"224.2.2.4" jndi-name="payar
a/Hazelcast1 multicast-port="54328"></hazelcast-runtime-configuration>
...
</config>
You will need to import the following packages into your Java class:
54
Hazelcast
import com.hazelcast.core.HazelcastInstance;
import javax.naming.Context;
import javax.naming.InitialContext;
To import the Hazelcast package, you will need to set the Payara Hazelcast package as a
dependency in the project pom.xml file (for Maven projects), or for you to set the Hazelcast
JAR as a project dependency (if using a non-Maven based project). To add the Payara
Hazelcast package as a dependency in a pom, enter the following in the dependencies
section of your pom:
<dependency>
<groupId>fish.payara.appserver</groupId>
<artifactId>payara-jsr107</artifactId>
<version>4.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
The Hazelcast JAR (for non-Maven projects), can either be downloaded from the Hazelcast
website, or you can make use of the JAR packaged with Payara. The JAR packaged with
Payara can be found at ${Product-Root}/glassfish/modules/hazelcast.jar.
The following will initialise a HazelcastInstance variable with the instance embedded in
Payara:
You will have to wrap this in a try-catch clause, or throw the Naming Exception that this
could generate.
55
Hazelcast
56
Hazelcast
<config name="${Cluster-Config}">
...
<availability-service>
...
<web-container-availability persistence-type="hazelcast"></web-container-avail
ability>
...
</availability-service>
...
</config>
<config name="${Cluster-Config}">
...
<availability-service>
...
<ejb-container-availability sfsb-ha-persistence-type="hazelcast"></ejb-contain
er-availability>
...
</availability-service>
...
</config>
7. Asadmin Commands
7.1 set-hazelcast-configuration
57
Hazelcast
Enables/Disables and configures the embedded Hazelcast member. This command requires
the Admin Server to be running.
Example:
asadmin set-hazelcast-configuration --enabled=true --target=cluster1 --dynamic=true -f
hazelcast-config.xml --startport=5902 -g 224.2.2.3 --multicastport=6666 -j
payara/Hazelcast
7.2 get-hazelcast-configuration
Gets the configuration settings of the embedded Hazelcast member. This command requires
the Admin Server to be running.
58
Hazelcast
Example:
asadmin get-hazelcast-configuration --target=server
7.3 list-hazelcast-members
Lists the active Hazelcast instances and their clustering. This command requires the Admin
Server to be running.
Example:
asadmin list-hazelcast-members --target=server
7.4 restart-hazelcast
Restarts the Hazelcast instances attached to a server or cluster. This command requires the
Admin Server to be running.
Example:
asadmin restart-hazelcast --target=server
59
Health Check Service
If there is a problem with any of these metrics and they exceed a configurable threshold then
a GOOD , WARNING or CRITICAL event message is logged to the server log file. This allows
operations teams to rapidly detect problems or work out what happened after these
problems have occurred. Such events will be presented in a similar manner to this:
Asadmin Commands
Configuration
60
Asadmin Commands
Healthcheck Service
Command Reference
healthcheck-configure
Aim: Enables or disables the health check service. The command updates the domain.xml
with the provided configuration but does not apply changes directly to the working service by
default.
Command Options:
Option Type Description Default Mandatory
-- The instance or cluster that will
target String server no
enable or disable its service
Example:
To enable the Healthcheck service such that it will only activate from the next time the server
is restarted, the following command would be used:
asadmin> healthcheck-configure \
--enabled=true \
--dynamic=false
healthcheck-list-services
Aim: Lists the names of all metric services that can be configured for monitoring.
Command Options
61
Asadmin Commands
Example
Running the command will show output similar to the example below:
healthcheck-cpool
healthcheck-cpu
healthcheck-gc
healthcheck-heap
healthcheck-threads
healthcheck-machinemem
healthcheck-configure-service
Aim: Enables or disables the monitoring of an specific metric. If enabling the service for an
specific metric, the command also configures the frequency of monitoring for that metric.
Command updates the domain.xml with provided configurations but does not apply changes
directly to the working service by default. dynamic attribute should be set to true in order to
apply the changes directly.
Command Options
62
Asadmin Commands
If this command gets executed before running the healthcheck-configure command, the
command will succeed and the configuration will be saved, but the healthcheck service will
not be enabled.
Example
A very basic command to simply enable the GC checker and activate it without needing a
restart would be as follows:
healthcheck-configure-service-threshold
63
Asadmin Commands
Aim: Configures CRITICAL , WARNING and GOOD threshold values for a service specified
with its name. Command updates the domain.xml with provided configurations but does not
apply changes directly to the working service by default. The dynamic attribute should be
set to true in order to apply the changes directly.
CPU Usage
JVM Heap Space
Host Memory
JDBC Connection Pools
Command Options
Option Type Description Default Mandatory
64
Asadmin Commands
Important!
There is no asadmin command to configure the threshold values for the Hogging Threads
or Garbage Collection metrics. In the case of Hogging Threads metrics, check the
domain.xml configuration section on how to adjust its parameters.
In the case of the Garbage Collection metric, there is no configuration available for this
metric; since the service calculates and prints out how many times garbage collections were
executed within the time elapsed since the last check. The service will determine the
severity of the messages based on how much the CPU time is being taken by the GC when
measuring.
Example
Monitoring the health of JDBC connection pools is a common need. In that scenario, it is
very unlikely that on-the-fly configuration changes would be made, so a very high CRITICAL
threshold can be set. Likewise, a nonzero GOOD threshold is needed because an empty or
unused connection pool may not be healthy either. (The actual GOOD threshold would need
to be arrived at following testing).
The following command would apply these settings to the connection pool checker:
asadmin> healthcheck-configure-service-threshold \
--serviceName=healthcheck-cpool \
--dynamic=true \
--thresholdCritical=95 \
--thresholdWarning=70 \
--thresholdGood=30
get-healthcheck-configuration
Command Options
There are no options for this command.
65
Asadmin Commands
Example
A sample output is as follows:
Below are the list of configuration details of each checker listed by its name.
66
Configuration
<health-check-service-configuration enabled="true">
<garbage-collector-checker unit="SECONDS" name="GC" time="5" enabled="true"></garb
age-collector-checker>
<cpu-usage-checker unit="SECONDS" name="CPU" time="5" enabled="true">
<property name="threshold-critical" value="90"></property>
<property name="threshold-warning" value="70"></property>
<property name="threshold-good" value="0"></property>
</cpu-usage-checker>
<machine-memory-usage-checker enabled="true" unit="SECONDS" name="MMEM" time="5">
<property name="threshold-critical" value="95"></property>
<property name="threshold-warning" value="60"></property>
<property name="threshold-good" value="20"></property>
</machine-memory-usage-checker>
<heap-memory-usage-checker unit="SECONDS" name="HEAP" time="5" enabled="true">
<property name="threshold-critical" value="92"></property>
<property name="threshold-warning" value="75"></property>
<property name="threshold-good" value="15"></property>
</heap-memory-usage-checker>
</health-check-service-configuration>
67
Configuration
Attribute Description
<cpu-usage- Calculates the CPU usage and prints out the percentage along with the
checker> usage time.
<garbage-
collector-
Calculates and prints out how many times GC is executed with its
checker> elapsed time.
<machine-
memory-usage-
Calculates the machine memory usage and prints out the percentage
checker> along with the total and used physical memory size.
<heap-
memory-usage-
Calculates the heap memory usage and prints out the percentage
checker> along with initial and committed heap sizes.
<hogging-
threads- Identifies the threads that are hogging the CPU.
checker>
<connection- Calculates the ratio of free/used connections available for all JDBC
pool- connections pool an prints the percentage of used connections for
checker>
each active pool.
They all have the following base attributes, that need to be specified:
Attribute Description
enabled Enables or disables the specified checker.
name Name of the checker that will be printed in the log messages for tracing.
unit
The time unit value, which could either be: NANOSECONDS , MICROSECONDS ,
MILLISECONDS , SECONDS , HOURS , DAYS .
time
The time interval value (as an integer) specified in given unit to execute the
checker for the metric.
Threshold configurations
Just like with the healthcheck-configure-service-threshold asadmin command, there are
threshold configurations for the following checkers:
<cpu-usage-checker>
<machine-memory-usage-checker>
<heap-memory-usage-checker>
<connection-pool-checker>
The threshold configurations are specified for 3 different levels: CRITICAL , WARNING and
GOOD . By default their values are 80 , 50 and 0 respectively. A sample configuration for
68
Configuration
Keep in mind that all threshold values must be provided, otherwise the configuration will not
work appropriately and will cause a startup error.
There are no configurable options to set for the Garbage Collection checker. The checker is
either on or off.
<hogging-threads-checker>
The Hogging Threads checker offers the following 2 properties for configuration:
hogged CPU-wise. The percentage is calculated with the ratio of elapsed CPU time to
checker execution interval. It default value is 95.
retry-count : Represents the count value that should be reached by the hogged thread
in order to give health check messages to the user. Its default value is 3.
<health-check-service-configuration enabled="true">
<hogging-threads-checker unit="MINUTES" time="1" enabled="true" threshold-percen
tage="65" retry-count="10"></hogging-threads-checker>
</health-check-service-configuration>
69
Notification Service
Notification Service
Payara Server version 4.1.1.163 introduced a general Notification service in order to log
events which come from other services, such as the Health Check service or the Request
Tracing service
<notification-service-configuration enabled="true">
<log-notifier-configuration enabled="true" />
</notification-service-configuration>
70
Notification Service
In 4.1.1.163, the only available notifier is the service-log notifier, so configuration options
are limited.
Asadmin Commands
71
Asadmin Commands
Notification Service
Command Reference
notification-configure
Command Options:
The argument --dynamic=true is necessary to turn on the service for a running server,
otherwise the change would only be applied after a server restart.
Example:
asadmin> notification-configure \
--enabled=true \
--dynamic=true
notifier-list-services
Aim: Lists available notifiers to use with the service. These can then be configured
individually or referenced by other service commands, for example the requesttracing-
configure-notifier command.
Command Options
There are no options for this command
72
Asadmin Commands
Example
In order to configure the notifier for request tracing, for example, the asadmin command to
list available notifiers should be run first:
By providing a notifier service with its name, its possible to assign it to another service, like
the Request Tracing service. The command named requesttracing-configure-notifier
adds a logger notifier to request tracing by enabling it as follows:
asadmin> requesttracing-configure-notifier
--notifierName="service-log" \
--notifierEnabled=true \
--dynamic=true
notification-configure-notifier
Aim: Enables or disables an individual notifier for the notification service to use.
Command Options:
Option Type Description Default Mandatory
73
Asadmin Commands
Example:
asadmin> notification-configure-notifier \
--notifierName=service-log \
--notifierEnabled=true \
--dynamic=true
get-notification-configuration
Aim: This command can be used to list the details of the Notification Service.
Command Options:
There are no options for this command.
Example:
asadmin> get-notification-configuration
set-notification-configuration
Aim: This command can be used to set all configuration of the Notification Service at once.
It effectively wraps notification-configure and notification-configure-notifier in one
command.
Command Options:
74
Asadmin Commands
Enables or disables
--enabled=true Boolean False No
the service
When set to true,
applies the changes
--dynamic=true Boolean without a restart. False No
Otherwise a restart is
required.
The name of the service-
--notifierName String log Yes
notifier to use
Enables or disables
--notifierEnabled Boolean false Yes
notifications
When set to true,
applies the changes
--
notifierDynamic=true Boolean without a restart. false No
Otherwise a restart is
required.
Example:
asadmin> set-requesttracing-configuration
--enabled=true \
--dynamic=true
--notifierName="service-log" \
--notifierEnabled=true \
--notifierDynamic=true
75
Request Tracing Service
The Request Tracing Service provides tracing facilities for Servlet request events. The
service logs each request in detail; capturing EJB method calls and web service invocations.
The service can be configured to inform the user of a threshold breach during request
execution.
By logging requests that exceed the specified threshold, it helps users to detect long running
requests and give insight to recover from the bottlenecks that arise within the application.
Asadmin Commands
Configuration
76
Asadmin Commands
Request Tracing
Command Reference
requesttracing-configure
Aim: Enables or disables the service and provides ways to configure threshold time by
specifying a value and a unit.
Command Options:
Option Type Description Default Mandatory
Enables or
--enabled=true Boolean disables the false Yes
service
Sets the number of
time units which
--thresholdValue=10 Integer 30 No
trigger the tracing
of a request
Sets the time unit
--
thresholdUnit="SECONDS" TimeUnit to use for the SECONDS No
threshold
The argument --dynamic=true is necessary to turn on the service for a running server,
otherwise the change would only be applied after a server restart.
Example:
77
Asadmin Commands
asadmin> requesttracing-configure \
--enabled=true \
--thresholdValue=10 \
--thresholdUnit="SECONDS" \
--dynamic=true
requesttracing-configure-notifier
Command Options:
Example:
In order to configure the notifier for request tracing, the asadmin command to list available
notifiers should be run first:
asadmin> notifier-list-services
78
Asadmin Commands
By providing a notifier service with its name, its possible to assign it to the Request Tracing
service. The command named requesttracing-configure-notifier adds a logger notifier to
request tracing by enabling it as seen follows.
asadmin> requesttracing-configure-notifier
--notifierName="service-log" \
--notifierEnabled=true \
--dynamic=true
get-requesttracing-configuration
Aim: This command can be used to list the details of the Request Tracing Service.
Command Options:
There are no options for this command.
Example:
asadmin> get-requesttracing-configuration
set-requesttracing-configuration
Aim: This command can be used to set all configuration of the Request Tracing Service at
once. It effectively wraps requesttracing-configure and requesttracing-configure-notifier
in one command.
Command Options:
79
Asadmin Commands
Enables or
--enabled=true Boolean disables the false Yes
service
Sets the number of
time units which
--thresholdValue=10 Integer 30 No
trigger the tracing
of a request
Sets the time unit
--
thresholdUnit="SECONDS" TimeUnit to use for the SECONDS No
threshold
When set to true,
applies the
changes without a
--dynamic=true Boolean false No
restart. Otherwise
a restart is
required.
The name of the service-
--notifierName String log Yes
notifier to use
Enables or
--notifierEnabled Boolean disables false Yes
notifications
When set to true,
applies the
changes without a
--notifierDynamic=true Boolean false No
restart. Otherwise
a restart is
required.
Example:
asadmin> set-requesttracing-configuration
--enabled=true \
--thresholdValue=10 \
--thresholdUnit="SECONDS" \
--dynamic=true
--notifierName="service-log" \
--notifierEnabled=true \
--notifierDynamic=true
80
Configuration
Request Tracing
Configuration
The request tracing service configuration is stored in the domain.xml file. As with any aspect
of Payara Server configuration, we do not recommend modifying the domain.xml due to the
likelihood of typos causing problems.
<request-tracing-service-configuration
threshold-value="30"
threshold-unit="SECONDS"
enabled="true">
<log-notifier enabled="true"></log-notifier>
</request-tracing-service-configuration>
As shown above, there are three main attributes which can be configured, in addition to a
notifier:
threshold-value
This defines the number of units beyond which a request will be traced.
threshold-unit
This defines the time duration per unit. The accepted options are any valid
java.util.concurrent.TimeUnit values. By default the threshold value is 3 MINUTES.
In the snippet given above, its set to 30 SECONDS.
enabled
There is an additional configuration option which can be seen in the admin console, or
specified as an argument to the asadmin command called dynamic . Setting this to true will
activate the change without a server restart.
81
Configuration
Not included in the admin console for 4.1.1.163 is an option to set the notifier type. This is
intentional for this tech-preview release, since the general notifier service is released with
only one available notifier. When further notifiers are added, the option to specify the type of
notifier will be added.
See Also
Notification Service
82
Asadmin Recorder Service
Contents
1. Overview
2. Documentation Conventions
3. Starting and Stopping the Asadmin Recorder
4. Configuring the Asadmin Recorder
5. Running the Generated Scripts
6. Appendices
6.1 Asadmin Commands
1. Overview
This page will cover how to use the Asadmin Recorder feature of Payara Server.
This feature allows you to record the actions you take in the admin console as asadmin
commands, aiding with automating or reproducing your setup across multiple Payara Server
installations.
2. Documentation Conventions
References to the domain directory refers to the directory where the Payara Server
domain is located.
Once enabled, actions in the admin console that have a corresponding asadmin command
will be recorded to a file. By default, this file is located in the domain directory, and is called
asadmin-commands.txt.
83
Asadmin Recorder Service
Once enabled or disabled, the asadmin recorder will remain enabled/disabled until
specifically enabled or disabled again through clicking this button or using the appropriate
asadmin command - the asadmin recorder will remain enabled or disabled across server
restarts.
You can also enable or disable the asadmin recorder on its configuration page (detailed in
section 4.), or by using the following asadmin commands:
asadmin recorder.
set-asadmin-recorder-configuration --enabled false - Alternative way of disabling the
asadmin recorder.
Enabled - Sets whether the asadmin recorder service should be enabled or disabled.
Filter Commands - Sets whether or not to exclude the asadmin commands and regular
expressions listed in the Filtered Commands setting from being recorded.
Output Location - The absolute file path for the asadmin commands to be written to.
This defaults to a file called asadmin-commands.txt in the domain directory.
Filtered Commands - A comma separated list of asadmin commands and regular
expressions to be excluded from being recorded if the Filter Commands option is
enabled.
The default regular expressions and asadmin commands set in the Filtered Commands
option are a selection of commands and regular expressions that are typically not needed for
any automation purposes, yet are still sometimes called by commands and through
navigation of the admin console. If you remove any of these commands from the filtered
commands list, or choose not to filter any commands at all, the asadmin commands script is
liable to get filled up with these commands. Due to this, it is advised that you only add to this
list, only removing the defaults if you really need to.
Be sure to click on the Save button to have any changes you make take effect.
In addition to using the admin console, you can configure the asadmin recorder service
using the set-asadmin-recorder-configuration command. The command takes the following
parameters:
84
Asadmin Recorder Service
--outputLocation - Specifies the absolute file path of where the recorded asadmin
As an example, the following will enable the asadmin recorder, set the output location to
/home/user/asadmin-commands.txt, and prevent the start-instance command from being
recorded (in addition to the defaults):
6. Appendices
85
Asadmin Recorder Service
86
JMX Monitoring Service
With the release of Payara Server 163, Payara offers a JMX Monitoring Service. Once
configured, Payara Server will monitor and log the values of attributes that have been listed
for monitoring. The metrics are logged together in a single log message as a series of key-
value pairs prefixed by the string PAYARA-MONITORING: .
Payara uses the AMX API for working with JMX MBeans. AMX is not fully exposed by
default and as such needs to be loaded to access most JMX MBean objects. The JMX
Monitoring Service can be used without AMX but there is a limit to what can be monitored
without it.
87
Configuration
There are two possible ways to configure the JMX Monitoring Service:
Examples on how to use the service to monitor the HeapMemoryUsage attribute using both
methods are shown below, but it is first worth noting the default configuration values for the
service:
Monitoring attributes are added to the service as properties of the configuration and contain
the following values:
--addproperty
--enabled
88
Configuration
The second option passed, --enabled , is the only required option for the asadmin
command. The only valid values to give this option are true or false . Passing false to
the option will disable the logging service on next startup if it is currently enabled, but will
otherwise do nothing. Under this scenario the monitoring service has not been configured
yet so false was passed to the option.
If this is not the desired result, it is possible to monitor a single metric for a composite
MBean attribute. To monitor a single metric for the attribute the value of name passed to the
--addproperty option should be modified like so:
name=HeapMemoryUsage.metric
So to log only the used heap memory the asadmin command would be:
If the value of logfrequencyunit is the default of SECONDS then to have the monitoring
service log messages every one minute execute the command:
89
Configuration
To enable the service for next startup the --dynamic option would need to be dropped from
the command.
If the service has not yet run on the instance then the configuration tag will not have been
created. To manually create it the tag needs to be added to the domain.xml in the relevant
config section.
<configs>
<config name="server-config">
...
<monitoring-service-configuration>
</monitoring-service-configuration>
...
</config>
</configs>
90
Configuration
MBean attributes to monitor are added to the configuration section as <property> tags.
Each property tag can take values for name , value and description . To add an MBean
attribute to monitor a <property> tag should be added as shown:
<monitoring-service-configuration>
<property name="HeapMemoryUsage" value="java.lang:type=Memory"></property>
</monitoring-service-configuration>
Here all of the necessary attributes have been given to the tag, name and value . The
value given to name should be the name of the MBean attribute to monitor, while the value
given to value should be the ObjectName of the MBean to look for the MBean attribute on.
Here the MBean attribute added is HeapMemoryUsage which resides in the MBean with the
ObjectName of java.lang:type=Memory .
If this is not the desired result, it is possible to monitor a single metric for a composite
MBean attribute. To monitor a single metric for the attribute the attribute of name for the
property should be changed to:
name="HeapMemoryUsage.metric"
So to log only the used heap memory the configuration would looked like this:
<monitoring-service-configuration>
<property name="HeapMemoryUsage.used" value="java.lang:type=Memory"></property>
</monitoring-service-configuration>
To have the monitoring service log messages every one minute change the tag as shown:
91
Configuration
<monitoring-service-configuration logfrequency="60">
<property name="HeapMemoryUsage" value="java.lang:type=Memory"></property>
</monitoring-service-configuration>
Saving the domain.xml will result in the monitoring service enabled on next startup to log
heap memory usage every minute. To activate on a running instance of Payara the asadmin
command should be used to enable the service, with the --dynamic option as shown above.
92
Asadmin Commands
set-monitoring-configuration
Aim: Sets the monitoring service configuration and can dynamically reload the configuration.
93
Asadmin Commands
get-monitoring-configuration
94
Asadmin Commands
95
Phone Home
1. Overview
2. Documentation Conventions
3. What information is sent?
4. Phone Home Source Code
5. Disabling Phone Home
5.1 Disable Phone Home by removing the service file
5.2 Disable Phone Home using Asadmin
5.3 Disable Phone Home in the domain.xml file
6. Phone Home URL
1. Overview
Starting with release 4.1.1.162, phone home data is used to learn about the usage of Payara
Server.
This is part of work towards an automated Payara Server update facility.
Domains call our phone home server when they are started and then once again each day.
2. Documentation Conventions
${Product-Root} - This is the root of the Payara server directory, referring to where you have
Payara installed.
${Domain} - This refers to the name of your Payara domain.
... - Denotes a skipping of unrelated code that would be present in the actual file or
program.
The phone home code is Open Source and available to view here.
This command will also update the domain.xml with the change described below.
http://www.payara.fish/phonehome
98
Asadmin Commands
The Phone Home Services offer three admin commands to enable/disable activity and to list
the current setting.
enable-phone-home
Aim: Enables the Phone Home service. Command updates the domain.xml.
disable-phone-home
Aim: Disables the Phone Home service. Command updates the domain.xml and disables
the running service
list-phone-home
Aim: Lists the current status of the Phone Home service as Enabled or Disabled
99
System Properties
Contents
1. Overview
2. Documentation Conventions
3. System Properties
1. Overview
This page details the new system properties added to Payara Server.
2. Documentation Conventions
${Product-Root} - This is the root of the Payara server directory, referring to where you have
Payara installed.
${Domain} - This refers to the name of your Payara domain.
${Target} - This refers to the name of an instance or cluster.
${Cluster-Config} - This refers to the name of a cluster configuration.
3. System Properties
100
System Properties
Value Accepted
Option Description Default
Type Values
When set to
false, libraries
from
applications,
and
fish.payara.classloading.delegate Boolean ${Domain}/lib true, false true
will override
the library in
${Product-
Root}/modules
directory
101
Classloading
Contents
1. Overview
2. Documentation Conventions
3. Default Class and Library Loading
3.1 Possible issues with default behavior
4. Solutions to the Class Loading issue
4.1 Globally override Payara-included libraries
4.2 WAR Files
4.3 EAR Files
4.4 Payara domain
5. Conclusion and Recommendations
1. Overview
This page covers how to use the Enhanced Class and Library Loading functionality in
Payara 4.1.1.162.
2. Documentation Conventions
${Product-Root} - This is the root of the Payara server directory, referring to where you have
Payara installed.
${Domain} - This refers to the name of your Payara domain.
${Target} - This refers to the name of an instance or cluster.
... - Denotes a skipping of unrelated code that would be present in the actual file or
program.
${Cluster-Config} - This refers to the name of a cluster configuration.
102
Classloading
precedence over Payara-included libraries. This option is also provided by GlassFish Server
4 Open Source Edition.
103
Classloading
104
Production Ready Domain
Contents
1. Overview
This page details the new production ready domain available in Payara Server 4.1.1.162.
2. Documentation Conventions
Any paths listed throughout the documentation will use the Unix/Linux file path structure
(forward slashes).
-Dosgi.shell.telnet.port=6666
-Dosgi.shell.telnet.maxconn=1
-Dosgi.shell.telnet.ip=127.0.0.1
-Dgosh.args=--nointeractive
-Dfelix.fileinstall.poll=5000
105
Production Ready Domain
-Dfelix.fileinstall.log.level=2
-Dfelix.fileinstall.bundles.new.start=true
-Dfelix.fileinstall.bundles.startTransient=true
-Dfelix.fileinstall.disableConfigSave=false
-Dcom.ctc.wstx.returnNullForDefaultNamespace=true
-
Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.go
go.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix
.shell.remote,org.apache.felix.fileinstall
106
User Guides
User Guides
These pages are intended to answer common questions and provide more practical
documentation on how to work with Payara Server and Payara Micro
For regular updates on Payara Server and Payara Micro, including announcements of new
features, subscribe to the official Payara Blog
107
Payara Server Domain Backup
This is no longer present in GlassFish or Payara Server, since it was a commercial feature
that was never open-sourced, but its effects can be reproduced without much effort using
the backup-domain command and some scheduling software (crontab, for example)
Since the domain directory is where all of the user configuration of Payara Server is kept, we
can consider this to be separate to the installation files that Payara Server uses to run the
app server itself. We can backup the domain using the asadmin backup-domain command as
follows:
The effect of this command is to create a full backup of the domain directory. To complete
the command, however, the domain must be stopped. This will mean that any application
deployed to the DAS is unavailable while the backup takes place.
The job of running this backup command on a given schedule and managing the resulting
backed up files needs to be done by a script external to Payara Server.
See Also
Restore a Payara Server Domain
Upgrade Payara Server
108
Restore a Payara Server Domain
This command will restore just the domain named in the command. Since instances are
stored separately to each domain (and may be on remote hosts), the command will have
no effect on instances.
Restoring an Instance
Since all data in an instance directory is kept in sync with the DAS, there is no added data
(besides logs, caches and some MQ data when a file-based store is used) and an instance
can be completely restored simply by making sure there is an empty directory with the name
of the instance inside a node folder of the correct name. For example:
payara41/nodes/localhost-localdomain/myInstance
Running the start-local-instance command with a full sync, as discussed earlier, will
restore the instance completely:
same JVM as the server instance and a file-based store is used for persistent messages.
The alternative option of LOCAL allows for the use of an enhanced broker cluster, whereby
the JMS broker instances are started as separate JVMs and use a database connection for
storage. Assuming the database is highly available, this completely avoids any danger when
needing to --sync=full the instance.
See Also
Payara Server Domain Backup
109
Restore a Payara Server Domain
110
Upgrade Payara Server
After following those steps, you should be left with a similar directory structure to the
following:
/opt/payara/161/payara41/glassfish/domains/myDomain
/opt/payara/162/payara41/glassfish/domains/myDomain
/opt/payara/backups/myDomain/myDomain_2016_05_27_v00001.zip
Its important to note that this only backs up the domain directory and its contents. Any
instances you have in node directories will need to regenerated by using the --sync=full
option of the start-local-instance subcommand:
111
Upgrade Payara Server
This will recreate the instance from scratch. Be aware, though, that this will not recreate
things stored in the instance directory which are outside of the configuration like JMS
filestores. If there is any JMS persistence which does not use a database, these must be
handled manually. See Restore a Payara Domain for more detail.
This will use the 154 installation to create a new domain, and then run it with the 162
installation.
In this way, the user configuration is always kept separate to the installation, and rollback is
as simple as using the previous installation directory.
If you are using Payara Server on Linux, you could take advantage of symbolic links to make
life easier. When your domain directory is in a non-standard location, it means that you need
to specify its location with each start/stop/restart command. If you were to create a symbolic
link to the domain directory inside the default domains directory, then all of your existing
scripts will carry on as normal.
You could even extend this further to create a symbolic link to whichever Payara Server
installation was currently used in production, for example:
/opt/payara/live/payara41/....
This means that any rollback is as simple as stopping the server, updating a symbolic link
and starting it again.
112
Upgrade Payara Server
Without the use of symbolic links, things get a bit more manual (though still quite
straightforward). The asadmin start-domain subcommand has a --domaindir option which
allows you to specify the location of a domain directory. So you could have a directory
structure like this:
/opt/payara/154/payara41/....
/opt/payara/161/payara41/....
/opt/payara/162/payara41/....
/opt/payara/domains/myDomain
/opt/payara/nodes/myLocalNode
Then you could start your domain with whatever version of Payara you wanted:
...or:
Note: the --domaindir option specifies the parent directory for your domain...so where
you would store all of your domains. There is then a space and then the name of the
domain you want to start - domain1 is still the default
See Also
Payara Server Domain Backup
Restore a Payara Server Domain
113
Payara Micro Documentation
Payara Micro is an embedded release of Payara built from the Payara Embedded Web
release. It allows you to deploy and run WAR files from the command line with a single
command, and also features automatic, dynamic clustering with Hazelcast.
Documentation Conventions
Any commands listed will be written assuming they are being run from the same directory as
the Payara Micro JAR file.
Any commands listed will also be written assuming that the system environment variables
have been set up to have Java on the system Path.
Any paths listed throughout the documentation will use the Unix/Linux file path structure
(forward slashes).
The owning class of an API method will not be explicitly stated unless it is not clear if an
instance has been started or not; methods that operate on Payara Micro instances before
they have been bootstrapped (instances that have not yet been started) are contained in the
PayaraMicro class, whereas methods that operate on bootstrapped instances (running
114
Starting an Instance
Starting an Instance
This section details the very basics of starting an instance.
This single command is all you need to run Payara Micro instances; additional configuration
options are all a part of this command.
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
You can then start an instance with default settings by calling the bootstrap() method from
the PayaraMicro class. This initialisation will throw a BootstrapException exception, so you
will need to surround it with a try-catch, or have the parent method throw the exception.
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
115
Starting an Instance
Programmatically section. The use of the getInstance() method does not exclude you from
using the default settings however; calling the bootstrap() method on its own (as shown in
the example above) is functionally equivalent to calling the bootstrap() method directly
after the getInstance() method, such as in the example below:
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.PayaraMicroRuntime;
116
Deploying Applications
Deploying Applications
This section details how to deploy applications.
117
From the Command Line
Deploying an Application
As noted in section Starting an Instance, all Payara Micro actions are run for the Payara
Micro JAR, all in one command; it is not possible to start an instance with one command,
and deploy an application to it with another.
118
From the Command Line
Alternatively, you can use the --deploymentDir option. This option specifies a directory to
scan for deployable archives, allowing you to store all of the applications you wish to be
deployed in a directory, and have them be deployed automatically upon instance startup.
This option can be used multiple times, and in conjunction with the standard --deploy
options.
By default, Payara Micro will only search for artefacts in the Maven Central repository. If you
wish to search additional repositories, you can add them to the list of repositories to search
with the --additionalRepository option:
To search through multiple additional repositories, you can simply call the option multiple
times:
119
Programmatically
120
Programmatically
Deploying an Application
Programmatically during Bootstrap
There are two methods you can use to deploy an application during the bootstrapping
process:
addDeployment(String pathToWar)
addDeploymentFile(File file)
The first, addDeployment(String pathToWar) , accepts a String that points to the path of the file
to be deployed. For example:
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
The second method, addDeploymentFile(File file) , functions in the same way as the
addDeployment(String pathToWar) method, but takes a File object as its parameter instead:
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
import java.io.File;
Unlike when controlling Payara Micro from the command line, you can split the instance
initialisation and configuration across multiple lines methods. For example, to deploy an
application on one line, and start the instance on another:
121
Programmatically
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
micro.addDeployment("/home/user/example.war");
micro.addDeployment("/home/user/test.war");
micro.addDeployment("/home/user/three.war");
micro.bootStrap();
}
}
Alternatively, you can use the programmatic equivalent of the --deploymentDir command
line option (described in the section Deploying From the Command Line):
For example:
122
Programmatically
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
import java.io.File;
123
Programmatically
Deploying an Application
Programmatically to a Bootstrapped
Instance
There are three methods available for deploying an application to a bootstrapped instance:
deploy(File war)
deploy(File war)
The first method works in the same way as the addDeploymentFile method described in the
section Deploying Programmatically during Bootstrap.
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.PayaraMicroRuntime;
import java.io.File;
124
Programmatically
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
125
Programmatically
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
126
Programmatically
run the deploy asadmin command. To deploy to a single instance, you must create a
members Collection only containing a single instance.
As an example of deploying an application to only the local instance with the run command:
127
Programmatically
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
import fish.payara.micro.services.data.InstanceDescriptor;
import java.util.ArrayList;
import java.util.Collection;
// Get a Collection with all running instances in the local runtime's cluster
Collection<InstanceDescriptor> allInstances = runtime.getClusteredPayaras();
128
Programmatically
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
// Run the deploy asadmin command on all instances in the runtime's cluster
runtime.run("deploy", "/home/user/test.war");
}
}
See the example for deploying on local instance on using the run method on a subset of
instances in a cluster.
129
Programmatically
Deploying an Application
Programmatically from a Maven
Repository
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
130
Programmatically
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
To search through multiple additional repositories, you can simply call the addRepoUrl
method, using commas to separate URLs:
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
repository.
131
Programmatically
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
132
Configuring an Instance
Configuring an Instance
This section details how to configure a Payara Micro instance.
133
From the Command Line
The options available can be seen by running the JAR with the --help option, or by
consulting the Payara Micro Command Line Options section in the Appendices.
As an example, see below for starting an instance with a non-default HTTP port:
The --rootDir option sets the root configuration directory and saves the configuration
across restarts. If empty, this directory will be filled by the default confguration, including the
domain.xml file.
Precedence
If specifying multiple options at once, the following precedence is followed:
In human language:
The domain.xml in the directory specified by the rootDir option (if one exists) is
overriden by the domain.xml specified with the domainConfig option
The Http and Https port numbers specified in either of these domain.xml files are
134
From the Command Line
overidden to be the default values of 8080 and 8081 when the autoBindHttp or
autoBindSsl options are enabled respectively.
These default port values are then overriden in turn by the port numbers specified with
the port or sslPort options.
135
Programmatically
The configuration methods available to you should be detected by your IDE, allowing you to
view them using the auto-complete feature common to most popular IDEs. Alternatively, you
can consult the Payara Micro Configuration Methods section in the Appendices.
As noted in the Deploying an Application Programmatically section, you can either call the
desired configuration commands on one line during instance initialisation, or on separate
lines after creating a PayaraMicro variable.
As an example of configuring an instance to use a different HTTP and Cluster start port on
one line, see here:
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
For the example of the same, but done across multiple lines, see here:
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
136
Programmatically
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
137
Packaging as an Uber Jar
this will package up the payara-micro.jar and the war file into a single jar. this jar will then be
able to be run with;
Any additional command line options you specify when creating an uber jar are recorded
and retained when you run the uber jar with no parameters. For example
java -jar payara-micro.jar --deploy test.war --port 9080 --lite --clusterName test-clu
ster --clusterPassword test-password --outputUberJar test2.jar
All the command line option for port etc. will be retained when the uber jar is ran with no
parameters.
138
Via System Properties
payaramicro.mcAddress --mcAddress
payaramicro.mcPort --mcPort
payaramicro.clusterName --clusterName
payaramicro.clusterPassword --clusterPassword
payaramicro.lite --lite
payaramicro.maxHttpThreads --maxHttpThreads
payaramicro.minHttpThreads --minHttpThreads
payaramicro.noCluster --noCluster
payaramicro.disablePhoneHome --disablePhoneHome
payaramicro.rootDir --rootDir
payaramicro.name --name
payaramicro.logToFile --logToFile
139
Alternate Keystores for SSL
140
Stopping an Instance
Stopping an Instance
This section describes how to shut down a Payara Micro instance.
The shutdown() method of the PayaraMicro class must be called on the instance of Payara
Micro that you want to shut down, so will realistically only be used on a PayaraMicro
instance variable:
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
micro.shutdown();
}
}
141
Stopping an Instance
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
instance.shutdown();
}
}
142
Automatic Clustering
Automatic Clustering
This section details how the Payara Micro automatic clustering works.
The integration of Hazelcast into Payara Micro allows instances to automatically, and
dynamically, cluster together. When two instances are pointed at the same multicast address
and port, they will automatically cluster together.
You can see evidence of the automatic clustering by simply starting two instances (with
different HTTP port configurations), and you should see the following in the log output:
Members [2] {
Member [192.168.174.130]:5900 this
Member [192.168.174.130]:5901
The --startPort option is used to determine which port the Payara Micro instance will first
try to bind to, if the port is already bound to (say, by another Payara Micro instance), then
the Payara Micro instance will simply increment the startPort value and try again until it finds
a port it can bind to.
For example, if there are already two Payara Micro instances running, which have bound
ports 5900 and 5901, then a third instance started with a startPort value of 5900 will first try
to bind to 5900, then to 5901, then finally settle on 5902.
If you wish to have multiple clusters, then you can make use of the --mcAddress and
`mcPort options to define a different multicast address and port; assign a different address
and port to each set of instances you wish to operate in a separate cluster and they will
automatically make their own cluster on the new multicast address and port. You can also
use --clusterName and --clusterPassword to segregate clusters.
You can create a cluster topology whereby a web application is hosted in a number of
payara micro instances and the garbage collection ergonomics for these instances are tuned
for throughput, in addition a number of payara micro instances are also in the cluster with no
143
Automatic Clustering
applications deployed and these instances are tuned for long lived web session data. In this
case the web application instances could be designated as lite cluster members to ensure
no web session data is stored within their JVMs.
Lite members can also be used purely if you want a clustered payara micro instance to join
the same cluster and receive CDI events or clustered events but without storing any data.
144
Maven Support
Maven Support
Payara Micro has been uploaded to Maven central, allowing you to include it as a
dependency in your POM. This allows you to easily add the required Payara Micro classes
and methods to your application to use Payara Micro programmatically.
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-micro</artifactId>
<version>4.1.1.162</version>
</dependency>
145
HTTP(S) Auto-Binding
When auto-binding is enabled, Payara Micro will attempt to connect to the port specified with
the --port or --sslPort option (or, if these options are not specified, to port 8080 and
8181 respectively), and if that port is busy, it will instead try to bind on the next port up,
repeating this process until it finds a free port, or the --autoBindRange limiter is reached.
For example, if ports 8080, 8081, and 8181 were busy, and ports 8082 and 8182 were free,
then starting Payara Micro with the following command would have the HTTP port bind to
8082 and the HTTPS port bind to 8182:
Whereas the following would fail to start in the same situation because --autoBindRange is
not large enough (no free port within the range of 8080-8081):
java -jar payara-micro.jar --port 8080 --autoBindHttp --sslPort 8181 --autoBindSsl --a
utoBindRange 1
Be aware that the auto-bind feature does not currently read port values from domain.xml
files; if the --port and --sslPort options are not used, then the --autoBindHttp and --
autoBindSsl options will assume that the HTTP and HTTPS ports will be at the default
146
Running asadmin Commands
The first, run(String command, String... args ) , runs the specified asadmin command on
all instances in a runtime's cluster. It returns a Map<InstanceDescriptor,
Future<ClusterCommandResult>> , as detailed in the appendices.
supplied. It returns a Map of the same type as the other run method. You can use the
method getClusteredPayaras() provided by PayaraMicroRuntime to retrieve the list of all
instances in the cluster and filter the list afterwards.
Examples on using the first and second methods can be seen in section Deploying
Applications Using an asadmin Command. The first example shows one way in which you
can construct a Collection containing a subset of the running instances in a cluster using the
getClusteredPayara() method to get the InstanceDescriptor identifiers.
147
Running Callable Objects
The two methods also work in a similar way to the two asadmin run methods:
cluster
run(Collection<InstanceDescriptor> members, Callable<T> callable) runs the Callable
148
Logging to a file
Logging to a file
This section describes how to print all the Payara Micro log messages into a file.
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
149
Remote CDI Events
You can view the methods associated with CDI Events in the appendices.
150
Payara Micro Appendices
151
Command Line Options
Generated
--name Sets the instance name. Universally Unique
Identifier.
If not set, has no
Sets the root configuration directory
value and defaults
--rootDir and saves the configuration across
to the temp
restarts.
directory.
152
Command Line Options
--logo
Reveals the #BadAssFish or a custom
logo on boot
--help
Displays the configuration options and If not set, this option
then exits. is not used.
153
Payara Micro API
154
Payara Micro API
Configuration Methods
This section details the PayaraMicro.class configuration methods that are used during the
bootstrap process.
Configuration
Description Get Method Set Method
Operand
155
Payara Micro API
Gets or sets
whether
clustering is PayaraMicro
No Clustering enabled or boolean isNoCluster() setNoCluster(boolean
noCluster)
156
Payara Micro API
disabled for an
instance.
Enables or
Disables auto- PayaraMicro
HTTP Auto-
binding of the boolean getHttpAutoBind() setHttpAutoBind(boolean
Binding httpAutoBind)
HTTP port for an
instance.
Enables or
Disables auto- PayaraMicro
HTTPS Auto-
binding of the boolean getSslAutoBind() setSslAutoBind(boolean
Binding sslAutoBind)
HTTPS port for
an instance.
157
Payara Micro API
Operation Methods
This section details the other methods of the Payara Micro API that operate Payara Micro
instances. PayaraMicro.class methods are used during the bootstrap process, whereas
PayaraMicroRuntime.class methods are used on running instances.
Deployment Methods
Setup and Shutdown Methods
CDI Methods
Run Methods
Get Methods
Deployment Methods
Deployment methods are used for the deployment of applications to Payara Micro instances.
PayaraMicro.class Methods
Command
Method Description Line
Equivalent
PayaraMicroRuntime.class Methods
158
Payara Micro API
Method Description
PayaraMicro.class Methods
Method Description
PayaraMicroRuntime
bootStrap() throws
Checks the supplied configuration parameters and starts a
BootstrapException Payara Micro instance.
PayaraMicro Obtains the static singleton instance of the Payara Micro server.
getInstance() If one does not exist, one will be created and returned.
PayaraMicro Obtains the static singleton instance of the Payara Micro server.
getInstance(boolean If one does not exist and create is set to true, one will be
create)
created and returned, otherwise returns null.
void shutdown()
throws Stops and shuts down the Payara Micro instance.
BootstrapException
PayaraMicroRuntime.class Methods
Method Description
void shutdown() throws Stops and shuts down the Payara Micro
BootstrapException instance.
CDI Methods
These methods are used for firing CDI Events across running instances.
159
Payara Micro API
Method Description
void addCDIEventListener(CDIEventListener listener) Adds a CDI Event Listener.
void removeCDIEventListener(CDIEventListener Removes a CDI Event
listener) Listener.
void addClusterListener(PayaraClusterListener
listener) Adds a Cluster Listener.
void removeClusterListener(PayaraClusterListener
listener) Removes a Cluster Listener.
Run Methods
These methods are used for running asadmin commands or Callable objects on
bootstrapped instances.
Method Description
Get Methods
These methods are used for getting information on running Payara Micro instances. For
information on the Get methods of an un-bootstrapped instance, see the Configuration
Methods section.
160
Payara Micro API
Method Description
161
Payara Micro API
Javadoc
The Javadoc for the most recent version of the Payara Micro API can be found here:
http://payara.github.io/Payara/nucleus_API/payara-modules/payara-micro/target/apidocs/
162
History of Release Notes
163
Payara Server 4.1.1.162 Release Notes
Release Highlights
Our highlights for the 162 release are our new asadmin command recorder, Payara Server's
new ability to create uber jars and a new EAR scoped class loader.
The asadmin recorder feature will allow you view the commands you have run from the
admin console. These can be used to investigate what the console is really doing or used in
automation scripts.
Payara Micro now has --outputUberJar option that allows you to create easily distributed
uber-jars from your war files.
EAR Scoped classloader that loads classes from within the EAR providing the ability to
override server classes.
Payara Server and Payara Micro can now cluster together enabling new cluster topologies
for cloud based and/or containerised deployments!
New Features
This section details the newly developed additions to Payara Server.
Updated Modules
This section details the modules that have been updated since the last release (4.1.1.161.1).
Guava 18.0
Weld 2.3.2.Final
Tyrus 1.12
hk2 2.4.0
164
Payara Server 4.1.1.162 Release Notes
Mojarra 2.2.13
Grizzly 2.3.24
Hazelcast 3.6.2
Enhancements
This section details the issues marked as enhancements that have been implemented for
this release.
602/PAYARA-639 - Unique IDs are kept based on the name of the EJB
677/PAYARA-593 - Cleanup on Admin Console
691/PAYARA-610 - integrated healthcheck with payara micro
694/PAYARA-263 - Autobinding port precedence warnings
711/PAYARA-576 - Integrate upstream pull request for the 4.1.162 release
712/PAYARA-675 - Payara Micro can deploy exploded archive
718/PAYARA-745 - Fix isSupportClientInfo in ConnectionHolder40 for old drivers
720/PAYARA-676 - Restart cluster asadmin command
728/PAYARA-679 - Uber Jar command line option
733/PAYARA-743 - Prevent duplicate server respawn when run under supervision
738/PAYARA-692 - Remove dependency on Hazelcast
739/PAYARA-687 - Implement Hazelcast Cluster Group
745/PAYARA-720 - plugin versions upgraded for to be compatible with maven upgrade
750/PAYARA-688 - Add ability to pass a system properties file to Payara Micro
776/PAYARA-707 - edit of message for tls
749/PAYARA-686 - Clean up the help message by indicating whether a command line
flag has a parameter or not
772/PAYARA-728 - Implement new index page
774/PAYARA-672 - add PostgreSQL ejbtimer table creation sql
785/PAYARA-390 - allow monitoring of asynchronous methods
786/PAYARA-677 - Add support for overriding app server libraries using
ScopedEARClassloader on domain level
Fixed Issues
This section details the issues marked as bugs that have been fixed for this release.
Payara Fixes
This section details the fixes implemented by the Payara team or community.
165
Payara Server 4.1.1.162 Release Notes
166
Payara Server 4.1.1.162 Release Notes
763/PAYARA-674 - The "Restart Required" screen does not have the warning about
restarting when Payara is a service
762/PAYARA-717 - invokeMethod now depends on getDeclaredMethod as recursive
instead of getMethod
766/PAYARA-708 - Admin-console-still-shows-Grizzly-Snoop-option-despite-the-feature-
being-removed
783/PAYARA-738 - references to weld osgi bundle.jar should be fixed
Known Issues
Known issues can be seen on our GitHub issues page here:
https://github.com/payara/Payara/issues
167
Payara Server 4.1.1.161.1 Release Notes
Updated Modules
This section details the modules that have been updated since the last release (4.1.1.161).
Fixed Issues
This section details the issues marked as bugs that have been fixed for this release.
Payara Fixes
This section details the fixes implemented by the Payara team or community.
637/PAYARA-599 Cannot start bundle ../core.jar because it is not contained in the list
of installed bundles
649/PAYARA-624 Mixed Payara Micro and Payara Server cluster causes session loss
656/PAYARA-594 Spurious AllPermission warning
658/PAYARA-542 Cannot enable secure ciphers for admin-listener
659/PAYARA-588 Excessive logging from the ASURL Classloader
667/PAYARA-640 Payara does not rollback when TxType is REQUIRES_NEW
672/PAYARA-631 Problems with Pax-Logging
673/PAYARA-642 Fix Classloader issue when bootstrapping the ORB for OSGi bundle
deployments
Known Issues
Known issues can be seen on our GitHub issues page here:
https://github.com/payara/Payara/issues
168
Payara Server 4.1.1.161 Release Notes
Release Highlights
The most eye catching feature in this release is a new look for the Admin Console; weve
given the Admin Console another go over from our initial attempt, rebranding it to look more
distinctly Payara!
The more exciting highlight of this release is the Healthcheck Service. In its initial release,
this service allows you to monitor CPU usage, the number of times Garbage Collection has
occurred, the machine memory usage, the heap memory usage, and any hogging threads.
Documentation for it can be found here), and documentation for the asadmin commands can
be found here).
Updated Modules
This section details the modules that have been updated since the last release (4.1.1.154).
Jersey 2.22.1
EclipseLink 2.6.2 (Patched to payara-p1)
GlassFish Corba 4.0.1 (Patched to payara-p3)
Woodstock 4.0.2.10 (Patched to payara-p2)
Metro 2.3.2-b608 (Patched to payara-p2)
MQ 5.1.1-b02 (Patched to payara-p1)
Apache commons-fileupload 1.3.1
Enhancements
This section details the issues marked as enhancements that have been implemented for
this release.
169
Payara Server 4.1.1.161 Release Notes
Fixed Issues
This section details the issues marked as bugs that have been fixed for this release.
Payara Fixes
This section details the fixes implemented by the Payara team or community.
170
Payara Server 4.1.1.161 Release Notes
Known Issues
Known issues can be seen on our GitHub issues page here:
https://github.com/payara/Payara/issues
171
Payara Server 4.1.1.154 Release Notes
Release Highlights
This release brings us back in line with GlassFish 4.1.1, with the benefit of all our additional
fixes and enhancements from our previous releases, as well as a few more. Of particular
interest in this release:
In line with our naming strategy, our version number has also been extended for this release
to reflect the fact that we are up to date with GlassFish 4.1.1.
Updated Modules
This section details the modules that have been updated since the last release (4.1.153).
Mojarra 2.2.12
Webservices 2.3.2-b608
JAXB 2.2.12-b141219.1637
JAXB-API 2.2.13-b141020.1521
Weld 2.2.16.Final
Tyrus 1.11
JBatch 1.0.1-b09
Grizzly 2.3.23
HK2 2.4.0-b32
Jersey 2.22
Hazelcast 3.5.2
Enhancements
172
Payara Server 4.1.1.154 Release Notes
This section details the issues marked as enhancements that have been implemented for
this release.
Fixed Issues
This section details the issues marked as bugs that have been fixed for this release.
Payara Fixes
This section details the fixes implemented by the Payara team or community.
173
Payara Server 4.1.1.154 Release Notes
Upstream Fixes
This section details the fixes brought in from the GlassFish upstream.
174
Payara Server 4.1.1.154 Release Notes
integration in revision 46674. Changes have been made to check if parameters have
been processed/read too. character encoding will not be set if either parameters have
been reader or reader is being used.
EjbDescriptor abstract class implements JndiNameEnvironment and
WritableJndiNameEnvironment. For some of these methods, though there is a generic
implementation (For example via CommonResourceDescriptor), these methods still
needs to be implemented in a specific way within EjbDescriptor abstract class to get the
expected behavior whenever these methods are invoked in EjbDescriptor's context. To
ensure the same, a new unit test is being introduced within source workspace, namely
EjbDescriptorInheritedMethodImplementationTest,which basically ensures following two
things: All methods defined in JndiNameEnvironment and
WritableJndiNameEnvironment have a direct implementation within EjbDescriptor
abstract class and all these methods are marked final in EjbDescriptor to ensure that
sub-classes of EjbDescriptor don't override these methods accidentally, possibly
causing unexpected behavior.
fix web container issue filed in Grizzly
Known Issues
Known issues can be seen on our GitHub issues page here:
https://github.com/payara/Payara/issues
175
Payara Server 4.1.153 Release Notes
Release Highlights
This release has several notable features:
The Payara Micro API has been improved, now granting control over running instances
and the ability to run asadmin commands.
There is now an auto-binding feature for the HTTP and HTTPS ports of Payara Micro
instances. This feature allows Payara Micro instances to automatically find a free port if
the default or specified HTTP or HTTPS ports are already bound to.
This release also introduces the Payara-Blue series of distributions, built using the IBM
JDK for AIX systems.
See the What's new in Payara 4.1.153 blog for descriptions of these features.
Updated Modules
This section details the modules that have been updated since the last release (4.1.152.1).
Mojarra 2.2.11
Javax XML Registry API 1.0.7
Weld 2.2.13.Final
JBatch Container 1.0.1-b08
JBatch SPI 1.0.1-b08
Grizzly 2.3.21
Jersey 2.19
Jackson 2.5.1
Mail 1.5.4
Hazelcast 3.5
Enhancements
This section details the GitHub issues marked as enhancements that have been
implemented for this release.
61 - Docker support?
175 - Add extra usage instructions for set-batch-runtime-configuration Asadmin
command
188 - CDI container should be able to inject Cache
176
Payara Server 4.1.153 Release Notes
359 - Automatically increment busy payara micro http and https ports
361 - Update Japanese translation
Fixed Issues
This section details the GitHub issues marked as bugs that have been fixed for this release.
Upstream Fixes
This section details the fixes brought in from the GlassFish upstream.
177
Payara Server 4.1.153 Release Notes
178
Payara Server 4.1.152.1 Release Notes
Fixed Issues
This section details the GitHub issues marked as bugs that have been fixed for this release.
179
Payara Server 4.1.152 Release Notes
Release Highlights
The payara-embedded-nucleus distribution has been replaced by the Payara Micro
distribution. This is a light-weight distribution that has Hazelcast integrated to allow for
automatic web session clustering and JCache distribution.
We have also added a separate Payara domain template, which has a few optimisations:
Updated Modules
This section details the modules that have been updated since the last release (4.1.151).
Hazelcast 3.4.2
EclipseLink 2.6 (Payara Patched)
Weld 2.10.SP1
GlassFish-CORBA 4.0.1-p1 (Payara Patched)
Grizzly 2.3.19
HK2 2.4.0-b12
HK2 Plugin 2.4.0-12
Jersey 2.17
JMS API 2.0.1
Mojarra 2.2.10
Webservices 2.3.1-b419 (downgrade)
JAXB API 2.2.12-b140109.1041 (downgrade)
JAXB 2.2.10-b140802.1033 (downgrade)
MQ 5.1.1-b02
Tyrus 1.10
Shoal 1.7.0-M1 (Payara Patched)
180
Payara Server 4.1.152 Release Notes
Enhancements
This section details the GitHub issues marked as enhancements that have been
implemented for this release.
Fixed Issues
This section details the GitHub issues marked as bugs that have been fixed for this release.
181
Payara Server 4.1.152 Release Notes
182
Payara Server 4.1.151 Release Notes
Release Highlights
JBatch has been upgraded to version 1.0.1-b04 and now recognises MySQL, Postgresql,
Oracle, and DB2 as persistence managers. Hazelcast 3.4 has also been implemented as a
clustered web session store and provider of JSR107.
We are also now providing distributions of the Multi-Language (ml) releases, which contain
the l10n packages from GlassFish.
Note We lack translations for the additions we have made, such as the Hazelcast
configuration page in the Admin Console. We would prefer to not accept internet translations
as they are typically inaccurate.
Updated Modules
This section details the modules that have been upgraded since the last release (4.1.144).
Jersey 2.15
Tyrus 1.9
JSTL-Impl 1.2.4
Mojarra 2.2.9
Weld 2.2.7
Javax Batch API 1.0.1-b01
JBatch Container 1.0.1-b04
JBatch SPI 1.0.1-b04
Grizzly 2.3.18
HK2 2.4.0-b08
HK2 Plugin 2.4.0-b08
Jackson 2.5.0
Jettison 1.3.7
Shoal 1.6.22
Metro 2.3.2-b608
JAXB-API 2.2.13-b141020.1521
JAXB 2.2.12-b141219.1637
New Module
183
Payara Server 4.1.151 Release Notes
Hazelcast 3.4
Enhancements
This section details the GitHub issues marked as enhancements that have been
implemented for this release. You can view the issues in detail by following the provided
links.
184
Payara Server 4.1.151 Release Notes
185
Payara Server 4.1.144 Release Notes
Feature Improvements
Payara 4.1.144 ships with support for setting the schema in JBatch for Derby (GlassFish-
21041). This can be found in the Admin Console under server > Batch > Configuration
Bug Fixes
Payara 4.1.144 was built upon GlassFish 4.1, so contains all of the bug fixes and
improvements to be found there. The release notes for GlassFish 4.1 can be found here.
In addition to the fixes incorporated into GlassFish 4.1, Payara 4.1.144 also has the
following additional bug fixes:
186