- GlassFish may be downloaded from here.
Recent versions are
there.
- Java EE enterprise application client is a project type in Apache NetBeans,
which allows the creation of “fake” client programmes.
These execute inside the Java EE virtual machine (e.g., the GlassFish
application server).
- To mount extra JAR libraries on GlassFish, related files have to be added here:
<GlassFish
installation directory>/glassfish/domains/domain1/lib/ext
(domain1
may be replaced by my_domain
for instance).
asadmin
allows the administration of GlassFish.
It relies on Java 8. Please check that the default JVM is not greater than 8!
Change to Java 8 before launching asadmin
(Windows PowerShell)
echo "Java home: $env:JAVA_HOME"
$env:PATH = "C:\Program Files\Java\jdk1.8.0_291\bin;$env:PATH"
echo "PATH: $env:PATH"
cd C:\Users\franc\Documents\NetBeansProjects\glassfish-5.1.0\glassfish5\bin
Start-Process ".\asadmin.bat"
Change to Java 8 before launching asadmin
(macOS)
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_333`
cd /Users/FranckBarbier/NetBeansProjects/glassfish5/bin
./asadmin
Example (domain creation)
asadmin> create-domain --user barbier --adminport 4850 --savemasterpassword=true --savelogin=true FranckBarbier
- domain1, admin port 4848 (admin/adminadmin)
- FranckBarbier, admin port 4850 (barbier/<typed password> for admin AND master passwords)
- HTTP: 8080 (idem domain1)
- HTTP_SSL: 8181
- JMS: 7676
- IIOP: 3700
- JMX_ADMIN: 8686
- Info. in
.asadminpass
(under Windows: Documents and Settings\Franck Barbier
)
Example (JDBC resource -JavaDB- creation)
asadmin> start-domain domain1
asadmin> list-jdbc-connection-pools
asadmin> delete-jdbc-connection-pool New_York_City_Penitentiary_database_pool
asadmin> create-jdbc-connection-pool --help
asadmin> create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource --driverclassname=org.apache.derby.jdbc.ClientDriver --property user=FranckBarbier:password=FranckBarbier:databasename=New_York_City_Penitentiary_database:servername=localhost:portnumber=1527 New_York_City_Penitentiary_database_pool
# Database server must run:
asadmin> ping-connection-pool New_York_City_Penitentiary_database_pool
asadmin> list-jdbc-resources
asadmin> delete-jdbc-resource jdbc/New_York_City_Penitentiary
asadmin> create-jdbc-resource --connectionpoolid New_York_City_Penitentiary_database_pool jdbc/New_York_City_Penitentiary
asadmin> stop-domain domain1
Example (persistence.xml
file)
<persistence-unit name="NYCP_persistence_unit" transaction-type="JTA">
<jta-data-source>jdbc/New_York_City_Penitentiary</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
Example (JDBC resource -Oracle- creation)
# Beforehand, put 'ojdbc8-21.7.0.0.jar'in <GlassFish installation directory>/glassfish/domains/domain1/lib/ext:
create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --restype javax.sql.DataSource --property user=<USER>password:=<PASSWORD>:url="jdbc\\:oracle\\:thin\\:@scinfe098.univ-pau.fr\\:1521\\:etud" New_York_City_Penitentiary_database_pool