Hi,Yes, my wireless was enabled but I've just tried the example with the network disabled and I obtain the same error.
Dan Creswell wrote:
... On 7 February 2012 14:28, Girbea Alina <[email protected]> wrote:Hi, I'm using windows xp, service pack 3. The answer to the other questions are: 1. I've got wireless, but I'm trying to run the services (my own and reggie), the http server and the client on the same machine, hence the network connection should not be a porblem.I'm afraid that isn't true as the type of network connection you have available determines key properties and behaviours that will affect network applications. Next question: Is your wireless enabled and have you tried running all this stuff with the wireless disabled?2. I'm using version 1.6 3. I've got an anti-virus, but again, if all things are running on the same machine does it count? Thanks :) Alina Dan Creswell wrote:Alina, What operating system and patch are you running please? The below error says for some reason that your machine has a problem with multicast. It would appear that your operating system cannot cope with two processes making use of the same multicast address which is somewhat broken. Other questions that need answering: (1) What kind of network connections do you have? Wired or Wireless or both or none? (2) What version of JDK are you using? (3) Have you got some form of virus checking or firewalling on the machine? On 7 February 2012 11:57, Girbea Alina <[email protected]> wrote:Hi Tom, I don't know what I am doing that nothing works. These are the steps that I've performed: (1)- I have added "FatService" in Eclipse; - Right click on "Starter" class-> Run Configurations ->Argumests -> VM Arguments and I have added the following two lines: -Djava.security.policy=D:\\****policy.all -Djava.rmi.server.****RMIClassLoaderSpi=net.jini.**** loader.pref. **PreferredClassProvider - Another change that I've made is that in "Starter" class I have changed the value of the "pathToConfig" variable: final String pathToConfig = "D:\\start-FatService.config"; - Where "start-FatService.config" looks as following: import.... com.sun.jini.start{ static private port=""8080"; static private codebase = ConfigUtil.concat(new Object[] {"http://", ConfigUtil.getHostName(), ":",port,"/FatService.jar"," ",}); private static policy = "D:\\policy.all"; static classpath = "D:\\jini\\apache-river-2.2.0\**** \lib-dl\\FatService.jar"; private static config = "D:\\jini\\apache-river-2.2.0\**** \fatService.config"; static serviceDescriptors = new ServiceDescriptor[] { new NonActivatableServiceDescripto****r( codebase, policy, classpath,"sample.service.**** FatServiceImpl",new String[] { config })}; } - I have't performed any change on "policy.all" and "fatService.config"; - I have set up the FatService.jar from the project; (2) - I've added "FatServiceConsumer" in Eclipse; - Right click on "ServiceConsumer" class-> Run Configurations ->Argumests -> VM Arguments and I have added the following two lines: -Djava.security.policy=D:\\****policy.all -Djava.rmi.server.****RMIClassLoaderSpi=net.jini.**** loader.pref. **PreferredClassProvider (3) - I've added "FatService.jar" at the following path "D:\jini\apache-river-2.2.0\****lib-dl" and I've checked with a browser that it can be downloaded; (4) - I've added "fatService.config" at the following path "D:\jini\apache-river-2.2.0" (5) - I've added "start-FatService.config" directly under "D:\" (6) - I've started the Jini HTTP server: java -jar tools.jar -port 8080 -dir D:\jini\apache-river-2.2.0\** lib-dl (7) - I've started the reggie lookup service: java -Djava.security.policy=D:\****policy.all -jar D:\jini\apache-river-2.2.0\****lib\start.jar D:\start-transient-reggie.** config - Where "start-transient-reggie.****config" contains: import.... com.sun.jini.start { private static codebase = ConfigUtil.concat(new Object[] { "http://", "localhost", ":8080/reggie-dl.jar"+" http://","localhost",":8080/** jsk-dl.jar" } ); private static policy = "D:\\policy.all"; private static classpath = "D:\\jini\\apache-river-2.2.0\**** \lib\\reggie.jar"; private static config = "D:\\transient-reggie.config"; static serviceDescriptors = new ServiceDescriptor[] { new NonActivatableServiceDescripto****r( codebase, policy, classpath, "com.sun.jini.reggie.****TransientRegistrarImpl", new String[] { config }) }; } - And "transient-reggie.config" is as follows: com.sun.jini.reggie { initialMemberGroups = new String[] {}; } (8) After that I've invoked Strater.java class -> right click on it -> Run as a java application And a result I obtain the following error: Feb 7, 2012 1:52:02 PM com.sun.jini.start.****ServiceStarter checkResultFailures WARNING: Exception creating service. java.lang.reflect.****InvocationTargetException at sun.reflect.****NativeConstructorAccessorImpl.** **newInstance0(Native Method) at sun.reflect.****NativeConstructorAccessorImpl.** **newInstance(Unknown Source) at sun.reflect.****DelegatingConstructorAccessorI** **mpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.****newInstance(Unknown Source) at com.sun.jini.start.****NonActivatableServiceDescripto****r.create(** NonActivatableServiceDescripto****r.java:674) at com.sun.jini.start.****ServiceStarter.create(**** ServiceStarter.java:287) at com.sun.jini.start.****ServiceStarter.**** processServiceDescriptors(** ServiceStarter.java:445) at com.sun.jini.start.****ServiceStarter.main(**** ServiceStarter.java:505) at sample.service.Starter.main(****Starter.java:48) Caused by: java.rmi.RemoteException: Unable to start service because: Address already in use: Cannot bind; nested exception is: java.net.BindException: Address already in use: Cannot bind at sample.service.FatServiceImpl.****<init>(FatServiceImpl.java:**43) ... 9 more Caused by: java.net.BindException: Address already in use: Cannot bind at java.net.****PlainDatagramSocketImpl.bind0(****Native Method) at java.net.****PlainDatagramSocketImpl.bind(****Unknown Source) at java.net.DatagramSocket.bind(****Unknown Source) at java.net.MulticastSocket.<****init>(Unknown Source) at java.net.MulticastSocket.<****init>(Unknown Source) at net.jini.discovery.****LookupDiscovery$**** AnnouncementListener.<init>(** LookupDiscovery.java:1030) at net.jini.discovery.****LookupDiscovery$7.run(** LookupDiscovery.java:3091) at java.security.****AccessController.doPrivileged(****Native Method) at net.jini.security.Security$5.****run(Security.java:543) at java.security.****AccessController.doPrivileged(****Native Method) at net.jini.security.Security.****doPrivileged(Security.java:****540) at net.jini.discovery.****LookupDiscovery.****beginDiscovery(** LookupDiscovery.java:3089) at net.jini.discovery.****LookupDiscovery.<init>(** LookupDiscovery.java:1946) at net.jini.discovery.****LookupDiscoveryManager.****beginDiscovery(** LookupDiscoveryManager.java:****1549) at net.jini.discovery.****LookupDiscoveryManager.<init>(**** LookupDiscoveryManager.java:****902) at sample.service.FatServiceImpl.****init(FatServiceImpl.java:91) at sample.service.FatServiceImpl.****<init>(FatServiceImpl.java:**40) ... 9 more Feb 7, 2012 1:52:02 PM com.sun.jini.start.****ServiceStarter checkResultFailures WARNING: Associated service descriptor [0]: [http://pc-nume:8080/** FatService.jar <http://pc-nume:8080/**FatService.jar<http://pc-nume:8080/FatService.jar>> , D:\policy.all, D:\jini\apache-river-2.2.0\****lib-dl\FatService.jar, sample.service.FatServiceImpl, [D:\jini\apache-river-2.2.0\**** fatService.config], com.sun.jini.start.****NonActivatableServiceDescripto****r$1@1662dc8, BasicProxyPreparer[]] What have I done wrong again:(? Thank you very much! Alina On Monday 06/02/2012 at 14:21:29, Tom Hobbs wrote:Hi Alina, I couldn't get the samples you sent me to work and I couldn't reproduce the problem you were encountering either. So instead I've attached two sample Eclipse projects that contain the bare minimum required to work. I believe that these do what you want them to, of course, if you want to use different exporters etc then you'll have to change that. Here's what's attached. Project: FatService This is a simple service that implements the "service.sample.FatService" interface for you. It runs in it's own JVM and methods invoked on it are executed in that JVM (not downloaded and executed on the client). I recall you saying that's what you wanted. Project: FatServiceConsumer This is a simple service that lookups up an instance of the above and invokes a method on it. By examining the logs from the service invocation you can verify what code is running where. So this is what you need to do. 1. Load up these two projects and make sure they both compile. 2. Edit the config files to match your setup (they have values hardcoded into them that match my dev machine!) 3. JAR up FatService and put the JAR somewhere that your HTTP server can serve it. 4. Use wget/browser to make sure your JAR file is downloadable 5. Start a lookup service in an appropriate group (I've not specified any particular groups in this example) 6. Start up the FatService by invoking sample.service.Starter (FatService project) 7. Start up your service consumer by invoking ServiceConsumer (FatServiceConsumer project) Both of those final two items require the following VM args to be present. -Djava.security.policy=/home/****tom/projects/river/easystart/**** src-extra/policy.all -Djava.rmi.server.****RMIClassLoaderSpi=net.jini.****loader.pref.** PreferredClassProvider Again, notice the hardcoded path above which will need changing for your environment! Also, FatServiceConsumer project has a classpath dependency on FatService project. I think this setup is a lot more simple than the one you sent me, and I'm pretty sure it does all of what you need it to do. Obviously this code isn't production quality and comes with no warranty, so beware. Hopefully this will work for you. Tom On Tue, Jan 31, 2012 at 9:14 AM, Tom Hobbs <[email protected]> wrote:Sorry, I've not even looked at them yet! I've been very busy with work and family commitments. I'm going to try and have a look towards the end if this week, maybe Thursday. Cheers, Tom Sent via mobile device, please forgive typos and spacing errors. On 30 Jan 2012 18:31, "Girbea Alina" <[email protected]> wrote:Hi, Have you discovered the cause of my error:)? I hope you received the two projects that I sent you on your personal email. Thank you very much again! Best regards, Alina Tom Hobbs wrote:Sorry you're still stuck. Can you paste your service's java code as well? I'm drawing a blank on why you're seeing this, the configs look fine. Sent via mobile device, please forgive typos and spacing errors. On 26 Jan 2012 07:44, "Girbea Alina" <[email protected]> wrote:Hi, I haven't figured out which is the cause of my error. Do you have any idea? Thank you! Alina On Thursday 19/01/2012 at 10:55:50, Tom Hobbs wrote:Can you include the contents of your services config files, if any, please? Both services should be able to run quite happily on the same server. The port in use error can, off the top of my head, either be the HTTP port or the port that River uses for discovery (reggies port). So the first thing I would look for would be to make sure you're not accidentally attempting to start a second HTTP service. Sent via mobile device, please forgive typos and spacing errors. On 18 Jan 2012 19:50, "Girbea Alina" <[email protected]> wrote:Hi, I'm working on my very first jini application and I want to develop a "fat" service (where the work is done on the server and the client uses a proxy). Hence, I want to setup a nonactivatable jini service (the implementation must be Remote and must be able to create a proxy) as described in Jan Newmarch's book in chapter 21 using the ServiceDescription interface. These are the steps that I followed: 1) Start Jini HttpServer: D:\jini\apache-river-2.2.0\********lib>java -jar tools.jar -port 8080 -dir D:\jini\apache-river-2.2.0\********lib-dl and I have obtained the following message: Jan 16, 2012 10:11:28 PM com.sun.jini.tool.ClassServer run INFO: ClassServer started [[D:\jini\apache-river-2.2.0\********lib-dl\], port 8080] 2) Start Reggie service using the following instruction (I'm using reggie because I want to register my service with the reggie lookup service): D:\>java -Djava.security.policy=D:\********policy.all -jar D:\jini\apache-river-2.2.0\********lib\start.jar D:\start-transient-reggie.** config and I have obtained the following message: Jan 16, 2012 10:23:12 PM com.sun.jini.reggie.****** RegistrarImpl init INFO: started Reggie: c704a7fa-0540-46a4-93b1-******** a321bc8c50a8, [], ConstrainableLookupLocator[[********jini://pc-nume/], [null]] (2.1)Where the start-transient-reggie.config looks as follows: import com.sun.jini.start.********ServiceDescriptor; import com.sun.jini.start.********NonActivatableServiceDescripto **** ****r; import com.sun.jini.config.********ConfigUtil; com.sun.jini.start { private static codebase = ConfigUtil.concat(new Object[] { "http://", "localhost", ":8080/reggie-dl.jar"+" http:// ","localhost",":8080/** jsk-dl.jar" } ); private static policy = "D:\\policy.all"; private static classpath = "D:\\jini\\apache-river-2.2.0\** ****** \lib\\reggie.jar"; private static config = "D:\\transient-reggie.config"; static serviceDescriptors = new ServiceDescriptor[] {new NonActivatableServiceDescripto********r( codebase, policy, classpath, "com.sun.jini.reggie. **TransientRegistrarImpl",new String[] { config }) }; } (2.2)transient-reggie.config com.sun.jini.reggie { initialMemberGroups = new String[] {} } 3) Afterwards I have developed the service and I have created the jar "ServiceDescription-dl.jar", which I have put at D:\jini\apache-river-2.2.0\ **lib-dl\classes where the http server is started and which contains the classes needed by the client. The thing is that if reggie is started then I get the following error message: java.net.BindException: Address already in use: Cannot bind at java.net.********PlainDatagramSocketImpl.bind0(********Native Method) at java.net.********PlainDatagramSocketImpl.bind(********Unknown Source) at java.net.DatagramSocket.bind(********Unknown Source) at java.net.MulticastSocket.<********init>(Unknown Source) at java.net.MulticastSocket.<********init>(Unknown Source) at net.jini.discovery.********LookupDiscovery$**** AnnouncementListener.<init>(** LookupDiscovery.java:1030) at net.jini.discovery.********LookupDiscovery$7.run(** LookupDiscovery.java:3091) at java.security.********AccessController.doPrivileged(** ******Native Method) at net.jini.security.Security$5.********run(Security.java:543) at java.security.********AccessController.doPrivileged(** ******Native Method) at net.jini.security.Security.***** ***doPrivileged(Security.java:**** **** 540) at net.jini.discovery.********LookupDiscovery.****** beginDiscovery(** LookupDiscovery.java:3089) at net.jini.discovery.********LookupDiscovery.<init>(** LookupDiscovery.java:1946) at net.jini.discovery.********LookupDiscoveryManager.**** beginDiscovery(** LookupDiscoveryManager.java:********1549) at net.jini.discovery.********LookupDiscoveryManager.<init>(** ****** LookupDiscoveryManager.java:********902) at starter.ServiceDescription.********advertiseService(** ServiceDescription.java:160) at starter.ServiceDescription.<**** ****init>(ServiceDescription.**** java:** **76) at starter.ServiceDescription.********main(ServiceDescription.** java: ***** *36) If reggie is not started, then I get no error and the service works. Otherwise, if I try to start reggie after my service is started I get a similar error. Jan 18, 2012 6:48:13 PM com.sun.jini.reggie.******** RegistrarImpl <init> SEVERE: Reggie initialization failed java.net.BindException: Address already in use: Cannot bind at java.net.********PlainDatagramSocketImpl.bind0(**** ****Native Method) �� at java.net.********PlainDatagramSocketImpl.bind(***** ***Unknown Source) at java.net.DatagramSocket.bind(********Unknown Source) at java.net.MulticastSocket.<********init>(Unknown Source) at java.net.MulticastSocket.<********init>(Unknown Source) at net.jini.discovery.********LookupDiscovery$** AnnouncementListener.<init>(********Lookup Discovery.java:1030) at net.jini.discovery.********LookupDiscovery$7.run(** LookupDiscovery.java:3091) at java.security.********AccessController.doPrivileged(** ******Native Method) at net.jini.security.Security$5.***** ***run(Security.java:543) at java.security.********AccessController.doPrivileged(** ******Native Method) at net.jini.security.Security.******** doPrivileged(Security.java:********540) at net.jini.discovery.********LookupDiscovery.**** beginDiscovery(** LookupDiscovery.jav a:3089) at net.jini.discovery.********LookupDiscovery.<init>(** LookupDiscovery.java:1946) at net.jini.discovery.********LookupDiscoveryManager.** beginDiscovery(LookupDiscov eryManager.java:1549) at net.jini.discovery.********LookupDiscoveryManager.<init>(******** LookupDiscoveryManag er.java:966) at com.sun.jini.reggie.********RegistrarImpl.init(** RegistrarImpl.java:4557) at com.sun.jini.reggie.******** RegistrarImpl.access$000(** RegistrarImpl.java:143) at com.sun.jini.reggie.********RegistrarImpl$1.run(** RegistrarImpl.java:448) at com.sun.jini.reggie.******** RegistrarImpl.loginAndRun(** RegistrarImpl.java:461) at com.sun.jini.reggie.********RegistrarImpl.<init>(** RegistrarImpl.java:396) at com.sun.jini.reggie.****** TransientRegistrarImpl.<init>(****** ** TransientRegistrarI mpl.java:39) at sun.reflect.********NativeConstructorAccessorImpl.** **** **newInstance0(Native Method) at sun.reflect.********NativeConstructorAccessorImpl.** **** **newInstance(Unknown Source) at sun.reflect.********DelegatingConstructorAccessorI** **** **mpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.**** ****newInstance(Unknown Source) at com.sun.jini.start.********NonActivatableServiceDescripto******** r.create(NonActivata bleServiceDescriptor.java:674) at com.sun.jini.start.********ServiceStarter.create(** ServiceStarter.java:287) at com.sun.jini.start.********ServiceStarter.**** processServiceDescriptors(* *ServiceSt arter.java:445) at com.sun.jini.start.********ServiceStarter.main(** ServiceStarter.java:476) Jan 18, 2012 6:48:13 PM com.sun.jini.start.********ServiceStarter checkResultFailures WARNING: Exception creating service. java.lang.reflect.********InvocationTargetException at sun.reflect.********NativeConstructorAccessorImpl.** **** **newInstance0(Native Method) at sun.reflect.********NativeConstructorAccessorImpl.** **** **newInstance(Unknown Source) at sun.reflect.********DelegatingConstructorAccessorI** **** **mpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.**** ****newInstance(Unknown Source) at com.sun.jini.start.********NonActivatableServiceDescripto******** r.create(NonActivata bleServiceDescriptor.java:674) at com.sun.jini.start.********ServiceStarter.create(** ServiceStarter.java:287) at com.sun.jini.start.********ServiceStarter.**** processServiceDescriptors(* *ServiceSt arter.java:445) at com.sun.jini.start.********ServiceStarter.main(** ServiceStarter.java:476) Caused by: java.net.BindException: Address already in use: Cannot bind at java.net.********PlainDatagramSocketImpl.bind0(**** ****Native Method) at java.net.********PlainDatagramSocketImpl.bind(***** ***Unknown Source) at java.net.DatagramSocket.bind(********Unknown Source) at java.net.MulticastSocket.<********init>(Unknown Source) at java.net.MulticastSocket.<********init>(Unknown Source) at net.jini.discovery.********LookupDiscovery$** AnnouncementListener.<init>(********Lookup Discovery.java:1030) at net.jini.discovery.********LookupDiscovery$7.run(** LookupDiscovery.java:3091) at java.security.********AccessController.doPrivileged(** ******Native Method) at net.jini.security.Security$5.***** ***run(Security.java:543) at java.security.********AccessController.doPrivileged(** ******Native Method) at net.jini.security.Security.******** doPrivileged(Security.java:********540) at net.jini.discovery.********LookupDiscovery.**** beginDiscovery(** LookupDiscovery.jav a:3089) at net.jini.discovery.********LookupDiscovery.<init>(** LookupDiscovery.java:1946) at net.jini.discovery.********LookupDiscoveryManager.** beginDiscovery(LookupDiscov eryManager.java:1549) at net.jini.discovery.********LookupDiscoveryManager.<init>(******** LookupDiscoveryManag er.java:966) at com.sun.jini.reggie.********RegistrarImpl.init(** RegistrarImpl.java:4557) at com.sun.jini.reggie.******** RegistrarImpl.access$000(** RegistrarImpl.java:143) at com.sun.jini.reggie.********RegistrarImpl$1.run(** RegistrarImpl.java:448) at com.sun.jini.reggie.******** RegistrarImpl.loginAndRun(** RegistrarImpl.java:461) at com.sun.jini.reggie.********RegistrarImpl.<init>(** RegistrarImpl.java:396) at com.sun.jini.reggie.****** TransientRegistrarImpl.<init>(****** ** TransientRegistrarI mpl.java:39) ... 8 more Jan 18, 2012 6:48:13 PM com.sun.jini.start.********ServiceStarter checkResultFailures WARNING: Associated service descriptor [0]: [ http://localhost:8080/reggie- **dl.jar <http://localhost:8080/reggie-******dl.jar<http://localhost:8080/reggie-****dl.jar> <http://localhost:**8080/reggie-**dl.jar<http://localhost:8080/reggie-**dl.jar><http://localhost:**8080/**reggie-dl.jar<http://**localhost:8080/reggie-dl.jar<http://localhost:8080/reggie-dl.jar>http://localhost:8080/jsk-dl.********jar<http://localhost:8080/jsk-dl.******jar><http://localhost:**8080/jsk-dl.****jar<http://localhost:8080/jsk-dl.****jar><http://localhost:8080/**jsk-**dl.**jar<http://localhost:8080/**jsk-dl.**jar><http://localhost:**8080/jsk-dl.**jar<http://localhost:8080/jsk-dl.**jar><http://localhost:8080/jsk-dl.******jar<http://localhost:8080/jsk-dl.****jar> <http://localhost:8080/**jsk-dl.**jar<http://localhost:8080/jsk-dl.**jar><http://localhost:8080/jsk-dl.****jar<http://localhost:8080/jsk-dl.**jar><http://localhost:8080/**jsk-dl.jar<http://localhost:8080/jsk-dl.jar>,D:\policy.all, D:\jini\apache-river-2.2.0\lib\reggie.jar, com.sun.jini.reggie.********TransientRegistrarImpl, [D:\ transient-reggie.co nfig], com.sun.jini.start.********NonActivatableServiceDescripto* ***** **r$1@a470b8, BasicProxyPr eparer[]] Shouldn't both services be able to run on the same server? What have I done wrong?? I really dont't have any clue, I think I got the concept wrong somewhere! Best regards! Alina
