You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Jain, Neeraj" <ne...@wincor-nixdorf.com> on 2004/10/14 12:52:56 UTC

problem in selector in cocoon-2.1.5.1

I am relatively new to the cocoon and have to port an application running in
cocoon-2.1-M1 to 2.1.5.1.
 
The action class looks like :
 
public class AuthenticatorAction extends DatabaseAuthenticatorAction {
 
    ComponentSelector selector = null;
    DataSourceComponent datasource = null;
    
    public Map act(Redirector redirector, SourceResolver resolver,
     Map objectModel, String src, Parameters parameters)
 throws Exception {
 
 Request request = ObjectModelHelper.getRequest(objectModel); 

 setDataSource((DataSourceComponent) selector.select(pool));    ==>> This
gives the NullPointerException.
 Connection conn = datasource.getConnection();
...
...}
 
    public void compose(ComponentManager manager)
     throws org.apache.avalon.framework.component.ComponentException {
        super.compose(manager);
        selector =
            (ComponentSelector) manager.lookup(DataSourceComponent.ROLE +
"Selector");
        this.datasource = (DataSourceComponent) selector.select(pool);
    }

This work well in the existing environment.
    -- Local connection to the database(application and database on the same
system, linux platform).
    -- cocoon-2.1-M1
 
However gives a nullpointerexeption in new environment.
    -- Remote connection, application runs on windows whereas DB(postgres)
is on linux, 
    -- cocoon-2.1.5.1
 
As the cocoon version has changed, the cocoon.xconf, web.xml and
sitemap.xmap are also changed.
 
I guess I have made some mistake in modifying one of the above 3 files,
however I am not able to figure out the root cause. 
Can someone please help me with this.
Thanks.