Netbeans 安装了 Glassfish,并显示 Glassfish 正在运行:
Running the create-domain subcommand
Using default port 4848 for Admin.
Using default port 8080 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Using default port 6666 for OSGI_SHELL.
Using default port 9009 for JAVA_DEBUGGER.
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=dur.bounceme.net,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=dur.bounceme.net-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
Domain dur created.
Domain dur admin port is 4848.
Domain dur allows admin login as user "anonymous" with no password.
Command create-domain executed successfully.
果然,浏览到管理端口(默认情况下本地主机上的 4848)可以很好地显示 GUI。但是,如何asadmin
从 CLI 访问?
thufir@dur:~$
thufir@dur:~$ GlassFish_Server/bin/asadmin list-domains
GlassFish requires Java SE version 6. Your JDK is version 0
thufir@dur:~$
thufir@dur:~$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-9-oracle/bin/java 1091 auto mode
* 1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
2 /usr/lib/jvm/java-9-oracle/bin/java 1091 manual mode
Press <enter> to keep the current choice[*], or type selection number:
thufir@dur:~$
thufir@dur:~$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-9-oracle/bin/javac 1091 auto mode
* 1 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
2 /usr/lib/jvm/java-9-oracle/bin/javac 1091 manual mode
Press <enter> to keep the current choice[*], or type selection number:
thufir@dur:~$
thufir@dur:~$ head GlassFish_Server/README.txt
Thank you for downloading GlassFish Server Open Source Edition 4.1!
Here are a few short steps to get you started...
0. Prerequisite
===============
GlassFish 4.1 requires Oracle JDK 7 Update 65+ or Oracle JDK 8 Update 5+.
Check http://www.oracle.com/technetwork/java/javase/downloads/index.html to download the JDK.
thufir@dur:~$
这在几个层面上都是不一致的。我必须去安装吗甲骨文JDK 8 只是为了运行 Glassfish 4.x?
也可以看看:
答案1
切换到 Oracle JDK 8:
thufir@dur:~$
thufir@dur:~$ sdk ls java
================================================================================
Available Java Versions
================================================================================
9.0.1-oracle
> * 9.0.0-zulu
8u151-oracle
8u144-zulu
8u131-zulu
7u141-zulu
6u93-zulu
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
thufir@dur:~$ sdk install java 8u151-oracle
Oracle requires that you agree with the Oracle Binary Code License Agreement
prior to installation. The license agreement can be found at:
http://www.oracle.com/technetwork/java/javase/terms/license/index.html
Do you agree to the terms of this agreement? (Y/n): Y
Downloading: java 8u151-oracle
In progress...
######################################################################## 100.0%
Repackaging Java 8u151-oracle...
Done repackaging...
Installing: java 8u151-oracle
Done installing!
Do you want java 8u151-oracle to be set as default? (Y/n): Y
Setting java 8u151-oracle as default.
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ javac -version
javac 1.8.0_151
thufir@dur:~$
thufir@dur:~$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ sudo update-alternatives --config java
[sudo] password for thufir:
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-9-oracle/bin/java 1091 auto mode
1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode
3 /usr/lib/jvm/java-9-oracle/bin/java 1091 manual mode
Press <enter> to keep the current choice[*], or type selection number:
thufir@dur:~$
thufir@dur:~$
thufir@dur:~$ GlassFish_Server/
bin/ javadb/ .org.opensolaris,pkg/
glassfish/ mq/ pkg/
thufir@dur:~$ GlassFish_Server/bin/
asadmin pkg updatetool
thufir@dur:~$ GlassFish_Server/bin/asadmin list-domains
domain1 not running
dur2 not running
dur not running
Command list-domains executed successfully.
thufir@dur:~$
工作正常。