OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | exoplatform List | April 2008 Index

<--  Date Index  --> <--  Thread Index  -->

[exoplatform] Problem instanciating a component via reflection


Hi,

I'm reporting this problem for a friend Michael who has been having
some problems recently instanciating a component from a webapp running
on an exo-tomcat installation (latest community build).

The component passes unit tests run against the StandaloneContainer,
but fails when instanciated from the webapp.

[07 avr. 17:24:12] DEBUG (class Archiver in thread
graphane.diffusion.listener#0) - calling
Archiver.diffuse(Hashtable<String, String> argsHashTable, java.io.File
file)
 java.lang.Exception: PortalContainer.getInstance() returns null
     at com.docxa.corus.jcr.Archiver.getSession(Archiver.java:59)
     at com.docxa.corus.jcr.Archiver.diffuse(Archiver.java:77)
     at 
com.graphane.core.diffusion.listener.ListenerDiffusionComponent.dispatchDocuments(ListenerDiffusionComponent.java:85)
     at 
com.graphane.satellites.diffusion.threadstools.ThreadProcessor.callDispatchDocuments(ThreadProcessor.java:63)
     at 
com.graphane.satellites.diffusion.threadstools.ThreadProcessor.processDiffusion(ThreadProcessor.java:99)
     at 
com.graphane.satellites.diffusion.threadstools.ThreadProcessor.run(ThreadProcessor.java:222)
 [07 avr. 17:24:12] ERROR (class Archiver in thread
graphane.diffusion.listener#0) - Unable to diffuse to JCR
 java.lang.Exception: PortalContainer.getInstance() returns null
     at com.docxa.corus.jcr.Archiver.getSession(Archiver.java:59)
     at com.docxa.corus.jcr.Archiver.diffuse(Archiver.java:77)
     at 
com.graphane.core.diffusion.listener.ListenerDiffusionComponent.dispatchDocuments(ListenerDiffusionComponent.java:85)
     at 
com.graphane.satellites.diffusion.threadstools.ThreadProcessor.callDispatchDocuments(ThreadProcessor.java:63)
     at 
com.graphane.satellites.diffusion.threadstools.ThreadProcessor.processDiffusion(ThreadProcessor.java:99)
     at 
com.graphane.satellites.diffusion.threadstools.ThreadProcessor.run(ThreadProcessor.java:222)


The code that instanciates the component in the webapp is the following:

Class < DiffusionListenerInterface > classToLoad =
                     (Class < DiffusionListenerInterface > )
Class.forName(classNameToRegister);
 Constructor < DiffusionListenerInterface > constructor =
classToLoad.getConstructor();
 DiffusionListenerInterface diffusionListenerToRegister =
constructor.newInstance();


The call to PortalContainer.getInstance() that fails in the component
is the following:

    private Session getSession() throws RepositoryException
    {
        RepositoryService repoService =
(RepositoryService)PortalContainer.getInstance().getComponentInstanceOfType(RepositoryService.class);
        repository = repoService.getCurrentRepository();
        String wsName = 
repository.getConfiguration().getDefaultWorkspaceName();
        return repository.getSystemSession(wsName).getRootNode().getSession();
    }

We are stumped as to why this is happening, maybe some configuration
files missing in the webapp ?  Is there a better way to obtain a JCR
Session for the component ?  Is there a better way to instanciate the
component from the webapp ?

Thanks,

-- 
Luis Arias
+33 6 14 20 87 93
skype : kaaloo


<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.