Jiri,
First some general information;
Configuration of EntityStores are always trickier than configuration
of anything else, and the reason is that the Configuration Composite
is an Entity, and needs to be stored somewhere. Otherwise, you end up
with the ES trying to store config in itself, causing it to initalize
itself, which tries to load and store the inital configuration,
forever...
Typical recommendations;
Layer separation gives you decent visualization of configuration
itself. Suitable with large applications.
- Place all Congfiguration in its own layer, at the bottom. A layer
used by several higher layers.
- Use an EntityStore that requires no configuration, such as PreferencesES.
Module separation, suitable for small to mid sized apps.
- Place the EntityStore configuration in a Module separate from the
EntityStore itself.
- Set visibility of the ConfigurationComposite to "layer".
- Common to use Memory Entity Store, since it is typically
acceptable to have the config of the store reloaded from properties
file on start-up.
It looks like, you have chosen the later approach.
For this particular case, I don't know the internals of the SQL
EntityStore and Indexer, and will let Paul and Stanislav figure this
out. BUT, I think the biggest clue in the stack trace is;
org.qi4j.api.service.importer.ServiceInstanceImporter.importService(ServiceInstanceImporter.java:48)
at $Proxy22.notifyChanges(Unknown Source)
indicating to me that Indexing kicks in on EntityStore configuration
(which it shouldn't), causing Qi4j to import something (why was
importService mechanism chosen, if so) for Indexing, which in turn
wants to use an EntityStore, which will trigger the initialization of
ES and back to storing config that triggers Indexing.
AND I now think that your actual problem is the MemoryEntityStore
inside the Indexing module, and combined with a small bug in the
Indexing code saying that @Queryable(false) for the configuration of
the Indexer.
OR something like that.
Cheers
Niclas
On Sat, Oct 27, 2012 at 12:39 AM, jj <[email protected]> wrote:
> Hello,
>
> I wrote a simple application using In-Memory EntityStore and RdfIndexing.
> Now I want to
> switch over to SQL Index/Store but receive the following exception :
>
> java.lang.IllegalStateException: java.lang.StackOverflowError
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:103)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:56)
> at
> org.qi4j.runtime.service.ServicesInstance.activate(ServicesInstance.java:57)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:78)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:56)
> at
> org.qi4j.runtime.structure.ModuleInstance.activate(ModuleInstance.java:281)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:78)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:56)
> at
> org.qi4j.runtime.structure.LayerInstance.activate(LayerInstance.java:175)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:78)
> at
> org.qi4j.runtime.activation.ActivationDelegate.activate(ActivationDelegate.java:56)
> at
> org.qi4j.runtime.structure.ApplicationInstance.activate(ApplicationInstance.java:121)
> at
> com.somepackage.qi4j.application.abc.bootstrap.AbcApplication.createApplication(AbcApplication.java:63)
> at com.somepackage.qi4j.application.abc.Main.setUp(Main.java:15)
> at com.somepackage.qi4j.application.abc.Main.main(Main.java:47)
> Caused by: java.lang.StackOverflowError
> at java.lang.Long.valueOf(Long.java:554)
> at $Proxy36.newUnitOfWork(Unknown Source)
> at
> org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern.newUnitOfWork(ConcurrentModificationCheckConcern.java:49)
> at
> org.qi4j.entitystore.memory.MemoryEntityStoreService.newUnitOfWork(Unknown
> Source)
> at
> org.qi4j.library.sql.datasource.AbstractDataSourceServiceImporterMixin.getConfiguration(AbstractDataSourceServiceImporterMixin.java:130)
> at
> org.qi4j.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:77)
> at
> org.qi4j.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:1)
> at
> org.qi4j.library.sql.dbcp.DBCPDataSourceServiceImporter.importService(Unknown
> Source)
> at
> org.qi4j.api.service.importer.ServiceInstanceImporter.importService(ServiceInstanceImporter.java:48)
> at $Proxy22.notifyChanges(Unknown Source)
> at
> org.qi4j.spi.entitystore.StateChangeNotificationConcern$1.commit(StateChangeNotificationConcern.java:42)
> at
> org.qi4j.spi.entitystore.ConcurrentModificationCheckConcern$ConcurrentCheckingEntityStoreUnitOfWork$1.commit(ConcurrentModificationCheckConcern.java:103)
> at
> org.qi4j.library.sql.datasource.AbstractDataSourceServiceImporterMixin.getConfiguration(AbstractDataSourceServiceImporterMixin.java:154)
> at
> org.qi4j.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:77)
> at
> org.qi4j.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:1)
> at
> org.qi4j.library.sql.dbcp.DBCPDataSourceServiceImporter.importService(Unknown
> Source)
> at
> org.qi4j.api.service.importer.ServiceInstanceImporter.importService(ServiceInstanceImporter.java:48)
> at $Proxy22.notifyChanges(Unknown Source)
>
> Looks like as a endless loop, but I;m not able to figure out the reason.
> Here also the assembly code
> that produce the above exception.
>
> private void assembleInfrastructureLayer( LayerAssembly
> infrastructureLayer )
> throws AssemblyException
> {
>
> // 1.) SQL Indexing
> ModuleAssembly indexingModule = infrastructureLayer.module(
> "INFRASTRUCTURE-Indexing" );
> indexingModule
> .objects(
> EntityStateSerializer.class,
> EntityTypeSerializer.class );
>
>
> ModuleAssembly config = indexingModule.layer().module( "config"
> );
> config.services( MemoryEntityStoreService.class ).visibleIn(
> Visibility.module );
>
> // EntityStore
> indexingModule.services( MemoryEntityStoreService.class,
> UuidIdentityGeneratorService.class ).visibleIn( Visibility.application );
>
> // DataSourceService + Index/Query's DataSource
> new DBCPDataSourceServiceAssembler(
> "datasource-service-postgres",
> Visibility.module,
> config,
> Visibility.layer ).assemble(
> indexingModule );
> DataSourceAssembler dsAssembler = new DataSourceAssembler(
> "datasource-service-postgres",
>
> "datasource-postgres",
>
> Visibility.module,
>
> DataSources.newDataSourceCircuitBreaker() );
>
> // Index/Query
> new PostgreSQLAssembler( Visibility.application, dsAssembler
> ).assemble( indexingModule );
> config.entities( SQLConfiguration.class ).visibleIn(
> Visibility.layer );
>
> // Always re-index because of possible different app structure
> of multiple tests.
> indexingModule.services(
> ReindexingStrategy.ReindexingStrategyService.class ).withMixins(
> ReindexingStrategy.AlwaysNeed.class ).identifiedBy( "reindexer" );
> config.entities( ReindexerConfiguration.class ).visibleIn(
> Visibility.layer );
>
> // 2.) In-memory Entity Store
> ModuleAssembly entityStoreModule = infrastructureLayer.module(
> "INFRASTRUCTURE-EntityStore" );
> entityStoreModule
> .services(
> MemoryEntityStoreService.class,
> UuidIdentityGeneratorService.class )
> .instantiateOnStartup()
> .visibleIn( application );
>
> }
>
>
> I try already many combinations - without success. Would be great if one of
> you guys
> can give me an idea what is wrong with my code.
>
> Thanks,
>
> Cheers,
> Jiri
>
>
>
>
> --
> View this message in context:
> http://qi4j-dev.23929.n6.nabble.com/SQL-Indexing-SQL-EntityStore-tp7140.html
> Sent from the Qi4j-dev mailing list archive at Nabble.com.
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
--
Niclas Hedhman, Software Developer
河南南路555弄15号1901室。
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev