Re: Start Javaspaces 2.1 by command line

"John McClain - Sun Microsystems, Inc." <[email protected]> Tue, 27 May 2008 15:41:27 -0400
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
This is a multi-part message in MIME format.

--Boundary_(ID_Dz4n8MeNz8XWxtnkLfggwA)
Content-type: text/plain; format=flowed; charset=ISO-8859-1
Content-transfer-encoding: 7BIT

Bulzan Stefan wrote:
> Hello,
> I've started Fiddler and outrigger with the scripts from previous messages.
> It seems that because of the new version, 2.1 some permissions weren't
> granted, so I've set a grant all permission policy. 
> 1.Now it can't access the classes I need: 
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> net/jini/space/JavaSpace05 
> though the classes are available in jini-ext.jar library.  
> I've changed the manifest file from start.jar , but I don't think this is a
> very wise thing to do. 
> How can I make these classes visible to the code from start.jar?

My bad. The files I referenced in my last mail were written for 2.0, I 
had forgotten that we had changed the directory tree for 2.1, I have 
attached some re-written ones, use a command like this start it all up :

	java -Djava.security.policy=jsk-services.all.policy \
              -Djsk.lib=/files/jini2_1/lib \
              -jar /files/jini2_1/lib/start.jar all-services.config

I actually ran these against 2.1 and 6 services did come up in the browser.

I also included a file that only starts reggie and outrigger

         java -Djava.security.policy=jsk-services.all.policy \
              -Djsk.lib=/files/jini2_1/lib \
              -jar /files/jini2_1/lib/start.jar outrigger-reggie.config

> 2.Another issue is that it requires access to 224.0.1.85, a machine which I
> can't reach (I cannot ping it).
> What's the thing with 224.0.1.85? Do I have to connect to it to use JavaSpaces?!

224.0.1.85 isn't a machine, but a multi-cast address. Packets sent to 
224.0.1.85 are received by all programs listing on that address. Jini 
use 224.0.1.85 for "group" discovery. You can also use "unicast" 
discovery, but that would require some editing of the config file. Are 
you getting some error?

> 3. If I start an outrigger and a fiddler on the same machine , the last
> server started will
> give a bind exception. How can I start both services without conflict?

Need to know more about the error and how you are starting them up. If 
you use something like all-services.config you shouldn't be getting 
conflicts. BTW, you probably don't need fiddler at this point, just 
Reggie, Outrigger, and maybe Mahalo.

Hope this helps


-- 
John McClain					[email protected]
Sun Microsystems, Inc.
Burlington, MA

And it is that way today. We are tricked by hope into starting
companies, beginning books, immigrating to this country and investing
in telecom networks. The challenges turn out to be tougher than we
imagined. Our excessive optimism is exposed. New skills are demanded.
But nothing important was ever begun in a prudential frame of mind.

         - David Brooks



===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

--Boundary_(ID_Dz4n8MeNz8XWxtnkLfggwA)
Content-type: text/plain; name=jsk-services.all.policy
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=jsk-services.all.policy

/* This policy file grants all permissions to all the server side
 * classes of the service implementations in Sun's Jini starter
 * kit. This is a reasonable policy file to use if you trust the code
 * in starter kit and if we are largely unconcerned about attacks on the
 * services being run. When used the with a starter kit service
 * implementation this file will not prevent denial of service attacks
 * against the service or restrict access to the service, but it
 * should prevent the service from being used as a platform for
 * attacks against its host or other hosts/servers on the network.
 *
 * This file assumes that the jsk.lib property has been set to the
 * location of the lib directory in the starter kit.
 */  
grant codebase "file:${jsk.lib}${/}*" {
    permission java.security.AllPermission;
};

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

--Boundary_(ID_Dz4n8MeNz8XWxtnkLfggwA)
Content-type: text/plain; name=all-services.config
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=all-services.config

/* This configuration file will start transient instances of all 6 of
 * Sun's contributed Jini service implementations. An appropriate http
 * server will also be started to serve up the codebase annotations
 * of each service. All 6 services and the http server will be all
 * hosted in the same VM. If this VM dies all 6 services and the http
 * server will also be destroyed. All services will use Jini ERI as
 * their RMI implementation. By default the lookup will be a member
 * of the multicast group with the same name as the user's user name
 * and the other five services will be setup to register with
 * lookups in that group. Assumes the "jsk.lib" property has been set
 * to the location of the starter kit's "lib" directory and that
 * "jsk-services.all.policy" is in the working directory and grants
 * appropriate permission for the service, http server, and starter code
 * to run.
 *
 * If you don't want to start all six services just remove the appropriate
 * elements of "serviceDescriptors"
 */
import com.sun.jini.start.NonActivatableServiceDescriptor;
import com.sun.jini.start.ServiceDescriptor;
import com.sun.jini.config.ConfigUtil;

com.sun.jini.start {
    // Discovery Group to use
    private static group = "${user.name}";

    private static httpdPort = "8080";
    private static codebaseBase = "http://" + ConfigUtil.getHostName() +
	":" + httpdPort + "/";
    private static dlCodebase = codebaseBase + "jsk-dl.jar";

    private static policy = "${java.security.policy}";
    private static classpathBase = ConfigUtil.concat(new Object[] {
         "${jsk.lib}","${/}"});

    static serviceDescriptors = new ServiceDescriptor[] {

        // httpd
        new NonActivatableServiceDescriptor(
            "",
            policy,
            ConfigUtil.concat(new Object[] {classpathBase, "tools.jar"}),
            "com.sun.jini.tool.ClassServer",
            new String[]{"-port", httpdPort, "-dir", "${jsk.lib}" + "-dl", "-verbose"}),

        // Reggie (lookup service)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "reggie-dl.jar " + dlCodebase,
            policy,
            classpathBase + "reggie.jar",
            "com.sun.jini.reggie.TransientRegistrarImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.reggie.initialMemberGroups=new String[]{\"",
                    group,
                    "\"}"})}),

        // Outrigger (JavaSpace)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "outrigger-dl.jar " + dlCodebase,
            policy,
            classpathBase + "outrigger.jar",
            "com.sun.jini.outrigger.TransientOutriggerImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.outrigger.initialLookupGroups=new String[]{\"",
                    group,
                    "\"}"})}),

        // Mahalo (transaction manager)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "mahalo-dl.jar " + dlCodebase,
            policy,
            classpathBase + "mahalo.jar",
            "com.sun.jini.mahalo.TransientMahaloImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.mahalo.initialLookupGroups=new String[]{\"",
                    group,
                    "\"}"})}),

        // Norm (lease renewal service)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "norm-dl.jar " + dlCodebase,
            policy,
            classpathBase + "norm.jar",
            "com.sun.jini.norm.TransientNormServerImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.norm.initialLookupGroups=new String[]{\"",
                    group,
                    "\"}"})}),

        // Mercury (event mailbox)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "mercury-dl.jar " + dlCodebase,
            policy,
            classpathBase + "mercury.jar",
            "com.sun.jini.mercury.TransientMercuryImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.mercury.initialLookupGroups=new String[]{\"",
                    group,
                    "\"}"})}),

        // Fiddler (lookup discovery service)
        new NonActivatableServiceDescriptor(
            codebaseBase + "fiddler-dl.jar " + dlCodebase,
            policy,
            classpathBase + "fiddler.jar",
            "com.sun.jini.fiddler.TransientFiddlerImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.fiddler.initialLookupGroups=new String[]{\"",
                    group,
                    "\"}"})})

    };
}

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

--Boundary_(ID_Dz4n8MeNz8XWxtnkLfggwA)
Content-type: text/plain; name=outrigger-reggie.config
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=outrigger-reggie.config

/* This configuration file will start transient instances of all 6 of
 * Sun's contributed Jini service implementations. An appropriate http
 * server will also be started to serve up the codebase annotations
 * of each service. All 6 services and the http server will be all
 * hosted in the same VM. If this VM dies all 6 services and the http
 * server will also be destroyed. All services will use Jini ERI as
 * their RMI implementation. By default the lookup will be a member
 * of the multicast group with the same name as the user's user name
 * and the other five services will be setup to register with
 * lookups in that group. Assumes the "jsk.lib" property has been set
 * to the location of the starter kit's "lib" directory and that
 * "jsk-services.all.policy" is in the working directory and grants
 * appropriate permission for the service, http server, and starter code
 * to run.
 *
 * If you don't want to start all six services just remove the appropriate
 * elements of "serviceDescriptors"
 */
import com.sun.jini.start.NonActivatableServiceDescriptor;
import com.sun.jini.start.ServiceDescriptor;
import com.sun.jini.config.ConfigUtil;

com.sun.jini.start {
    // Discovery Group to use
    private static group = "${user.name}";

    private static httpdPort = "8080";
    private static codebaseBase = "http://" + ConfigUtil.getHostName() +
	":" + httpdPort + "/";
    private static dlCodebase = codebaseBase + "jsk-dl.jar";

    private static policy = "${java.security.policy}";
    private static classpathBase = ConfigUtil.concat(new Object[] {
         "${jsk.lib}","${/}"});

    static serviceDescriptors = new ServiceDescriptor[] {

        // httpd
        new NonActivatableServiceDescriptor(
            "",
            policy,
            ConfigUtil.concat(new Object[] {classpathBase, "tools.jar"}),
            "com.sun.jini.tool.ClassServer",
            new String[]{"-port", httpdPort, "-dir", "${jsk.lib}" + "-dl", "-verbose"}),

        // Reggie (lookup service)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "reggie-dl.jar " + dlCodebase,
            policy,
            classpathBase + "reggie.jar",
            "com.sun.jini.reggie.TransientRegistrarImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.reggie.initialMemberGroups=new String[]{\"",
                    group,
                    "\"}"})}),

        // Outrigger (JavaSpace)
        new NonActivatableServiceDescriptor(
	    codebaseBase + "outrigger-dl.jar " + dlCodebase,
            policy,
            classpathBase + "outrigger.jar",
            "com.sun.jini.outrigger.TransientOutriggerImpl",
            new String[] {"-",
                ConfigUtil.concat(new Object[] {
                    "com.sun.jini.outrigger.initialLookupGroups=new String[]{\"",
                    group,
                    "\"}"})})
     };
}

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

--Boundary_(ID_Dz4n8MeNz8XWxtnkLfggwA)--