Child pages
  • HowTOs
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

DistributeMe HOWTOs

This document stands for resolving difficult problems or answers questions that you might have regarding DistributeMe product.
The structure of the document is pretty simple. Each section of this document describes a problem or a question and then the ways the problem can be solved.

#toc

What is DistributeMe for?

ANSWER:

the goal of the DistributeMe product is to provide 100% pure Java solution for distributed calculations that is based on RMI.

#toc

What are the benefits of DistributeMe?

ANSWER:
  • convenience for Java developers that create functionality, they don't have to manualy create Java classes that stand for transport via RMI. This stuff generates DistributeMe for them;
  • DistributeMe comes with its own registry that makes remote RMI calls possible.

#toc

Can't build the demo project, cannot find basic-project.xml

PROBLEM:

When building I get the error message like:

igor@imer /cygdrive/d/projects/companies/Anotheria/demo
$ ant dist
Buildfile: build.xml

BUILD FAILED
d:\projects\companies\Anotheria\demo\build.xml:6: Cannot find ../build/basic-project.xml imported from d:\projects\companies\Anotheria\demo\build.xml

Total time: 0 seconds

What should I do to build the demo project successfully?

#toc

SOLUTION:

Checkout http://svn.anotheria.net/opensource/build/trunk project as D:\projects\companies\Anotheria\build so that build and demo projects have the same direct parent directory. Then build again.

#toc

The demo project build takes too long

PROBLEM:

I started the building procedure and it takes too long to build. While hanging it prints the following output ...

...
ivy-checkout:
[svn] <Checkout> started ...

#toc

ANSWER:

This usualy happens the first time you build the demo project. During that operation it downloads a banch of JAR files from our Ivy repositories.
This procedure might take a few minutes to complete. That depends on your network connection speed.

#toc

Having build problems due to incorrect JDK used

PROBLEM:

When building I get the error message like:

compile:
[apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[apt] Compiling 7 source files to d:\projects\companies\Anotheria\demo\build\classes
[apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[apt] d:\projects\companies\Anotheria\demo\java\org\distributeme\demo\GettingStartedService.java:3: cannot access net.anotheria.anoprise.metafactory.Service
[apt] bad class file: d:\projects\companies\Anotheria\demo\lib\ano-prise.jar(net/anotheria/anoprise/metafactory/Service.class)
[apt] class file has wrong version 50.0, should be 49.0
[apt] Please remove or make sure it appears in the correct subdirectory of the classpath.
[apt] import net.anotheria.anoprise.metafactory.Service;
[apt] ^
[apt] d:\projects\companies\Anotheria\demo\java\org\distributeme\demo\GettingStartedService.java:3: cannot access net.anotheria.anoprise.metafactory.Service
[apt] bad class file: d:\projects\companies\Anotheria\demo\lib\ano-prise.jar(net/anotheria/anoprise/metafactory/Service.class)
[apt] class file has wrong version 50.0, should be 49.0
[apt] Please remove or make sure it appears in the correct subdirectory of the classpath.
[apt] import net.anotheria.anoprise.metafactory.Service;
[apt] ^
[apt] 1 error

BUILD FAILED
d:\projects\companies\Anotheria\build\basic-project.xml:22: The following error occurred while executing this line:
d:\projects\companies\Anotheria\demo\build.xml:18: Compile failed; see the compiler error output for details.

Total time: 27 minutes 2 seconds

What should I do to build the demo project successfully?

#toc

ANSWER:

You must be using a JDK of a different version. You should use JDK 1.6.0.
The version of JDK you use can be checked with the following command:

igor@imer /cygdrive/d/projects/companies/Anotheria/demo
$ java -version
java version "1.5.0_18"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18-b02)
Java HotSpot(TM) Client VM (build 1.5.0_18-b02, mixed mode, sharing)

In this example the wrong JDK is used.

So, what to do?

Just install JDK 1.6.0,
set JAVA_HOME environment variable to the proper location and
make sure the java.exe, javac.exe and apt.exe are found in the Path environment variable sooner that the same binaries from wrong JDK.

After that restart the Cygwin environment (thus it can use the latest values of the environment variables) and then go build again (you can also check if the variables you just installed have proper values and the JDK used has the right version)

igor@imer ~
$ cd "D:\projects\companies\Anotheria\demo"

igor@imer /cygdrive/d/projects/companies/Anotheria/demo
$ set | grep JAVA_HOME
JAVA_HOME='D:\projects\tools\java6'

igor@imer /cygdrive/d/projects/companies/Anotheria/demo
$ java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

igor@imer /cygdrive/d/projects/companies/Anotheria/demo
$ ant dist
...

Good luck!

#toc

Got stack trace when executing RemoteTest

PROBLEM:

When executing it I got the following exception stack trace:

CLIENT: Call to add method
Exception in thread "main" java.lang.RuntimeException: Couldn't lookup delegate because: Can't lookup service in the target rmi registry for an instance of org_distributeme_demo_GettingStartedService at test.anotheria.net:80
at org.distributeme.demo.generated.RemoteGettingStartedServiceStub.getDelegate(Unknown Source)
at org.distributeme.demo.generated.RemoteGettingStartedServiceStub.add(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.java.dev.moskito.core.predefined.ServiceStatsCallHandler.invoke(ServiceStatsCallHandler.java:74)
at net.java.dev.moskito.core.dynamic.MoskitoInvokationProxy.invoke(MoskitoInvokationProxy.java:165)
at $Proxy5.add(Unknown Source)
at org.distributeme.demo.test.DimeTester.test(Unknown Source)
at org.distributeme.demo.test.RemoteTest.main(Unknown Source)
Caused by: java.lang.RuntimeException: Can't lookup service in the target rmi registry for an instance of org_distributeme_demo_GettingStartedService
at org.distributeme.demo.generated.RemoteGettingStartedServiceStub.lookup(Unknown Source)
... 11 more
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 12 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 17 more

How can I make the interraction work?

#toc

POSSIBLE CAUSES
  • No rmiregistry started locally
  • Wrong IP address is registered in the DistributeMe registry

#toc

SOLUTION

You should make sure rmiregistry tool is started on the client machine. This can be done with the following command:

rmiregistry &

Though this must not be required for future versions of DistributeMe.
Then restart your RemoteTest client.

Still having the same issue? Check the following ...

Open your web browser and visit the web page http://test.anotheria.net/distributeme/registry/list.
The response of the web page might look like.

<?xml version="1.0"?><services><service id="org_distributeme_demo_GettingStartedService" host="127.0.1.1"/></services>

The cause of the problem is that the IP address 127.0.1.1 cannot be used for remote interraction.
To resolve just this problem do the following:

Now test the web page again http://test.anotheria.net/distributeme/registry/list.
You shoud see the following XML in response:

<?xml version="1.0"?><services><service id="org_distributeme_demo_GettingStartedService" host="10.1.13.43"/></services>

Then restart your RemoteTest client.

If you still having problems check your /etc/hosts file on Ubuntu machine and replace the line

127.0.1.1 igorlap

with the line

10.1.13.43 igorlap

The hosts file maps IP addresses to host names so in my case that was just a wrong mapping

Good luck!

#toc

How to install and use DistributeMe registry locally

PROBLEM:

My client does not want to use the standard DistributeMe registry which is located at test.anotheria.net:80.

#toc

ANSWER:

Build distributeme.war and install it on your local tomcat.
Just use the following steps:

  • get distributeme project from our SVN repository http://svn.anotheria.net/opensource/distributeme/trunk as ~/projects/dime/distributeme folder
  • perform commands

    igor@igorlap:~/projects/dime$ cd ~/projects/dime/distributeme
    igor@igorlap:~/projects/dime/distributeme$ ant -f build-registry.xml war
    Buildfile: build-registry.xml
    ...
    war:
    [war] Building war: /home/igor/projects/dime/distributeme/dist/distributeme.war

    BUILD SUCCESSFUL
    Total time: 4 seconds

Then deploy the just built distributeme.war file to webapps directory of your tomcat instance.

Start tomcat if it is not started already. Check the port number used for HTTP in the conf/server.xml file that comes with your tomcat instance. That port number and the host name or IP address where tomcat is started should be specified in the distributeme.json configuration file.

This is just an example:

/etc/distributeme.json
{
	registryContainerPort: 8080,
	registryContainerHost: "10.1.13.57",
}

10.1.13.57 - is the machine where tomcat server is started and distributeme.war is deployed to it. 8080 is the port number used for HTTP protocol by that tomcat instance.

Good luck!

#toc

Debugging RMI on TCP Level

PROBLEM:

I have connection timeouts or problems in the TCP/IP Stack, how can I debug them?

ANSWER:

Check following link for details on RMI options.

http://download.oracle.com/javase/6/docs/technotes/guides/rmi/logging.html

Registry host/port

Problem

How do distributeme components know where the registry is running.

Answer

It is in the file distributeme.json in classpath in variables registryContainerHost and registryContainerPort.

  • No labels