Note: This FAQ is under construction.
If one of your question is not answered here, just send it at
<[email protected]>
and we'll update the FAQ.
A.1. Running ProActive | |
A.1.1. | How do I build ProActive from the distribution? |
ProActive uses
Ant for its build.
Assuming that the environment variable
If you want only to compile only parts of ProActive,
you should try /home/bob/ProActive/compile/$ build Buildfile: ./proactive.xml Main targets: all Compile All and build the docs clean Remove all generated files compile build the class files core Compile the ProActive core classes dist Create the distribution binary docs Construct the javadoc and the manual examples Compile all the examples ibis Everything related to ProActive IBIS ic2d Compile the IC2D Tool javadoc Use javadoc to build information on the ProActive classes manual Build all the different manual version: html, pdf... manualHtml Make only the html files in the manual manualPdf Make only the pdf files in the manual rewrite Rewrite classes to enhance performance with ibis runBench Run benchmarks runTests Run all non regression tests runTestsLocal Run all non regression tests on the current host only Default target: compile | |
A.1.2. | Why don't the examples and compilation work under Windows? |
It happens quite often, that the default installation directory under Windows is under Program Files which contains space. Then setting the JAVA_HOME environment variable to the install directory, might be a problem for bat files(all windows examples, and compilation are ran with bat files). To get rid of those problems, the best thing is to install jdk in a directory whose name does not contain spaces such as C:\java\j2sdk.... or D:\java\j2sdk... and then to set the JAVA_HOME environment variable accordingly: set JAVA_HOME=C:\java\j2sdk... Another solution is to do a copy paste of the command defined in the bat file in the DOS window. | |
A.1.3. | Why do I get a Permission denied when trying to launch examples scripts under Linux? |
According to the tool used to unpackage the ProActive distribution, permissions of newly created files can be based on default UMASK permissions. If you get a permission denied, just run the command: chmod 755 *.sh in the ProActive/scripts/unix directory in order to change the permissions. | |
A.2. General Concepts | |
A.2.1. | How does the node creation happen? |
An active object is always attached to a node. A node
represents a logical entity deployed onto one JVM. When creating a
new active object you have to provide a URL or a reference to a
node. That node has to exist at the moment you create the active
object. It has to be launched on a local or on a remote JVM. In
order to be accessible from any remote JVM, a node automatically
registers itself in the local RMI Registry on the local machine.
Getting a reference to a remote node ends up doing a lookup into a
RMI registry. The class In order to start a node you can use the script
It is nevertheless possible to create an object on a remote node once it is created. On host X you can use startNode to start a new node startNode.sh ///node1 On host Y you can create an active object on host X org.objectweb.proactive.core.node.Node n = org.objectweb.proactive.core.n\ ode.NodeFactory.getNode('//X/node1'); ProActive.turnActive(myObject, n); You do not need to start any rmiregistry manually as they are started automatically as needed. As we support other ways of registration and discovery (such
as Jini), getting a node can be protocol dependant. For instance,
the url of a node When an active object is created locally without specifying a node, it is automatically attached to a default node. The default node is created automatically by ProActive on the local JVM when a first active object is created without a given node. The name of the default node is generated based on a random number. | |
A.2.2. | How does the RMI Registry creation happen? |
ProActive relies on the RMI Registry for registering and discovering nodes. For this reason, the existence of a RMI Registry is necessary for ProActive to be used. In order to simplify the deployment of ProActive applications, we have included the creation of the RMI Registry with the creation of nodes. Therefore, if no RMI Registry exists on the local machine, ProActive will automatically create one. If one exists, ProActive will automatically use it. | |
A.2.3. | What is the class server, why do we need it? |
In the RMI model, a class server is a HTTP Server able to
answer simple HTTP requests for getting class files. It is needed in
the case an object being sent to a remote location where the class
the object belongs to is unknown. In such case, if the property
Because ProActive makes use of on-the-fly, in memory, generated classes (the stubs), a class server is necessary for each JVM using active objects. For this reason, ProActive starts automatically one small class server per JVM. The launching and the use of this class server is transparent to you. | |
A.2.4. | What is a reifiable object? |
An object is said to be reifiable if it meets certain criterias in order to become an Active Object:
| |
A.2.5. | What is the body of an active object? What are its local and remote representations? |
When created, an active object is associated with a Body that is the entity managing all the non functional properties of the active object. The body contains the request queue receiving all reified method calls to the reified object (the object from which the active object has been created). It is responsible for storing pending requests and serving them according to a given synchronization policy, which default behavior is FIFO. The body of the active object should be the only object able to access directly the reified object. All other objects accessing the active object do so through the stub-proxy couple that eventually sends a request to the body. The body owns its own thread that represent the activity of the active object. The body has two representations. One is local and given by
the interface Body (see code in Body.java). This is the
local view of the body an object can have when being in the same JVM
as the body. For instance, the implementation of the activity of an
object done through the method | |
A.2.6. | What is a ProActive stub? |
When you create an active object from a regular object, you
get in return a reference on an automatically generated
ProActive stub.
ProActive uses
ASM to generate the stub on
the fly. Suppose you have a class A a = new A(); A activeA = (A) ProActive.turnActive(a); In the code above, the variable The reified object can be indifferently in the same virtual machine as the active reference or in another one. | |
A.2.7. | Are the call to an Active Object always asynchronous? |
No. Calls to an Active Object methods are asynchronous under some conditions. This is explained in Section 13.8, “Asynchronous calls and futures”. If for instance the return type of a method call is not reifiable, you can use wrappers to keep asynchronism capabilities: suppose that one of your object has a method int getNumber() calling this method with ProActive is sychronous since the 'int'
type is not reifiable. To keep the asynchronism it is advised to
use the classes given in the
IntWrapper getNumber() Then calling this new | |
A.3. Exceptions | |
A.3.1. | Why do I get an exception java.lang.NoClassDefFoundError about asm? |
ProActive uses ASM for the on the fly
generation of stub classes. The library Exception in thread 'main' java.lang.NoClassDefFoundError: org/objectweb/asm/Constants at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:509) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:246) at java.net.URLClassLoader.access$100(URLClassLoader.java:54) at java.net.URLClassLoader$1.run(URLClassLoader.java:193) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:186) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) at java.lang.ClassLoader.loadClass(ClassLoader.java:262) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322) at org.objectweb.proactive.core.mop.MOP.<clinit>(MOP.java:88) at org.objectweb.proactive.ProActive.createStubObject(ProActive.java:836) at org.objectweb.proactive.ProActive.createStubObject(ProActive.java:830) at org.objectweb.proactive.ProActive.newActive(ProActive.java:255) at org.objectweb.proactive.ProActive.newActive(ProActive.java:180) at org.objectweb.proactive.examples.binarytree.TreeApplet.main(TreeApplet.java:103) The problem can simply be fixed by adding asm | |
A.3.2. | Why do I get an exception java.lang.NoClassDefFoundError about bcel? |
ProActive uses BCEL for the on the
fly generation of stub classes. The library
Exception in thread 'main' java.lang.NoClassDefFoundError: org/apache/bcel/generic/Type at org.objectweb.proactive.core.mop.MOPClassLoader.loadClass(MOPClassLoader.java:129) at org.objectweb.proactive.core.mop.MOPClassLoader.loadClass(MOPClassLoader.java:109) at org.objectweb.proactive.core.mop.MOP.createStubClass(MOP.java:341) at org.objectweb.proactive.core.mop.MOP.findStubConstructor(MOP.java:376) at org.objectweb.proactive.core.mop.MOP.createStubObject(MOP.java:443) at org.objectweb.proactive.core.mop.MOP.newInstance(MOP.java:165) at org.objectweb.proactive.core.mop.MOP.newInstance(MOP.java:137) at org.objectweb.proactive.ProActive.createStubObject(ProActive.java:590) at org.objectweb.proactive.ProActive.createStubObject(ProActive.java:585) at org.objectweb.proactive.ProActive.newActive(ProActive.java:170) at org.objectweb.proactive.ProActive.newActive(ProActive.java:137) at DiscoveryManager.main(DiscoveryManager.java:226) The problem can simply be fixed by adding
| |
A.3.3. | Why do I get an exception java.security.AccessControlException access denied? |
If you don't properly set permissions when launching code using ProActive you may get the following exception or a similar one. java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:542) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044) at java.net.Socket.connect(Socket.java:419) at java.net.Socket.connect(Socket.java:375) at java.net.Socket.<init>(Socket.java:290) at java.net.Socket.<init>(Socket.java:118) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:122) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171) at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at org.objectweb.proactive.core.rmi.RegistryHelper.detectRegistry(RegistryHelper.java:101) at org.objectweb.proactive.core.rmi.RegistryHelper.getOrCreateRegistry(RegistryHelper.java:114) at org.objectweb.proactive.core.rmi.RegistryHelper.initializeRegistry(RegistryHelper.java:77) at org.objectweb.proactive.core.node.rmi.RemoteNodeFactory(RemoteNodeFactory.java:56) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:296) at java.lang.Class.newInstance(Class.java:249) at org.objectweb.proactive.core.node.NodeFactory.createNodeFactory(NodeFactory.java:281) at org.objectweb.proactive.core.node.NodeFactory.createNodeFactory(NodeFactory.java:298) at org.objectweb.proactive.core.node.NodeFactory.getFactory(NodeFactory.java:308) at org.objectweb.proactive.core.node.NodeFactory.createNode(NodeFactory.java:179) at org.objectweb.proactive.core.node.NodeFactory.createNode(NodeFactory.java:158) ... ProActive uses
RMI as its
underlying transport technology. Moreover it uses code downloading
features to automatically move generated stub classes from one JVM
to another one. For those reasons, ProActive needs to install a
See Permissions in the JavaTM 2 SDK to learn more about Java permissions. As a first approximation, in order to run your code, you can create a simple policy file granting all permissions for all code: grant { permission java.security.AllPermission; }; Then you need to start your Java program using the property
java -Djava.security.policy=my.policy.file MyMainClass | |
A.3.4. | Why do I get an exception when using Jini? |
In order to get Jini working properly in ProActive, you have to put in your HOME directory a copy of proactive.java.policy located in ProActive/scripts/unix or windows. Indeed the rmid deamon needs this file to start. If you try to use Jini without this policy file, it will not work. Moreover, if you did it once, make sure that there is no file called machine_namejiniLockFile in your working directory. This file is usefull to avoid many Service Lookup to be created by concurrent threads. This file is removed automatically when a Lookup Service is created. If the application failed(for instance because of the policy file) it is possible that this file remains in the directory, in that case if you restart the application it will not work. So checkout if this file is present in your working directory, if so remove it and restart the application | |
A.3.5. | Why do I get a java.rmi.ConnectException: Connection refused to host: 127.0.0.1 ? |
Sometimes, the hosts files ( -Dsun.net.spi.nameservice.provider.1=dns,sun"This tells java not to look at the hosts file, but rather to ask the DNS for network information. | |
A.4. Writing ProActive-oriented code | |
A.4.1. | Why aren't my object's properties updated? |
Suppose you have a class public class A { public int a1; public static void main(String[] args) { A a = new A(); A activeA = (A) ProActive.turnActive(a); a.a1 = 2; // set the attribute a1 of the instance pointed by a to 2 activeA.a1 = 2; // !!! set the attribute a1 of the stub instance to 2 } } When you reference an active object, you always reference it through its associated stub (see Section 13.7, “Advanced: Role of the elements of an active object” for the definition of Stub). The stub class inheriting from the reified class, it has also all its attributes. But those attributes are totally useless as the only role of the generated stub is to reify every public methods call into a request passed to the associated proxy. Therefore accessing directly the attributes of an active object through its active reference would result in accessing the attributes of the generated stub. This is certainly not the behavior one would expect. The solution to this problem is very simple: active object properties should only be accessed through a public method. Otherwise, you're accessing the local Stub's properties. | |
A.4.2. | How can I pass a reference on an active object or the difference between this and ProActive.getStubOnThis()? |
Suppose you have a class public class A { public A getRef() { return this; // !!!! THIS IS WRONG FOR AN ACTIVE OBJECT } } There is indeed a problem in the code above. If an instance of
The solution, if you want to pass a link to the active object
from the code of the reified object, is to use the method
public class A { public A getRef() { return ProActive.getStubOnThis(); // returns a reference on the stub } } | |
A.4.3. | How can I create an active object? |
To create an active object you invoke one of the methods
Here is a simple example creating an active object of class
public class A { private int i; private String s; public A() {} public A(int i, String s) { this.i = i; this.s = s; } } // instance based creation A a; Object[] params = new Object[] { new Integer (26), 'astring' }; try { a = (A) ProActive.newActive(A.class.getName(), params); } catch (ActiveObjectCreationException e) { // creation of ActiveObject failed e.printStackTrace(); } // object based creation A a = new A(26, 'astring'); try { a = (A) ProActive.turnActive(a); } catch (ActiveObjectCreationException e) { // creation of ActiveObject failed e.printStackTrace(); } | |
A.4.4. | What are the differences between instantiation based and object based active objects creation? |
In ProActive there are two
ways to create active objects. One way is to use
When using instantiation based creation, any argument passed
to the constructor of the reified object through
When using object based creation, you create the object that
is going to be reified as an active object before hand. Therefore
there is no serialization involved when you create the object. When
you invoke | |
A.4.5. | Why do I have to write a no-args constructor? |
ProActive automatically creates a stub/skeleton pair for your active objects. When the stub is instancied on the remote node, its constructor ascends the ancestors chain, thus calling its parent constructor [the active object]. So if you place initialization stuff in your no args constructor, it will be executed on the stub, which can lead to disastrous results! | |
A.4.6. | |
As explained in Section 13.3, “Specifying the activity of an active object”, there are two ways to define the activity of your active object
Implementing the interfaces directly in the class used to create the active object This is the easiest solution when you do control the class
that you make active. Depending on which phase in the life of the
active object you want to customize, you implement the corresponding
interface (one or more) amongst import org.objectweb.proactive.*; public class A implements InitActive, RunActive { private String myName; public String getName() { return myName; } // -- implements InitActive public void initActivity(Body body) { myName = body.getName(); } // -- implements RunActive for serving request in a LIFO fashion public void runActivity(Body body) { Service service = new Service(Body); while (body.isActive()) { service.blockingServeYoungest(); } } public static void main(String[] args) throws Exception { A a = (A) ProActive.newActive(A.class.getName,null); System.out.println('Name = '+a.getName()); } } Passing an object implementing the interfaces when creating the active object This is the solution to use when you do not control the class
that you make active or when you want to write generic activities
policy and reused them with several active objects. Depending on
which phase in the life of the active object you want to customize,
you implement the corresponding interface (one or more) amongst
Compared to the solution above where interfaces are directly implemented in the reified class, there is one restriction here: you cannot access the internal state of the reified object. Using an external object should therefore be used when the implementation of the activity is generic enough not to have to access the member variables of the reified object. import org.objectweb.proactive.*; public class LIFOActivity implements RunActive { // -- implements RunActive for serving request in a LIFO fashion public void runActivity(Body body) { Service service = new Service(Body); while (body.isActive()) { service.blockingServeYoungest(); } } } import org.objectweb.proactive.*; public class A implements InitActive { private String myName; public String getName() { return myName; } // -- implements InitActive public void initActivity(Body body) { myName = body.getName(); } public static void main(String[] args) throws Exception { // newActive(classname, constructor parameter (null = none), // node (null = local), active, MetaObjectFactory (null = d\ efault) A a = (A) ProActive.newActive(A.class.getName(), null, null, new LIFO\ Activity(), null); System.out.println('Name = '+a.getName()); } } | |
A.4.7. | What happened to the former live() method and Active interface? |
The former Up to ProActive 0.9.3 the
activity of an active object was given by a method
In order to convert the code of an active object containing a
method
| |
A.4.8. | Why should I avoid to return null in methods body? |
On the caller side the test if(result_from_method == null) has no sense. Indeed result_from_method is a couple Stub-FutureProxy as explained above, so even if the method returns null, result_from_method cannot be null: public class MyObject{ public MyObject(){ //empty constructor with no-args } public Object getObject{ if(.....) { return new Object(); } else { return null; --> to avoid in ProActive } } } On the caller side: MyObject o = new MyObject(); Object result_from_method = o.getObject(); if(result_from_method == null){ ...... } This test is never true, indeed, result_from_method is Stub-->Proxy-->null if the future is not yet available or the method returns null or Stub-->Proxy-->Object if the future is available, but result_from_method is never null. See Documentation on Futures in Section 13.8.3, “Important Notes: Errors to avoid” for more documentation about common errors to avoid. | |
A.4.9. | How can I use Jini in ProActive? |
In order to use Jini in ProActive you have to configure properly the deployment descriptor. All informations on how to configure XML deployment descriptor are provided in Chapter 21, XML Deployment Descriptors. | |
A.4.10. | How do I make a Component version out of an Active Object version? |
There is such an example, in the examples/components/c3d directory. The code for c3d is adapted to use components. There are several steps to cover:
| |
A.4.11. | How can I use Jini in ProActive? |
In order to use Jini in ProActive you have to configure properly the deployment descriptor. All informations on how to configure XML deployment descriptor are provided in Chapter 21, XML Deployment Descriptors. | |
A.4.12. | Why is my call not asynchronous? |
ProActive allows to have asynchronous code, in the following cases:
More explanations can be found in Section 13.8, “Asynchronous calls and futures”. | |
A.5. Deployment Descriptors | |
A.5.1. | What is the difference between passing parameters in Deployment Descriptor and setting properties in ProActive Configuration file? |
Parameters defined in Deployment Descriptor should be only jvm related, whereas properties set in the Configuration file are ProActive properties or user-defined properties. They are used with a different approach: parameters given in descriptors are part of the java command that will create other jvms, whereas properties will be loaded once jvms are created | |
A.5.2. | Why do I get the following message when parsing my xml deployment file: ERROR: file:~/ProActive/descriptor.xml Line:2 Message:cvc-elt.1: Cannot find the declaration of element 'ProActiveDescriptor' |
This message turns up because the Schema cannot be found. Indeed at the beginning of our XML deployment files we put the line <ProActiveDescriptor xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='DescriptorSchema.xsd'> which means, the schema named DescriptorSchema.xsd is expected to be found in the current directory to validate the xml. Be sure you have this file in the same dir than your file, or just change the path to point to the correct schema. |
© 2001-2007 INRIA Sophia Antipolis All Rights Reserved