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

Reply via email to