GlassFish On FreeBSD

 先来两个网址,参考这个两个做就可以成功。

 

http://blogs.sun.com/hyau/entry/glassfish_on_freebsd_too

 

http://john.vipvip.com/blog/?p=33

 

 

 

 

需要的软件:

i) For installation of JDK -
Since Sun does not have official JDK 1.5 on FreeBSD platform. Therefore, we either have to build our own jdk from the source(note 1), or with the help from FreeBSD's java user group, there is a port version of jdk 1.5 being done (download and install from here).
不要用jdk 1.6,因为第四步的时候会出错。


ii) For installation of Apache Maven -  Maven就行了,不要用Maven2。
  cd  /usr/ports/devel/maven
  make install clean
 
iii) For installation of Apache ANT -
  cd /usr/ports/devel/apache-ant
  make install clean

iv) For installation of ported NSS -
  cd /usr/ports/security/nss
  make install clean

v) For installation of ported NSPR -
  cd /usr/ports/devel/nspr
  make install clean


设置环境变量

以bash为例:

JAVA_HOME=/usr/local/diablo-jdk1.5.0
MAVEN_HOME=/usr/local/share/java/maven
ANT_HOME=/usr/local
CVSROOT=:pserver:<java.net_userid>@cvs.dev.java.net:/cvs
PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH
export JAVA_HOME MAVEN_HOME ANT_HOME CVSROOT PATH

我没设,因为系统自己找到了这些东西。


1、The first step is to checkout the module dependencies and common files used in the build system and edit the properties file.

% mkdir workspace
% cd workspace
% cvs -d :pserver:<userid>@cvs.dev.java.net:/cvs checkout glassfish/bootstrap

This will checkout project.xml, maven.xml, project.properties, and common files referenced from project.xml.

Edit glassfish/bootstrap/project.properties for the following properties name value:

glassfish.os.name=Darwin (since Darwin and FreeBSD have the same family root (ancestor "BSD"), and please see FAQ 1.)
glassfish.cvs.username=hyau (use the same login name that you have for http://glassfish.dev.java.net)


注:我用了John的方法:$cvs -d :pserver:YOUR_ACCOUNT_LOGIN@cvs.dev.java.net:/cvs co -r SJSAS91_UR2_BRANCH glassfish/bootstrap
我去dev.java.net注册了帐号,在执行checkout之前我先login(cvs -d :pserver:your_id@cvs.dev.java.net:/cvs login),它不会自己登录。
还有,我把workspace建在了/usr/local/,只因本人比较懒,没去研究它的配置文件,有什么后果的话以后再改,好在这机器只是测试用的。



2、Next checkout the sources.
% cd glassfish/bootstrap
% maven checkout (There are different tag to choose from note 4.)

注:这里可以选择不同的tag,来checkout不同的分支代码。


3、 Bootstrap the server image (a collection of  image and jar files used to run glassfish).

% maven bootstrap-all
or
% maven bootstrap (only if you have build before)


4、 Build the checked out source code.

% maven build


5、 Configure the GlassFish Server runtime.  This step will create the asadmin script, run create-domain, etc which are needed to run the GlassFish server.

% maven configure-runtime (Please read the note 2 before running this command.)

注:Note 2 中的内容
Before running the command "maven configure-runtime", please make sure to do the following:

- go to <install-dir>/lib/install/templates
- vi asadmin.template
- add -Dderby.storage.fileSyncTransactionLog="true" to the template
(原因看这里:https://glassfish.dev.java.net/issues/show_bug.cgi?id=8)


6、 Starting  up the server using the asadmin command in <glassfish.root>/publish/bin directory.

<glassfish.root>/publish/bin/asadmin start-domain

注:前面没有错误就说明已经编译并安装好了。不想安装在默认的目录你得好好研究配置文件才行,不然就跟我一样吧。

7、 Start accessing the newly compile build GlassFish (Java EE).

 From any browser:
 http://hostname:4848
 http://hostname:8080
 
 下面是GlassFish开的一些端口:    
 
 Using port 4848 for Admin.                  
 Using port 8080 for HTTP Instance.          
 Using port 7676 for JMS.                    
 Using port 3700 for IIOP.                   
 Using 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.    
 
 
 总结
 
弯路:
1 就是一开始用的JDK 1.6,导致编译失败,直到看到John's notes才知道是什么原因。
2 把workspace建在了/tmp,编译完发现它安装在了/tmp.非常郁闷,懒得看配置文件就去/usr/local重新编译了一个,目前正用着.有问题以后再改.
3 checkout前没有login,导致系统总提示我用户不存在.非常郁闷,以至于我跑去申请GlassFish的开发人员资格.丫的,害死我了.

最后一个问题,就是启动GlassFish的时候提示不支持J2EE,十分的不明白.有待下一阶段测试后才知道是不是真的不支持.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值