Geert, I assure you the Config reference is null and not the returned value from getString(). I do have one quick question. You seem to be using the Config from an Element. My problematic Config usage is not within an Element but from a Bean. Could this be where there is a difference in environments?
Take care, Jeremy On 12/15/06, Geert Bevin <[EMAIL PROTECTED]> wrote:
Hi Jeremy, This is very weird since it should just work, and it does here. I changed the Jumpstart's Home element to this: @Elem public class Home extends Element { public void processElement() { Template template = getHtmlTemplate("pub.home"); print(template); } public Class getDeploymentClass() { return HomeDeployer.class; } public static class HomeDeployer extends ElementDeployer { public void deploy() throws EngineException { Config config = Config.getRepInstance(); System.out.println(config.getString("database_name")); } } } ... and the database name is correctly printed out. This is one of the features of the repository, participants should automatically wait for each-other if you obtain them from the repository and they are not finished yet. Since I can't duplicate your behavior here, it's difficult for me to track this down. Just a small question, are you sure that 'config' is null and not one of the config parameters that you obtain? Best regards, Geert On 15 Dec 2006, at 19:42, Jeremy Whitlock wrote: > Geert, > Here is my participants.xml: > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE rep SYSTEM "/dtd/rep.dtd"> > <rep> > <participant param="rep/config.xml">ParticipantConfig</participant> > <participant param="rep/datasources.xml">ParticipantDatasources</ > participant> > <participant param="sites/main.xml">ParticipantSite</participant> > </rep> > > Nothing fancy. > > Take care, > > Jeremy > > On 12/14/06, Geert Bevin <[EMAIL PROTECTED]> wrote: Hmmm, this is > weird, the repository should automatically make the > deployer wait until the configuration participant is available. Could > you please also paste your participants.xml file? I will have to try > to duplicate this locally to trace it. > > On 13 Dec 2006, at 17:41, Jeremy Whitlock wrote: > > > Hi All, > > Here are the code snippets of importance: > > > > ApplicationInitializer.java (This is a Deployer object) > > > ---------------------------------------------------------------------- > > ---- > > @Override > > public void deploy() throws EngineException { > > try { > > cBean = new SACConfigurationBean(); > > > > cBean.initialize (); > > > > bootstrapBundle(); > > bootstrapConfiguration(); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > > > SACConfigurationBean (This is a POJO with an initialize method to > > bootstrap the POJO values) > > > ---------------------------------------------------------------------- > > -------------------------------------------------------------------- > > public void initialize() { > > Config config = Config.getRepInstance(); > > > > setSacDataRoot(new File(config.getString > > ("SAC.DATA.ROOT")).getAbsolutePath()); // Error happens here > > because config is null > > setSacLogRoot(new File(config.getString > > ("SAC.LOG.ROOT")).getAbsolutePath()); > > setSvnRepoRoot(new File(config.getString > > ("SVN.REPO.ROOT ")).getAbsolutePath()); > > } > > > > What happens is the Deployer Element is calling the > > SACConfigurationBean().initialize() during the > > ApplicationInitializer's deploy() method. Based on the log output > > and stack trace, I think that the site is not fully initialized so > > my Config.getRepInstance() is returning a null and all use of the > > Config object result in an NPE. Did I do something wrong? I would > > think that a Deployer would run after the Site was initialized, or > > at least it would have access to the Site objects like the Config. > > > > Take care, > > > > Jeremy > > > > On 12/13/06, Geert Bevin < [EMAIL PROTECTED]> wrote: I think that your > > problem is that the site structure is being > > initialized before the configuration participant. > > > > Can you please paste the code where the NullPointerException > happens? > > > > On 12 Dec 2006, at 19:58, Jeremy Whitlock wrote: > > > > > Hi All, > > > I am using a Deployer to do some staging of my > application. To > > > do this, I would like to use Config.getRepInstance () but I have > > > found out that the repository instance is not available, resulting > > > in a null pointer. How can I get access to the config.xml > > > reference before the repository instance is fully initialized? > > > Based on the log output, the config is the first thing > instantiated: > > > > > > INFO: INITIALIZATION : Creating the config object ... > > > Dec 12, 2006 11:50:47 AM com.uwyn.rife.rep.BlockingRepository > > > runParticipants > > > INFO: INITIALIZATION : Creating the datasources object ... > > > Dec 12, 2006 11:50:47 AM com.uwyn.rife.rep.BlockingRepository > > > runParticipants > > > INFO: INITIALIZATION : Creating web application's site > structure ... > > > 2006-12-12 11:50:48.396::INFO: Started SelectChannelConnector @ > > > 0.0.0.0:8080 > > > [INFO] Started Jetty Server > > > null > > > java.lang.NullPointerException > > > at > > > net.collab.extranet.sac.beans.SACConfigurationBean.initialize > > > (SACConfigurationBean.java:30) > > > at net.collab.extranet.sac.elements.ApplicationInitializer > > > $Deployer.deploy(ApplicationInitializer.java:31) > > > at com.uwyn.rife.engine.ElementInfo.deploy > > (ElementInfo.java: > > > 280) > > > at com.uwyn.rife.engine.SiteBuilder.setupElements > > > (SiteBuilder.java:984) > > > at com.uwyn.rife.engine.SiteBuilder.setupData > > > (SiteBuilder.java:1618) > > > at com.uwyn.rife.engine.SiteBuilder.finish > > > (SiteBuilder.java :261) > > > at com.uwyn.rife.engine.SiteBuilder.process > > > (SiteBuilder.java:252) > > > at com.uwyn.rife.engine.SiteBuilder.getSite > > > (SiteBuilder.java:178) > > > at > > > com.uwyn.rife.rep.participants.ParticipantSite.initialize > > > (ParticipantSite.java:36) > > > at com.uwyn.rife.rep.BlockingParticipant.run > > > ( BlockingParticipant.java:252) > > > at java.lang.Thread.run(Thread.java:595) > > > > > > Take care, > > > > > > Jeremy > > > _______________________________________________ > > > Rife-users mailing list > > > Rife-users@uwyn.com > > > http://lists.uwyn.com/mailman/listinfo/rife-users > > > > -- > > Geert Bevin > > Uwyn "Use what you need" - http://uwyn.com > > RIFE Java application framework - http://rifers.org > > Music and words - http://gbevin.com > > > > > > _______________________________________________ > > Rife-users mailing list > > Rife-users@uwyn.com > > http://lists.uwyn.com/mailman/listinfo/rife-users > > > > _______________________________________________ > > Rife-users mailing list > > Rife-users@uwyn.com > > http://lists.uwyn.com/mailman/listinfo/rife-users > > -- > Geert Bevin > Uwyn "Use what you need" - http://uwyn.com > RIFE Java application framework - http://rifers.org > Music and words - http://gbevin.com > > > _______________________________________________ > Rife-users mailing list > Rife-users@uwyn.com > http://lists.uwyn.com/mailman/listinfo/rife-users > > _______________________________________________ > Rife-users mailing list > Rife-users@uwyn.com > http://lists.uwyn.com/mailman/listinfo/rife-users -- Geert Bevin Uwyn "Use what you need" - http://uwyn.com RIFE Java application framework - http://rifers.org Music and words - http://gbevin.com _______________________________________________ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users
_______________________________________________ Rife-users mailing list Rife-users@uwyn.com http://lists.uwyn.com/mailman/listinfo/rife-users