Tang Yong, Middleware Development in Nanjing Fujitsu Company Of China Working for Glassfish Team (OSGi & OSGi-JavaEE), Blog: http://osgizone.typepad.com/tangyong/ Tang has posted 3 posts at DZone. You can read more from them at their website. View Full User Profile

Glassfish OSGi-JavaEE Part1 : Introducing Fighterfish sub-project and building

03.10.2013
| 1341 views |
  • submit to reddit

Blog: http://osgizone.typepad.com/tangyong/2013/03/glassfish-osgi-javaee-part1-introducing-fighterfish-sub-project-and-building.html


Since 2012, I start to paly with Glassfish OSGi-JavaEE, and this is a unique position in Glassfish. Since 2009 - the first release of Glassfish v3,  Glassfish OSGi-JavaEE came into being.

Fistly, let us see the definition of Glassfish OSGi-JavaEE:

"GlassFish Server enables interaction between OSGi services and Java EE components. This interaction is bi-directional. On one hand, OSGi services managed by OSGi framework can invoke Java EE components managed by Java EE container. On the other hand, Java EE components managed by Java EE container can invoke  OSGi services managed by OSGi framework. "

If you are careful enough, you will find that in Glassfish v3's distro, there is a special directory called "autostart" which is located in "glassfish/modules" and the jars or OSGi bundles as following implemeting Glassfish OSGi-JavaEE features are located in the "autostart" directory. 

- osgi-javaee-base.jar

- osgi-web-container.jar

- osgi-ejb-container.jar

- osgi-jdbc.jar

- osgi-jpa.jar

- osgi-http.jar

- osgi-jta.jar

- osgi-cdi.jar

- osgi-ee-resources.jar

The above nine jar files are implemented by a glassfish sub-project called "Fighterfish". While I start to play with Fighterfish,  I am very curious the name of Fighterfish. Although I have not ask Sahoo(Fighterfish's leader, a famous developer of Glassfish Team) why uses the name, I guess that compared with Glassfish, Fighterfish can aim to make glassfish inject more energies and more competitive strength while competing with other application servers.  The approach should be OSGi & OSGi-JavaEE!

Backing to 2012.7,  while I start to contribute Fighterfish(maybe you want to ask me why seclecting Fighterfish,  because I like both OSGi and JavaEE!),  the first thing to do is to check out Fighterfish's source and building it,  OK,  my story begins with here,

Noting: you can directly see the document[1] from the Oracle Glassfish Wiki:

[1] https://wikis.oracle.com/display/GlassFish/FighterFish+Development+Process

However,  if you think that contents of the above link have a litter long,  please continue to see the following

1.  check out fighterfish's source from trunk

prerequisite: needing the following tools

1) JDK 6 or JDK 7

2) SVN  Client Tool

Because my OS is WindowsXP, I use TortoiseSVN, a very gread tool.

To check out source from trunk, please using the following svn url:

svn checkout https://svn.java.net/svn/glassfish~svn/trunk/fighterfish

Noting: if you are behind in your corporation's proxy server, you should config your TortoiseSVN's network setting.

2.  Building the fighterfish trunk

Here, what I said "building the fighterfish trunk" means to build "fighterfish/module", because fighterfish/module implements the above nine jars(osgi-*.jar)  which are located in the "autostart" directory.

prerequisite: needing the following tools

1) Maven 3.0.4

You can use other versions of Maven such as maven 2.2.1, however, I use maven 3.0.4, a latest maven 3.x release.

2) (Optional)Current Glassfish v4 SnapShot

Why I said a Glassfish Distro is optional? Here has two reasons:

- if you tight wish Glassfish v4's development, for example, you find a OSGi-JavaEE's regression on current Glassfish v4 SnapShot, you should have a current Glassfish v4 SnapShot.

- if you maintance a Glassfish v3's release, or plan to investigate a OSGi-JavaEE's bug in Glassfish v3, you need not to have a current Glassfish v4 SnapShot.  Please remembering such a fact: the most of Fighterfish's modules are compatible with Glassfish v3 and v4 except for the osgi-ee-resources, that is to say, the most of Fighterfish's modules do not depend on Glassfish v4's API.

3) config maven's setting.xml

For me (a glassfish outside contributor), I will config my maven's setting.xml and add the following:

  <mirror>
  <id>maven-central</id>
  <url>http://repo1.maven.org/maven2/</url>
  <mirrorOf>*,!eclipselink.repository</mirrorOf>
  </mirror>

The mirror also applies in Glassfish Main's building. If you come from Oracle itself, you'd better do liking [1].

To build the fighterfish's module, please execute the following command from your shell:

> set MAVEN_OPTS = -Xmx512m -XX:MaxPermSize=256m

> mvn -DskipTests=true clean install

Note: you must set MAVEN_OPTS and if you do not set the env varible, you can get an out of memory exception while executing maven building.

OK,  about  "testing and looking fighterfish modules in depth", I will put the next part.

Refrence:

1. GF-OSGi-Features

2. FighterFish Development Process

Published at DZone with permission of its author, Tang Yong.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)