Error using annotated module

View: New views
2 Messages — Rating Filter:   Alert me  

Error using annotated module

by Jochen_Z :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello!
 
I'm trying to use the annotated module notation.
 
It works, when I use the following code:
 
AnnotatedRegistryBuilder builder = new AnnotatedRegistryBuilder();
   TypedRegistry registry = builder.constructRegistry(CalculatorModule.class, TestModule.class);
        
Calculator calculator = registry.getService(Calculator.class);
 
Trying the second example from the wiki does not work.
 
RegistryDefinition registryDefinition = new RegistryDefinition();

AnnotatedModuleReader reader = new AnnotatedModuleReader(registryDefinition);
reader.readModule(org.apache.hivemind.SimpleModule.class);

RegistryBuilder builder = new RegistryBuilder(registryDefinition );
Registry registry = builder.constructRegistry();
 
First point:
RegistryDefinition registryDefinition = new RegistryDefinition();
This line does not work, I changed it to
RegistryDefinition registryDefinition = new RegistryDefinitionImpl();
because it says cannot instantiate type RegistryDefinition.
Using this code results in the following error:
 
Exception in thread "main" java.lang.StackOverflowError

at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:130)

at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:130)

at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:130)

I do not use exactly the example code but a little app of my own.
 
Again, the first example works fine, only the second one does not work.
 
Is this an error in the alpha release or am I doing something wrong (with my changed line)?
 
Thanks!!
 
Regards,
Jochen Zimmermann
 
 
 

Re: Error using annotated module

by ahueg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's a bug in alpha-1 which is already fixed for alpha-2.
As workaround call:

Registry registry = builder.constructRegistry(Locale.getDefault())

Achim

Am Tue, 03 Apr 2007 19:48:11 +0200 schrieb Jochen Zimmermann  
<zet4080@...>:

> Hello!
>
> I'm trying to use the annotated module notation.
>
> It works, when I use the following code:
>
> AnnotatedRegistryBuilder builder = new AnnotatedRegistryBuilder();
>    TypedRegistry registry =  
> builder.constructRegistry(CalculatorModule.class, TestModule.class);
> Calculator calculator = registry.getService(Calculator.class);
>
> Trying the second example from the wiki does not work.
>
> RegistryDefinition registryDefinition = new RegistryDefinition();
>
> AnnotatedModuleReader reader = new  
> AnnotatedModuleReader(registryDefinition);
> reader.readModule(org.apache.hivemind.SimpleModule.class);
>
> RegistryBuilder builder = new RegistryBuilder(registryDefinition );
> Registry registry = builder.constructRegistry();
>
> First point:
> RegistryDefinition registryDefinition = new RegistryDefinition();
>
> This line does not work, I changed it to
> RegistryDefinition registryDefinition = new RegistryDefinitionImpl();
> because it says cannot instantiate type RegistryDefinition.
>
> Using this code results in the following error:
>
> Exception in thread "main" java.lang.StackOverflowError
> at  
> org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:130)
>
> at  
> org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:130)
>
> at  
> org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:130)
>
> I do not use exactly the example code but a little app of my own.
>
> Again, the first example works fine, only the second one does not work.
>
> Is this an error in the alpha release or am I doing something wrong  
> (with my changed line)?
>
> Thanks!!
>
> Regards,
> Jochen Zimmermann
>
>