Frequently Asked Questions

Note: This FAQ is under construction. If one of your question is not answered here, just send it at and we'll update the FAQ.

A.1. Frequently Asked Questions
A.1.1. How do I build ProActive from the distribution?
A.1.2. Why don't the examples and compilation work under Windows?
A.1.3. Why do I get a Permission denied when trying to launch examples scripts under Linux?
A.1.4. How does the node creation happen?
A.1.5. How does the RMI Registry creation happen?
A.1.6. What is the class server, why do we need it?
A.1.7. What is a reifiable object?
A.1.8. What is the body of an active object? What are its local and remote representations?
A.1.9. What is a ProActive stub?
A.1.10. Are the call to an Active Object always asynchronous?
A.1.11. Why do I get an exception java.lang.NoClassDefFoundError about asm?
A.1.12. Why do I get an exception java.lang.NoClassDefFoundError about bcel?
A.1.13. Why do I get an exception java.security.AccessControlException access denied?
A.1.14. Why do I get an exception when using Jini?
A.1.15. Why do I get a java.rmi.ConnectException: Connection refused to host: 127.0.0.1 ?
A.1.16. Why aren't my object's properties updated?
A.1.17. How can I pass a reference on an active object or the difference between this and PAActiveObject.getStubOnThis()?
A.1.18. How can I create an active object?
A.1.19. What are the differences between instantiation based and object based active objects creation?
A.1.20. Why do I have to write a no-args constructor?
A.1.21. How do I control the activity of an active object?
A.1.22. What happened to the former live() method and Active interface?
A.1.23. Why should I avoid to return null in methods body?
A.1.24. How can I use Jini in ProActive?
A.1.25. How do I make a Component version out of an Active Object version?
A.1.26. How can I use Jini in ProActive?
A.1.27. Why is my call not asynchronous?
A.1.28. What is the difference between passing parameters in Deployment Descriptor and setting properties in ProActive Configuration file?
A.1.29. 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'

A.1. Frequently Asked Questions

A.1.1.

How do I build ProActive from the distribution?

ProActive uses Ant for its build. Assuming that the environment variable JAVA_HOME is properly set to your Java distribution, just go into the compile directory and use the script:

  • on Windows: build.bat compile.all

  • on Unix systems: build compile.all

'compile.all' represents the target of the build. It will compile all sources files and generate the documentation. To compile only the source files, for example if you have modified the code, you should try

  • on Windows: build.bat compile.core

  • on Unix systems: build compile.core

If you want only to compile only parts of ProActive, you should try build, with no arguments. As of version v3.2, the result is:

/home/bob/ProActive/compile/$ build
Buildfile: build.xml

Main targets:
ProActive Documentation.docs               Construct the javadoc and the manual
ProActive Documentation.javadoc.complete   Make complete Javadoc
ProActive Documentation.javadoc.published  Make published Javadoc
ProActive Documentation.manual             Build all the different manual version: html, pdf...
ProActive Documentation.manualHtml         Make only the html files in the manual
ProActive Documentation.manualPdf          Make only the pdf files in the manual
ProActive Documentation.manualSingleHtml   Make only the big html file in the manual
all                                        build the class files and the documentation
clean                                      Remove all generated files
compile                                    Deprecated, see compile.all
compile.all                                Build class files (ProActive + Extensions + Extra + Examples + Utils + Tests)
compile.benchmarks                         Compile the benchmarks
compile.core                               Compile ProActive core classes
compile.examples                           Compile all examples classes
compile.extensions                         Compile ProActive Extensions classes
compile.extra                              Compile ProActive Extensions classes
compile.stubGenerator                      Compile Stub Generator Classes
compile.tests                              Compile functional and unit tests classes
compile.trywithcatch                       Compile ProActive Try With Catch classes
compile.util                               Compile ProActive Utils classes
copyright_format                           Update Copyright and Version in every text files and format them
core                                       Deprecated, see compile.core
deploy                                     Populate dist/ with all needed file
deploy.all                                 Populate dist/ (with ProActive_examples.jar)
deploy.examples                            Add examples.jar to the dist/ directory
docs                                       Construct the javadoc and the manual
examples                                   Deprecated, see compile.examples
extensions                                 Deprecated, see compile.extensions
extra                                      Deprecated, see compile.extra
format                                     hibernate's eclipse-based formatter
ibis                                       Everything related to ProActive IBIS
ic2d.libClean                              Clean all needed libraries to IC2D
ic2d.libCopy                               Copy all needed libraries to IC2D
ic2dLib                                    Deprecated, see ic2d.libCopy
ic2dLibClean                               Deprecated, see ic2d.libClean
javadoc.complete                           Make complete Javadoc
javadoc.published                          Make published Javadoc
jdepend                                    JDepend report
junit                                      Run all non regression tests on the current host only
junit.clover                               Same as junit but with code coverage enabled
junit.distributed                          Run all non regression tests
junit.emma                                 Same as junit but with code coverage enabled
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
manualSingleHtml                           Make only the big html file in the manual
microTimer                                 Deprecated, see compile.microTimer
proActiveJar                               Deprecated, see deploy
release                                    Source and Binary Releases
release.all                                Source and Binary Releases
release.bin                                Binary Release: dist + docs
release.src                                Source Release: sources + docs
runPerformanceTest                         Run performance test on the current host.
stubGenerator                              Deprecated, see compile.stubGenerator
update_copyright_and_version               Update Copyright and Version in every text files
uploadSchemas                              upload schemas on web site
Default target: compile.all
 

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.1.4.

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 NodeFactory provides a method getNode for doing that.

In order to start a node you can use the script startNode located in the scripts directory in the sub-directory windows or unix. At the moment, startNode can only start a node on the local machine. It is not possible to start a remote node using startNode. The reason is that starting a node on a remote host implies the use of protocol such as RSH, SSH or rLogin that are platform dependant and that cannot be easily abstracted from java. We are working on that area at the moment with the XML-based deployment descriptor that will allow the remote creation of nodes using various protocol.

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');
          PAActiveObject.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 jini://host.org/node won't be accessed the same way as rmi://host.org/node. The class NodeFactory is able to read the protocol and to use the right way to access the 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.1.5.

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.1.6.

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 java.rmi.server.codebase has been set properly to an existing class server, RMI will attempt to download the missing class files.

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.1.7.

What is a reifiable object?

An object is said to be reifiable if it meets certain criterias in order to become an Active Object:

  • The object is not of primitive type

  • The class of the object is not final

  • The object has a constructor with no arguments

A.1.8.

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

public interface Body extends LocalBodyStrategy, UniversalBody {

   /**
    * Returns whether the body is alive or not. The body is alive as long as it is processing
    * request and reply
     *
    * @return whether the body is alive or not.
    */
   public boolean isAlive();

   /**
    * Returns whether the body is active or not. The body is active as long as it has an associated
    * thread running to serve the requests by calling methods on the active object.
     *
    * @return whether the body is active or not.
    */
   public boolean isActive();

   /**
    * To avoid some causal ordering corruptions, the body can be temporarly set as
 <i>sterile</i>.
    * Then, it will not be able to send any request, except to himself and to its parent. Such
    * restriction should be necessary when sending multiple requests in parallel.
     *
    * @see org.objectweb.proactive.core.body.proxy.SendingQueue
    * @param isSteril
    * @param parentUID
    */
   public void setSterility(boolean isSterile, UniqueID parentUID);

   /**
    * Get the sterility status of the body
     *
    * @see org.objectweb.proactive.core.body.proxy.SendingQueue
    * @return the sterility status
    */
   public boolean isSterile();

   /**
    * Get the parent UniqueID of the body
     *
    * @see org.objectweb.proactive.core.body.proxy.SendingQueue
    * @return the parent UniqueID
    */
   public UniqueID getParentUID();

   /**
    * blocks all incoming communications. After this call, the body cannot receive any request or
    * reply.
    */
   public void blockCommunication();

   /**
    * Signals the body to accept all incoming communications. This call undo a previous call to
    * blockCommunication.
    */
   public void acceptCommunication();

   /**
    * Allows the calling thread to enter in the ThreadStore of this body.
    */
   public void enterInThreadStore();

   /**
    * Allows the calling thread to exit from the ThreadStore of this body.
    */
   public void exitFromThreadStore();

   /**
    * Tries to find a local version of the body of id uniqueID. If a local version is found it is
    * returned. If not, tries to find the body of id uniqueID in the known body of this body. If a
    * body is found it is returned, else null is returned.
     *
    * @param uniqueID
    *            the id of the body to lookup
    * @return the last known version of the body of id uniqueID or null if not known
    */
   public UniversalBody checkNewLocation(UniqueID uniqueID);

   /**
    * Returns the MBean associated to this active object.
     *
    * @return the MBean associated to this active object.
    */
   public BodyWrapperMBean getMBean();

   /**
    * Returns the body that is the target of this shortcut for this component interface
     *
    * @param functionalItfID
    *            the id of the interface on which the shortcut is available
    * @return the body that is the target of this shortcut for this interface
    */
   public UniversalBody getShortcutTargetBody(ItfID functionalItfID);

   // /**
   // * set the policy server of the active object
   // * @param server the policy server
   // */
   // public void setPolicyServer(PolicyServer server);

   /**
    * Set the nodeURL of this body
     *
    * @param newNodeURL
    *            the new URL of the node
    */
   public void updateNodeURL(String newNodeURL);

   /**
    * For setting an immediate service for this body. An immediate service is a method that will bw
    * excecuted by the calling thread.
    */
   public void setImmediateService(String methodName);

   /**
    * Removes an immediate service for this body An immediate service is a method that will bw
    * excecuted by the calling thread.
     *
    * @param methodName
    *            the name of the method
    * @param parametersTypes
    *            the types of the parameters of the method
    */
   public void removeImmediateService(String methodName);

   /**
    * Adds an immediate service for this body An immediate service is a method that will bw
    * excecuted by the calling thread.
     *
    * @param methodName
    *            the name of the method
    * @param parametersTypes
    *            the types of the parameters of the method
    */
   public void setImmediateService(String methodName, Class<?>[] parametersTypes);

   /**
    * Removes an immediate service for this body An immediate service is a method that will bw
    * excecuted by the calling thread.
     *
    * @param methodName
    *            the name of the method
    * @param parametersTypes
    *            the types of the parameters of the method
    */
   public void removeImmediateService(String methodName, Class<?>[] parametersTypes);

   /**
    * Sets the ForgetOnSend strategy when sending a request <i>methodName</i> to
 <i>activeObject</i>.
    * @param activeObject
    *              the destination
    * @param methodName
    *              the name of the method
    */
   public void setForgetOnSendRequest(Object activeObject, String methodName);

   /**
    * Remove the ForgetOnSend setting attached to the given <i>methodName</i> for the given
 <i>activeObject</i>
    * @param activeObject
    *              the destination
    * @param methodName
    *              the name of the method
    */
   public void removeForgetOnSendRequest(Object activeObject, String methodName);

   /**
    * Terminate the body. After this call the body is no more alive and no more active. The body is
    * unuseable after this call. If some automatic continuations are registred in the futurepool of
    * this body, the ACThread will be killed when the last registred AC is sent.
    */
   public void terminate();

   /**
    * @see terminate(). If completeACs is true, this call has the same behavior than terminate().
    *      Otherwise, the ACThread is killed even if some ACs remain in the futurepool.
    * @param completeACs
    *            if true, this call has the same behavior than terminate(). Otherwise, the ACThread
    *            is killed even if some ACs remain in the futurepool.
    */
   public void terminate(boolean completeACs);

   /**
    * Checks if a method methodName is declared by the reified object AND the method has the same
    * parameters as parametersTypes Note that the called method should be <i>public</i>,
 since
    * only the public methods can be called on an active object. Note also that a call to
    * checkMethod(methodName, null) is different to a call to checkMethod(methodName, new Class[0])
    * The former means that no checking is done on the parameters, whereas the latter means that we
    * look for a method with no parameters.
     *
    * @param methodName
    *            the name of the method
    * @param parametersTypes
    *            an array of parameter types
    * @return true if the method exists, false otherwise
    */
   public boolean checkMethod(String methodName, Class<?>[] parametersTypes);

   /**
    * Checks if a method methodName is declared by the reified object Note that the called method
    * should be <i>public</i>, since only the public methods can be called on an active
 object.
    * Note that this call is strictly equivalent to checkMethod(methodName, null);
     *
    * @param methodName
    *            the name of the method
    * @return true if the method exists, false otherwise
    */
   public boolean checkMethod(String methodName);

   public void registerIncomingFutures();
}

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 runActivity(Body) of the interface RunActive sees the body locally as it is instantiated by the body itself. The other representation, given by the interface UniversalBody is remote. It represents the view of the body a remote object can have and therefore the methods that can be invoked. That view is the one used by the proxy of a remote reference to the active object to send request to the body of the active object.

public interface UniversalBody extends Job, Serializable, SecurityEntity {
   public static Logger bodyLogger = ProActiveLogger.getLogger(Loggers.BODY);
   public static Logger sendReplyExceptionsLogger =
 ProActiveLogger.getLogger(Loggers.EXCEPTIONS_SEND_REPLY);

   /**
    * Receives a request for later processing. The call to this method is non blocking
    * unless the body cannot temporary receive the request.
    * @param request the request to process
    * @exception java.io.IOException if the request cannot be accepted
    * @return value for fault-tolerance protocol
    */
   public int receiveRequest(Request request) throws java.io.IOException,
 RenegotiateSessionException;

   /**
    * Receives a reply in response to a former request.
    * @param r the reply received
    * @exception java.io.IOException if the reply cannot be accepted
    * @return value for fault-tolerance procotol
    */
   public int receiveReply(Reply r) throws java.io.IOException;

   /**
    * Returns the url of the node this body is associated to
    * The url of the node can change if the active object migrates
    * @return the url of the node this body is associated to
    */
   public String getNodeURL();

   /**
    * Returns the UniqueID of this body
    * This identifier is unique accross all JVMs
    * @return the UniqueID of this body
    */
   public UniqueID getID();

   /**
    * Signals to this body that the body identified by id is now to a new
    * remote location. The body given in parameter is a new stub pointing
    * to this new location. This call is a way for a body to signal to his
    * peer that it has migrated to a new location
    * @param id the id of the body
    * @param body the stub to the new location
    * @exception java.io.IOException if a pb occurs during this method call
    */
   public void updateLocation(UniqueID id, UniversalBody body) throws java.io.IOException;

   /**
    * similar to the {@link UniversalBody#updateLocation(org.objectweb.proactive.core.UniqueID,
 UniversalBody)} method,
    * it allows direct communication to the target of a functional call, accross membranes of
 composite components.
    * @param shortcut the shortcut to create
    * @exception java.io.IOException if a pb occurs during this method call
    */
   public void createShortcut(Shortcut shortcut) throws java.io.IOException;

   /**
    * Returns the remote friendly version of this body
    * @return the remote friendly version of this body
    */
   public UniversalBody getRemoteAdapter();

   /**
    * Returns the name of the class of the reified object
    * @return the name of the class of the reified object
    */
   public String getReifiedClassName();

   /**
    * Enables automatic continuation mechanism for this body
    * @exception java.io.IOException if a pb occurs during this method call
    */
   public void enableAC() throws java.io.IOException;

   /**
    * Disables automatic continuation mechanism for this body
    * @exception java.io.IOException if a pb occurs during this method call
    */
   public void disableAC() throws java.io.IOException;

   // FAULT TOLERANCE

   /**
    * For sending a non fonctional message to the FTManager linked to this object.
    * @param ev the message to send
    * @return depends on the message meaning
    * @exception java.io.IOException if a pb occurs during this method call
    */
   public Object receiveFTMessage(FTMessage ev) throws IOException;

   /**
    * The DGC broadcasting method, called every GarbageCollector.TTB between
    * referenced active objects. The GC{Message,Response} may actually be
    * composed of many GCSimple{Message,Response}.
    *
    * @param toSend the message
    * @return its associated response
    * @throws IOException if a pb occurs during this method call
    */
   public GCResponse receiveGCMessage(GCMessage toSend) throws IOException;

   /**
    * Inform the DGC that an active object is pinned somewhere so cannot
    * be garbage collected until being unregistered.
    * @param registered true for a registration, false for an unregistration
    * @throws IOException if a pb occurs during this method call
    */
   public void setRegistered(boolean registered) throws IOException;

   /**
    * Allow to specify an url where to register the active object.
    * @param url the url where to bind the active object
    * @throws IOException
    * @throws UnknownProtocolException thrown if the protocol is not supported by
    * the current active object
    */
   public void register(String url) throws IOException, UnknownProtocolException;
}

A.1.9.

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 and an instance a of this class. A way to turn the instance a into an active object is to use the method PAActiveObject.turnActive:

    A a = new A();
          A activeA = (A) PAActiveObject.turnActive(a);

In the code above, the variable a is a direct reference onto the instance of A stored somewhere in memory. In contrast, the variable activeA is a direct reference onto an instance of the generated ProActive stub for the class A. By convention, the ProActive stub of a class A is a class generated in memory by ProActive that inherit from A and that is stored in the package pa.stub as pa.stub.Stub_A. The ProActive stub of a class redefines all public methods to reify them through a generic proxy. The proxy changes all method calls into requests that are sent to the body associated to the reified object (the object pointed by a in our example).

The reified object can be indifferently in the same virtual machine as the active reference or in another one.

A.1.10.

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 9.7, “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 org.objectweb.proactive.core.util.wrapper package, or to create your own wrapper based on these examples. In the case highlighted above, you should use

 IntWrapper getNumber() 

Then calling this new getNumber() method is asynchronous. Remember that only the methods return type are concerned, not the parameters.

A.1.11.

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 asm.jar, provided in the directory lib of ProActive is needed in order for any active object to function properly. If the library is not in the CLASSPATH you will get the following exception or a similar one:

    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.MOP.createStubObject(MOP.java:836)
        at org.objectweb.proactive.MOP.createStubObject(MOP.java:830)
        at org.objectweb.proactive.PAActiveObject.newActive(PAActiveObject.java:255)
        at org.objectweb.proactive.PAActiveObject.newActive(PAActiveObject.java:180)
        at org.objectweb.proactive.examples.binarytree.TreeApplet.main(TreeApplet.java:103)

The problem can simply be fixed by adding asm.jar in the CLASSPATH.

A.1.12.

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 bcel.jar, provided in the directory lib of ProActive is needed in order for any active object to function properly. If the library if not in the CLASSPATH you will get the following exception or a similar one:

    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.MOP.createStubObject(MOP.java:590)
         at org.objectweb.proactive.MOP.createStubObject(MOP.java:585)
         at org.objectweb.proactive.PAActiveObject.newActive(PAActiveObject.java:170)
         at org.objectweb.proactive.PAActiveObject.newActive(PAActiveObject.java:137)
         at DiscoveryManager.main(DiscoveryManager.java:226)

The problem can simply be fixed by adding bcel.jar in the CLASSPATH.

A.1.13.

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 SecurityManager that controls the execution of the Java code based on a set of permissions given to the JVM. Without explicit permissions nothing is granted for the code running outside java.* or sun.* packages.

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 -Djava.security.policy. For instance:

 java -Djava.security.policy=my.policy.file MyMainClass 

A.1.14.

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.1.15.

Why do I get a java.rmi.ConnectException: Connection refused to host: 127.0.0.1 ?

Sometimes, the hosts files (/etc/hosts for UNIX) contains 127.0.0.1 along with the name of the machine. This is an issue for ProActive and JAVA network connections in general. To circumvent the problem, start your programs with the command line argument

-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.1.16.

Why aren't my object's properties updated?

Suppose you have a class A with an attribute a1 as the example below.

    public class A {
           public int a1;
           public static void main(String[] args) {
           A a = new A();
           A activeA = (A) PAActiveObject.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 9.6, “ Elements of an active object and futures ” 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.1.17.

How can I pass a reference on an active object or the difference between this and PAActiveObject.getStubOnThis()?

Suppose you have a class A that you want to make active. In A you want to have a method that returns a reference on that instance of A as the example below.

  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 A is created as, or turned into an active object, the method getRef will in fact be called through the Body of the active object by its active thread. The value returned by the method will be the direct reference on the reified object and not a reference on the active object. If the call is issued from another JVM, the value will be passed by copy and the result (assuming A is serializable) will be a deep copy of A with no links to the active object.

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 PAActiveObject.getStubOnThis(). This method will return the reference to the stub associated to the active object whose thread is calling the method. The correct version of the previous class is:

  public class A {
   public A getRef() {
   return PAActiveObject.getStubOnThis(); // returns a reference on the stub
   }
   }

A.1.18.

How can I create an active object?

To create an active object you invoke one of the methods newActive or turnActive of the ProActive class. PAActiveObject.newActive creates an active object based on the instantiation of a new object, PAActiveObject.turnActive creates an active object based on an existing object. The different versions of the same newActive or turnActive methods allow you to specify where to create the active object (which node) and to customize its activity or its body (see questions below).

Here is a simple example creating an active object of class A in the local JVM. If the invocation of the constructor of class A throws an exception, it is placed inside an exception of type ActiveObjectCreationException. When the call to newActive returns, the active object has been created and its active thread is started.

  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) PAActiveObject.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) PAActiveObject.turnActive(a);
   } catch (ActiveObjectCreationException e) {
   // creation of ActiveObject failed
   e.printStackTrace();
   }

A.1.19.

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 PAActiveObject.newActive and is based on the instantiation of a new object, the other is to use PAActiveObject.turnActive and is based on the use of an existing object.

When using instantiation based creation, any argument passed to the constructor of the reified object through PAActiveObject.newActive is serialized and passed by copy to the object. This is because the model behind ProActive is uniform whether the active object is instantiated locally or remotely. The parameters are therefore guaranteed to be passed by copy to the constructor. When using PAActiveObject.newActive you must make sure that the arguments of the constructor are Serializable. On the other hand, the class used to create the active object does not need to beSerializable even in the case the active object is created remotly.

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 PAActiveObject.turnActive on the object two cases are possible. If you create the active object locally (on a local node), it will not be serialized. If you create the active object remotely (on a remote node), the reified object will be serialized. Therefore, if the turnActive is done on a remote node, the class used to create the active object this way has to beSerializable. In addition, when using turnActive, care must be taken that no other references to the originating object are kept by other objects after the call to turnActive. A direct call to a method of the originating object without passing by a ProActive stub on this object will break the model.

A.1.20.

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.1.21.

How do I control the activity of an active object?

As explained in Section 9.5.4, “Using A Custom Activity”, there are two ways to define the activity of your active object

  • Implementing one or more of the sub-interfaces of Active directly in the class used to create the active object

  • Passing an object implementing one or more of the sub-interfaces of Active in parameter to the method newActive or turnActive

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 InitActive, RunActive and EndActive. Here is an example that has a custom initialization and activity.

  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) PAActiveObject.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 InitActive, RunActive and EndActive. Here an example that has a custom activity.

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) PAActiveObject.newActive(A.class.getName(), null, null, new LIFO\
         Activity(), null);
         System.out.println('Name = '+a.getName());
         }
         }

A.1.22.

What happened to the former live() method and Active interface?

The former Active interface was simply a marker interface allowing to change the body and/or the proxy of an active object. It was of no use most of the time and was made obsolete with the introduction of the MetaObjectFactory in the 0.9.3 release.

public interface MetaObjectFactory {

   /**
    * Creates or reuses a RequestFactory
    * @return a new or existing RequestFactory
    * @see RequestFactory
    */
   public RequestFactory newRequestFactory();

   /**
    * Creates or reuses a ReplyReceiverFactory
    * @return a new or existing ReplyReceiverFactory
    * @see ReplyReceiverFactory
    */
   public ReplyReceiverFactory newReplyReceiverFactory();

   /**
    * Creates or reuses a RequestReceiverFactory
    * @return a new or existing RequestReceiverFactory
    * @see RequestReceiverFactory
    */
   public RequestReceiverFactory newRequestReceiverFactory();

   /**
    * Creates or reuses a RequestQueueFactory
    * @return a new or existing RequestQueueFactory
    * @see RequestQueueFactory
    */
   public RequestQueueFactory newRequestQueueFactory();

   /**
    * Creates or reuses a MigrationManagerFactory
    * @return a new or existing MigrationManagerFactory
    * @see MigrationManagerFactory
    */
   public MigrationManagerFactory newMigrationManagerFactory();

   //    /**
   //     * Creates or reuses a RemoteBodyFactory
   //     * @return a new or existing RemoteBodyFactory
   //     * @see RemoteBodyFactory
   //     */
   //    public RemoteBodyFactory newRemoteBodyFactory();

   /**
    * Creates or reuses a ThreadStoreFactory
    * @return a new or existing ThreadStoreFactory
    * @see ThreadStoreFactory
    */
   public ThreadStoreFactory newThreadStoreFactory();

   // GROUP

   /**
    * Creates or reuses a ProActiveGroupManagerFactory
    * @return a new ProActiveGroupManagerFactory
    */
   public ProActiveSPMDGroupManagerFactory newProActiveSPMDGroupManagerFactory();

   /**
    * creates a ProActiveComponentFactory
    * @return a new ProActiveComponentFactory
    */

   // COMPONENTS
   public ProActiveComponentFactory newComponentFactory();

   /** Creates a DebuggerFactory
    * @return a new DebuggerFactory
    */
   public DebuggerFactory newDebuggerFactory();

   /**
    * accessor to the parameters of the factory (object-based configurations)
    * @return the parameters of the factory
    */

   // COMPONENTS
   public Map<String, Object> getParameters();

   //SECURITY

   /**
    * Creates the ProActiveSecurityManager
    * @return a new ProActiveSecurityManager
    * @see ProActiveSecurityManager
    */
   public ProActiveSecurityManager getProActiveSecurityManager();

   public void setProActiveSecurityManager(ProActiveSecurityManager psm);

   public Object clone() throws CloneNotSupportedException;

   // FAULT-TOLERANCE

   /**
    * Creates the fault-tolerance manager.
    * @return the fault-tolerance manager.
    */
   public FTManagerFactory newFTManagerFactory();

   // TIMING

   /**
    * A setter for the reductor.
    * @param timitReductor
    */
   public void setTimItReductor(Object timItReductor);

   /**
    * A getter for the reductor stub.
    * @return The stub on the reductor
    */
   public Object getTimItReductor();
}

Up to ProActive 0.9.3 the activity of an active object was given by a method live(Body) called by reflection of the reified object. Doing this way didn't allow compile time type checking of the method, was using reflection, didn't allow to externalize from the reified object its activity, didn't allow to give a custom activity to an active object created using turnActive. We addressed all those issues using the new mechanism based on the three interfaces InitActive, RunActive and EndActive.

In order to convert the code of an active object containing a method live to the new interface you just need to:

  • implement the new interface RunActive (and remove Active if it was implemented)

  • changed the name of the method live to runActivity

A.1.23.

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 9.7.4, “Good ProActive programming practices” for more documentation about common errors to avoid.

A.1.24.

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 19, XML Deployment Descriptors.

A.1.25.

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:

  1. Make sure you have made interfaces for the objects which are to be made components. This is needed to be able to do the binding between components

  2. Replace the references to Active Object classes by their interfaces

  3. Create a component wrapper for each Active Object which should appear as a component. It should contain the binding behavior (bindFc,unbindFc,listFc,lookupFc methods), and maybe handle attribute modification.

  4. Create a main class where the compoents are created then bound, or use an ADL file to do so.

A.1.26.

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 19, XML Deployment Descriptors.

A.1.27.

Why is my call not asynchronous?

ProActive allows to have asynchronous code, in the following cases:

  • The return value is reifiable (see Q: A.1.7). This is needed to ensure the creation of the Future, which is the container returned (the future is used while waiting for the effective result to arrive). The returned class has to be Serializable, can not be final, and must have an empty no-arguments constructor.

  • The return value is void. In this case, the rendez-vous is made, and then the caller resumes its activity, while the receiver has now a new methodCall in its queue.

More explanations can be found in Section 9.7, “Asynchronous calls and futures”.

A.1.28.

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.1.29.

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.