Jan Stary wrote:
> Hi list,
>
> when going through the examples in 'Developing with Avalon'
> I got stuck with $SUBJ. The following jsp page ...
>
> <jsp:useBean id="container" scope="application"
> class="org.apache.bizserver.docs.ContainerComponent"/>
>
> initializing container: <% container.initialize();%> done
>
> ... gives the following result:
>
> java.lang.NullPointerException
> at
>org.apache.avalon.excalibur.component.ExcaliburComponentManager.configure(ExcaliburComponentManager.java:378)
> at
>org.apache.bizserver.docs.ContainerComponent.initialize(ContainerComponent.java:23)
>
> The call actually does
>
> public void initialize() throws Exception {
> DefaultConfigurationBuilder builder = new
> DefaultConfigurationBuilder();
> Configuration sysConfig = builder.buildFromFile(
> "/home/hans/casopis/system.xml");
>
> this.manager.contextualize(new DefaultContext());
> this.manager.configure(sysConfig);
> this.manager.initialize();
> }
The ExcaliburComponentManager is Loggable, and the configure() method uses the logger
that was
supposed to be given to it.
Before contextualize() you should have done this:
this.manager.setLogger( getLogger() );
Of course, that assumes you have already set up your LogKit Logger.
> The evil happens in the configure() call - when commented out,
> it works, except the components are not configured, of course :-)
>
> Could this be due to errors in system.xml? It's copied directly
> from DwAA:
>
> <my-system>
> <component
> role="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
> class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
> <component-instance name="documents"
> class="org.apache.avalon.excalibur.datasource.JdbcDataSource">
> <pool-controller min="5" max="10"/>
> <auto-commit>false</auto-commit>
> <driver>org.mysql.MySqlDriver</driver>
> <dburl>jdbc:mysql:localhost/mydb</dburl>
> <user>test</user>
> <password>test</password>
> </component-instance>
> <component-instance name="security"
> class="org.apache.avalon.excalibur.datasource.JdbcDataSource">
> <pool-controller min="5" max="10"/>
> <auto-commit>false</auto-commit>
> <driver>org.mysql.MySqlDriver</driver>
> <dburl>jdbc:mysql:localhost/myotherdb</dburl>
> <user>test</user>
> <password>test</password>
> </component-instance>
> </component>
> <component
> role="org.apache.bizserver.docs.DocumentRepository"
> class="org.apache.bizserver.docs.DatabaseDocumentRepository">
> <dbpool>documents</dbpool>
> </component>
> <component
> role="org.apache.bizserver.docs.GuardianComponent"
> class="org.apache.bizserver.docs.DocumentGuardianComponent">
> <dbpool>security</dbpool>
> <policy file="/home/system/document.policy"/>
> </component>
> </my-system>
>
> Or is it because something else? I don't expect Excalibur actually
> tests the db connection when parsing the file, so the meaningless
> 'myotherdb' etc should matter.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>