FreeBSD Glassfish

Allikas: Kuutõrvaja

Sissejuhatus

Glassfish on Suni poolt toetatud javal põhinev rakendusplatvorm (ingl. k. application platform), millest levitatakse erinevaid versioone, muu hulgas

Lähemalt saab erinevate versioonide ja nende kasutustingimustega tutvuda Sun kodulehel.

Versioon 2 Paigaldus

Esimesena on vajalik paigaldada java mida on käsitletud tomcati installi juhendis http://kuutorvaja.eenet.ee/wiki/Jakarta-tomcat

Seejärel mõned vajalikud sõltuvused

Apache Maven

 # cd  /usr/ports/devel/maven
 # make install clean

Maven on software project management and comprehension tool.

Apache ANT

 # cd /usr/ports/devel/apache-ant
 # make install clean

Apache Ant on seejuures Java põhine buildimise vahed. Teoreetiliselt on see omamoodi make.

ported NSS

 # cd /usr/ports/security/nss
 # make install clean

ported NSPR

 # cd /usr/ports/devel/nspr
 # make install clean

Tõmbame FreeBSD jaoks Glassfish source

# cvs -d :pserver:guest@cvs.dev.java.net:/cvs checkout -r SJSAS91_FCS_BRANCH glassfish/bootstrap

Seadistame failist /workspace/glassfish/bootstrap/build.properties kuhu kohta tekib glassfishi install

glassfish.home=/usr/local/glassfish
# cd glassfish/bootstrap
# maven checkout
# maven -Dmodules=mail,activation bootstrap build
# maven configure-runtime

Ja käivitame glassfishi

/usr/local/glassfish/bin/asadmin start-domain
Starting Domain domain1, please wait.
Default Log location is /usr/local/glassfish/domains/domain1/logs/server.log.
Redirecting output to /usr/local/glassfish/domains/domain1/logs/server.log
Domain domain1 is ready to receive client requests. Additional services are being started in background.
Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b61-fcs)] with its configuration and logs at: [/usr/local/glassfish/ domains].
Admin Con sole is available at [1].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
https://localhost:8181 .
Following web-contexts are available:
[/web1  /__wstx-services ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://koolitaja.eenet.ee:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instances.

Versioon 3 paigaldus

$ fetch http://download.java.net/glassfish/v3/release/glassfish-v3.zip                                                                   
$ unzip glassfish-v3.zip
$ cd glassfishv3/
$ mv glassfish glassfish3
# mv glassfish3 /usr/local/

http://docs.sun.com/app/docs/doc/820-7689/aboaa?a=view

# /usr/local/glassfish3]# sh bin/asadmin create-domain --adminport 4849 domain2
 Enter admin user name [Enter to accept default "admin" / no password]>
Using port 4849 for Admin.
Default port 8080 for HTTP Instance is in use. Using 57219
Default port 7676 for JMS is in use. Using 57220
Default port 3700 for IIOP is in use. Using 57221
Default port 8181 for HTTP_SSL is in use. Using 57222
Default port 3820 for IIOP_SSL is in use. Using 57223
Default port 3920 for IIOP_MUTUALAUTH is in use. Using 57224
Default port 8686 for JMX_ADMIN is in use. Using 57225
Using default port 6666 for OSGI_SHELL.
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=koolitaja.eenet.ee,OU=GlassFish,O=Sun Microsystems,L=Santa Clara,ST=California,C=US]

No domain initializers found, bypassing customization step
Domain domain2 created.
Domain domain2 admin port is 4849.
Domain domain2 allows admin login as user "admin" with no password.
Command create-domain executed successfully.

Domeene võib sedamoodi luua hulgi, tarkvara lahendab ise ära, et pordid ei kattuks

Startimiseks

# /usr/local/glassfish3/bin/asadmin start-domain domain

Seiskamiseks asendada start-domain ümber stop-domain käsuga

PS: Hetkel olemas uuem versioon 3.1.2 http://dlc.sun.com.edgesuite.net/glassfish/3.1.2/release/

Kasutamine

Ligipääs toimub Glassfishi haldusele järgneva urli kaudu

http://veebiaadress.ee:4848/login.jsf 

Kasutajaks vaikimisi admin ja parooliks adminadmin

Mille järel peaks nägema juba pilti, default kasutaja admin parool adminadmin

Glassfish-1.gif

MySQL

Kui on vaja javat ühendada mysql'iga tuleks paigaldada MySQL Connector/J mille leiab http://dev.mysql.com/downloads/connector/j/5.0.html

# tar -xf mysql-connector-java-5.0.8.tar.gz
# cd mysql-connector-java-5.0.8
# mv mysql-connector-java-5.0.8-bin.jar /usr/local/glassfish/domains/domain1/lib/ext/
# /usr/local/glassfish/bin/asadmin stop-domain
# /usr/local/glassfish/bin/asadmin start-domain

(bin/asadmin on glassfish cli ehk käsurea liides)

Seejärel andmebaasi parameetrid paika rakendus2Pool (Connection Polls all) Resources -> JDBC -> Connection Pools

Vajalik tekitada veel JDBC resource rakendus

Lingid

https://glassfish.dev.java.net/public/downloadsindex.html