I have been able to use the test case to test the DataSourceSelector
component in isolation and that call to select works but in the context
of my application I still get an error.
I have dug a little further and have found that the NPE comes from
CompositeBlock.invoke..as indicated by the stack trace below.
java.lang.NullPointerException
at
org.apache.avalon.activation.appliance.impl.CompositeBlock$BlockInvocati
onHandler.invoke(CompositeBlock.java:274)
at $Proxy3.select(Unknown Source)
at
com.choreoworks.pep.loader.PEPLoader.testDataSource(PEPLoader.java:367)
at
com.choreoworks.pep.loader.PEPLoader.access$000(PEPLoader.java:85)
at
com.choreoworks.pep.loader.PEPLoader$1.run(PEPLoader.java:186)
The line numbers will not match what is in CVS because I have further
instrumented the code. Basically 'service' is null after the call to
model.getExportDirective hence the call to service.getPath throws the
NPE.
ServiceDirective service =
model.getExportDirective( method.getDeclaringClass() );
String path = service.getPath();
It seems that if, in my block.xml file, I replace the "include"
directive with the corresponding "resource" and "component" elements
everything works dandy.
i.e. this doesn't work for me
<include name="jdbc-manager"
id="cornerstone-datasources:cornerstone-datasources-impl" version="1.0"
/>
but this does work for me (with the associated resources)
<component name="jdbc-manager"
class="org.apache.avalon.cornerstone.blocks.datasources.DefaultDataSourc
eSelector" activation="true" />
Furthermore it seems that I am getting the same problem with components
that are imported through the "include" directive (i.e. thread manager,
socket manage etc). When a call through a proxy is made it fails, as
indicated in the stack trace above.
In summary I can work around the problem by removing all "include"
directives from my block.xml and replacing them with the equivalent xml
fragments. I hope this all makes sense ;-).
Finally, I was wondering whether anyone else has experienced a similar
problem.
cheers
</jima>
> -----Original Message-----
> From: Stephen McConnell [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 21, 2003 9:46 PM
> To: Avalon Developers List
> Subject: Re: [merlin] merlin + datasources
>
>
>
> Jim Alateras wrote:
>
> >>>But when this service executes I get the following error
> >>>
> >>>java.lang.NullPointerException
> >>>
> >>>
> >>>
> >>Umm .. this is a worry - you should not be getting a NPE.
> >>
> >>Any chance you could throw together a testcase?
> >>
> >>
> >>
> >How should I package the test case. Do you want a jar + config +
source
> >so you can execute the block that will show the error
> >
>
> Jim:
>
> I took a more careful look at the stack trace that you initially
> posted. The NPE is being thrown under the select operation - so the
bug
> is down in the DefaultDataSourceSelector. I've just update the
> cornerstone datasources-impl project to include an empty test case.
You
> should be able to use this to establish the NPE condition by modifying
> the config.xml and invoking selection under the test case.
>
> Stephen.
>
> >
> >cheers
> ></jima>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
> --
>
> Stephen J. McConnell
> mailto:[EMAIL PROTECTED]
>
> |------------------------------------------------|
> | Magic by Merlin |
> | Production by Avalon |
> | |
> | http://avalon.apache.org/merlin |
> | http://dpml.net/ |
> |------------------------------------------------|
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]