RE: DEPLOYMENT

"Guijarro, Julio" <[email protected]>
Newsgroups gmane.comp.java.smartfrog.devel
Message-ID <8D5B24B83C6A2E4B9E7EE5FA82627DC9A43EB5@sdcexcea01.emea.cpqcorp.net>
Hi Rana,

In your code you are trying to use a CompoundImpl that you create yourself and then use it to deploy the description.

You cannot create a compound in that way. A component needs to be loaded in memory, deployed and started, and all this needs to be done in the right way. The easies way to do it is to create a component class and a description that deploys it and use the framework for the deployment. Look at examples/spawn. Spawn is a compound that deploys component descriptions, also ArrayCompound

If what you want is to deploy a description from a third party application, the best way to do it is to create a common/ConfigurationDescriptor and use the SFSystem.runConfigurationDescriptor(cfgD) method. You can also have a look at the way the SF Ant tasks do it. 

I have also attached an example that does this in a very simplify way. You need to have a sfDaemon running before trying the example.

The steps are:

- Get a component description that you want to deploy
- Get a Compound that is already deployed: 
	In this case I use the sfDaemon 
- Ask that compound to deploy the description for you.

It is not clear to me what you are trying to achieve, Could you explain it a bit so that I can help you? 

Regards, 
	Julio

New DeployExample:

public class DeployExample {

    public static void main(String[] args) {      
        try {
            // Init SF System
            org.smartfrog.SFSystem.initSystem();
            // Get an DEPLOYED component. In this case the sfDaemon in local host.
            Compound cp = SFProcess.getRootLocator().getRootProcessCompound(InetAddress.getByName("localhost"),3800);                
            
            // Get a ComponentDescription
            ComponentDescription cd = ComponentDescriptionImpl.sfComponentDescription("/org/smartfrog/examples/pong/singlePlayer.sf");
            
            // Deploy the component description        
            Prim p = cp.sfCreateNewApp("Application_Hola_Pong", cd, null);
                  
            System.out.println(" We just deployed: "+ p.sfCompleteName());
            
        } catch (SFGeneralSecurityException ex) {
            ex.printStackTrace();
        } catch (SmartFrogException ex) {
            ex.printStackTrace();
        } catch (Exception ex){
            ex.printStackTrace();
        }
    }
}



> -----Original Message-----
> From: rana dabbu [mailto:[email protected]]
> Sent: 30 April 2005 07:31
> To: Guijarro, Julio
> Subject: DEPLOY
> 
> Hi Julio,
> 
> As you have said, I tried the following code,
> 
> 
> a
> 
> and I am getting the following errors,
> 
> 2005/04/30 11:52:42:493 IST [ERROR][main] SFCORE_LOG -
> java.lang.NullPointerException
> SmartFrogDeploymentException: unnamed component.
> java.lang.ClassCastException:
> org.smartfrog.sfcore.common.SmartFrogException, cause:
> java.lang.ClassCastException:
> org.smartfrog.sfcore.common.SmartFrogException
> 	at
> org.smartfrog.sfcore.common.SmartFrogDeploymentException.forward(SmartFrog
> DeploymentException.java:174)
> 	at
> org.smartfrog.sfcore.compound.CompoundImpl.sfDeployComponentDescription(Co
> mpoundImpl.java:165)
> 	at
> org.smartfrog.sfcore.compound.CompoundImpl.sfCreateNewApp(CompoundImpl.jav
> a:243)
> 	at deploy.main(deploy.java:54)
> Caused by: java.lang.ClassCastException:
> org.smartfrog.sfcore.common.SmartFrogException
> 	at
> org.smartfrog.sfcore.processcompound.PrimHostDeployerImpl.deploy(PrimHostD
> eployerImpl.java:142)
> 	at
> org.smartfrog.sfcore.prim.PrimDeployerImpl.deploy(PrimDeployerImpl.java:22
> 6)
> 	at
> org.smartfrog.sfcore.deployer.SFDeployer.deploy(SFDeployer.java:97)
> 	at
> org.smartfrog.sfcore.compound.CompoundImpl.sfDeployComponentDescription(Co
> mpoundImpl.java:123)
> 	... 2 more
> 
> How can i overcome this problem? could you help please.
> 
> 
> regards
> 
> rana

> -----Original Message-----
> From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:smartfrog-
> developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Guijarro, Julio
> Sent: 29 April 2005 14:09
> To: Sabharwal, Ritu (STSD); rana dabbu
> Cc: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: RE: [Smartfrog-developer] DEPLOYMENT
> 
> Hi Rana,
> 
> When you deploy a Component description you can deploy a new Application
> or a new Child. When deploying a new Application, the parent parameter is
> null.
> 
> Now, to deploy a new Application you can use directly the method:
> ---
> sfCreateNewApp (String name, ComponentDescription cmp,Context parms)
> 
> Parameters:
> name - name for the new application
> cmp - compiled component to deploy and start
> parms - parameters for description
> ---
> 
> When using this method you only need to pass a NAME and a valid
> COMPONENTDescription. "parms" will be null most of the time.
> 
> Please, just to understand how the method works, try to deploy a very
> simple component description with a standard component like Prim or
> Compound.
> 
> To do this you could for example do:
> ---
> ComponentDescription cd;
> 
> cd =
> ComponentDescription.sfComponentDescription("/org/smartfrog/examples/pong/
> singlePlayer.sf");
> 
> //Inside a Compound
> this.sfCreateNewApp("testingPong",cd,null);
> ---
> 
> I have the suspicion that the null pointer is being thrown inside your new
> component and not in the create/deploy methods. Have you tested your
> component using a normal description?
> 
> Please, if this does not work for you, could you send a short example that
> we could comment on?
> 
> Julio Guijarro
> 
> 
> > -----Original Message-----
> > From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:smartfrog-
> > developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Sabharwal, Ritu
> (STSD)
> > Sent: 29 April 2005 12:57
> > To: rana dabbu
> > Cc: smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > Subject: Re: [Smartfrog-developer] DEPLOYMENT
> >
> > Hello Rana,
> >
> > As I mentioned in my earlier mail, the parent parameter has to be some
> > compound component (itself or some other compound) or some
> > processcompound (local or remote rootProcess). In each case, call
> > sfDeployComponentDescription() with the appropriate component as parent
> > paremeter from sfStart(). Parent parameter points to the component/host
> > where you want this component to get deployed so it cannot be null.
> >
> > Also, as Julio mentioned please check the similar thread in the lists
> > archive:
> >
> > http://news.gmane.org/gmane.comp.java.smartfrog.user/cutoff=72
> >
> > Title: "Component Deployment."
> >
> > Thanks,
> > Ritu.
> >
> > rana dabbu wrote:
> >
> > >hello ,
> > >
> > >              As per instructions I have tried the following
> > >- i have a class extending Compound and used both sfCreateNewApp and
> > >sfDeployComponent description( by setting parent to NULL and context
> > >obtained by the sfContext() on my description).
> > >I am getting Nullpointer and Deployment exception.
> > >
> > >regards,
> > >Rana
> > >
> > >
> > >-------------------------------------------------------
> > >SF.Net email is sponsored by: Tell us your software development plans!
> > >Take this survey and enter to win a one-year sub to SourceForge.net
> > >Plus IDC's 2005 look-ahead and a copy of this survey
> > >Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
> > >_______________________________________________
> > >Smartfrog-developer mailing list
> > >Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > >https://lists.sourceforge.net/lists/listinfo/smartfrog-developer
> > >
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is sponsored by: Tell us your software development plans!
> > Take this survey and enter to win a one-year sub to SourceForge.net
> > Plus IDC's 2005 look-ahead and a copy of this survey
> > Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
> > _______________________________________________
> > Smartfrog-developer mailing list
> > Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > https://lists.sourceforge.net/lists/listinfo/smartfrog-developer
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Tell us your software development plans!
> Take this survey and enter to win a one-year sub to SourceForge.net
> Plus IDC's 2005 look-ahead and a copy of this survey
> Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
> _______________________________________________
> Smartfrog-developer mailing list
> Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/smartfrog-developer
DeployExample.java (application/octet-stream, 2.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.