Installation Instructions for JavaGroups 2.0.1
JavaGroups comes in a binary and a source version: the binary version
is JavaGroups-2.x.x.bin.zip, the source version is JavaGroups-2.x.x.src.zip
. The binary version contains the JavaGroups JAR file, plus the Xerces parser
which is needed by JavaGroups. The source version contains all source files,
plus several JAR files needed by JavaGroups, e.g. ANT to build JavaGroups
from the sources.
Requirements
- JavaGroups 2.0.2 requires JDK 1.3 (or higher). There is no JNI
code present so it should run on all platforms. JDK 1.4 is fine too.
- An XML parser is required for configuration of JavaGroups if
you want the ability to use XML configuration files for class mapping, and
to read protocol stack specifications in XML format. Not using an XML
parser will result in slower serialization and limit you to use only plain
protocol stack configuration strings.
Note that there is an XML parser shipped with JavaGroups in the lib
directory. Add the JAR files xercesimpl-2.1.0.jar and xercesxmlapi-2.1.0.jar
to your CLASSPATH. Note that any other JAXP compliant XML parser can
be used.
- If you want to generate HTML-based test reports from the unittests,
then xalan.jar needs to be in the CLASSPATH (also available in the lib directory)
Installing the binary distribution
The binary version contains
- javagroups-all.jar: the JavaGroups library including the demos
- CREDITS: list of contributors
- INSTALL.html: this file
- xercesimpl-2.1.0.jar: the Xerces parser implementation (see http://xml.apache.org )
- xercesxmlapi-2.1.0.jar: the Xerces parser APIs
- jms.jar: JMS library
Place the JAR files somewhere in your CLASSPATH, and you're ready
to start using JavaGroups. If you already have Xerces installed, or if
you have another XML parser, the Xerces JARs can be omitted.
If you want to use the JavaGroups JMS protocol (org.javagroups.protocols.JMS),
then you will also need to place jms.jar somewhere in your CLASSPATH.
Installing the source distribution
The source version consists of the following directories:
- conf: configuration files needed by JavaGroups, plus default protocol
stack definitions
- doc: documentation
- lib: various JARs needed to build and run JavaGroups:
- Ant JARs: used
to build JavaGroups. If you already have Ant installed, you won't need these
files
- jms.jar: JMS library. Needed if you intend to run the org.javagroups.protocols.JMS
protocol
- junit.jar: to run the JUnit
test cases
- xalan.jar : to format the
output of the JUnit tests using an XSLT converter to HTML
- xercesimpl-2.1.0.jar: the Xerces parser implementation (see http://xml.apache.org )
- xercesxmlapi-2.1.0.jar: the Xerces parser APIs
Building JavaGroups with the ANT build system (source distribution only)
- Unzip the source distribution, e.g. unzip JavaGroups-2.0.2.src.zip.
This will create the JavaGroups-2.0.2 directory (root directory) under
the current directory.
- cd to the root directory
- Modify build.properties if you want to use a Java compiler other than
javac (e.g. jikes)
- On UNIX systems use build.sh, on Windows build.bat:
$> ./build.sh compile
- This will compile all Java files (into the classes
directory). Note that if you want to compile all JDK 1.4-only classes use
./build.sh compile-1.4 instead.
- To generate the JARs: $> ./build.sh jar
- This will generate the following JAR files in the dist
directory:
- javagroups-core.jar - the core javagroups libraries
- javagroups-all.jar - the complete javagroups libraries
including demos and unit tests
- javagroups-test.jar - the javagroups test libraries
- javagroups-demo.jar - the javagroups demo libraries
- The CLASSPATH now has to be set accordingly: the following
directories and/or JARs have to be included:
- <JavaGroups rootdir>/classes
- <JavaGroups rootdir>/conf
- All needed JAR files in <JavaGroups rootdir>/lib.
To simple run JavaGroups, the Xerces JARs are sufficient. To build from
sources, the two Ant JARs are required. To run unit tests, the JUnit (and
possibly the Xalan) JARs are needed.
- To generate JavaDocs simple run $> ./build.sh javadoc
and the Javadoc documentation will be generated in the dist/javadoc
directory
- Note that - if you already have Ant installed on your system -
you do not need to use build.sh or build.bat, simply invoke ant on the
build.xml file. To be able to invoked ant from any directory below the
root directory, place ANT_ARGS="-find build.xml -emacs" into the
.antrc file in yourhome directory.
- For more details on Ant see http://jakarta.apache.org/ant/
.
Testing your Setup
To see whether your system can find the JavaGroups classes, execute
the following command:
java org.javagroups.Version
You should see the following output (more or less) if the class is
found:
Version: 2.0.2
CVS: $Id: INSTALL.html,v 1.14 2002/08/31 23:05:18 belaban Exp $
History: (see doc/history.txt for details)
Running a Demo Program
To test whether JavaGroups works okay on your machine, run
java org.javagroups.demos.Draw
twice. 2 whiteboard windows should appear. If you started them simultaneously,
they should initially show a membership of 1 in their title bars. After
some time, both windows should show 2. This means that the two instances
found each other and formed a group.
When drawing in one window, the second instance should also be updated.
As the default group transport uses IP multicast, make sure that - if you
want to start the 2 instances in different subnets - IP multicast is enabled.
If this is not the case, the 2 instances won't 'find' each other and the
sample won't work.
You can change the properties of the demo to for example use a different
transport if multicast doesn't work (it should always work on the same
machine). Please consult the documentation to see how to do this.
Using IP Multicasting without a network connection
Sometimes there isn't a network connection (e.g. DSL modem is down),
or we want to multicast only on the local machine. For this the loopback
interface (typically lo) can be configured, e.g.
route add -net 224.0.0.0 netmask 224.0.0.0 dev lo
This means that all traffic directed to the 224.0.0.0 network will
be sent to the loopback interface, which means it doesn't need any network
to be running. Note that the 224.0.0.0 network is a placeholder for all
multicast addresses in most UNIX implementations: it will catch all
multicast traffic. This is an undocumented feature of /sbin/route and may
not work across all UNIX flavors. The above instructions may also work for
Windows systems, but this hasn't been tested. Note that not all systems
allow multicast traffic to use the loopback interface.
Typical home networks have a gateway/firewall with 2 NICs: the first (eth0)
is connected to the outside world (Internet Service Provider), the second
(eth1) to the internal network, with the gateway firewalling/masquerading
traffic between the internal and external networks. If no route for multicast
traffic is added, the default will be to use the fdefault gateway, which
will typically direct the multicast traffic towards the ISP. To prevent
this (e.g. ISP drops multicast traffic, or latency is too high), we recommend
to add a route for multicast traffic which goes to the internal network (e.g.
eth1).
It doesn't work !
Make sure your machine is set up correctly for IP multicast. There
are 2 test programs that can be used to detect this: McastReceiverTest and
McastSenderTest. Start McastReceiverTest, e.g.
java org.javagroups.tests.McastReceiverTest -mcast_addr 224.10.10.10 -port 5555
Then start McastSenderTest:
java org.javagroups.tests.McastSenderTest -mcast_addr 224.10.10.10 -port 5555
You should be able to type in the McastSenderTest window and see the
output in the McastReceiverWindow. If not, try to use -ttl 32 in the sender.
If this still fails, consult a system administrator to help you setup IP
multicast correctly. If you are the system administrator, look for
another job :-)
Other means of getting help: there is a public forum on javagroups.sf.net for questions.
Also consider subscribing to the javagroups-users mailing list to discuss
such and other problems.
The instances still don't find each other !
In this case we have to use a sledgehammer (running only under JDK 1.4.
and higher): we can enable the above sender and receiver test to use all
available interfaces for sending and receiving. One of them will certainly
be the right one... Start the receiver as follows:
java org.javagroups.tests.McastReceiverTest1_4 -mcast_addr 228.8.8.8 -use_all_interfaces
The multicast receiver uses the 1.4 functionality to list all available
network interfaces and bind to all of them (including the loopback
interface). This means that whichever interface a packet comes in on, we
will receive it.
Now start the sender:
java org.javagroups.tests.McastSenderTest1_4 -mcast_addr 228.8.8.8 -use_all_interfaces
The sender will also determine the available network interfaces and send
each packet over all interfaces.
This test can be used to find out which network interface to bind to when
previously no packets were received. E.g. when you see the following output
in the receiver:
bash-2.03$ java org.javagroups.tests.McastReceiverTest1_4 -mcast_addr 228.8.8.8 -bind_addr 192.168.168.4
Socket=0.0.0.0/0.0.0.0:5555, bind interface=/192.168.168.4
dd [sender=192.168.168.4:5555]
dd [sender=192.168.168.1:5555]
dd [sender=192.168.168.2:5555]
you know that you can bind to any of the 192.168.168.{1,2,4} interfaces
to receive your multicast packets. In this case you would need to modify
your protocol spec to include bind_addr=192.168.168.2 in UDP, e.g. "UDP(mcast_addr=228.8.8.8;bind_addr=192.168.168.2):..."
.
Alternatively you can use McastDiscovery1_4 (runs only on JDK 1.4). Start
this program simultaneously on multiple machines. Binding to all available
interfaces, this program tries to discover what other members are available
in a network and determines which interfaces should be used by UDP. After
some time (e.g. 30 seconds), press <enter> on each program. The program
will then list the interfaces which can be used to bind to. There may be
one or multiple interfaces. When there are multiple interfaces listed, take
the one with the highest number of responses (at the top of the list). The
UDP protocol spec can then be changed to explicitly bind to that interface,
e.g.
"UDP(bind_addr=<interface>;...)"
I have discovered a bug !
If you think that you discovered a bug, submit a bug report on javagroups.sf.net or send email
to javagroups-developers if you're unsure about it. Please include the
following information:
- Version of JavaGroups (java org.javagroups.Version)
- Platform (e.g. Solaris 8)
- Version of JDK (e.g. JDK 1.3.1)
- Stack trace. Use kill -3 PID on UNIX systems or CTRL-BREAK on
windows machines
- Small program that reproduces the bug