|
I'm attempting to use Multi-Tenant and Searchable. It appears to be a no-go. The Falcone plugin (a dependency of Multi-Tenant) is replacing the hibernate SessionFactoryImpl with a wrapper class that implements the SessionFactory interface, but the Compass code expects the SessionFactoryImpl and I get the following exception during startup. Adding "def loadAfter = ['searchable']" in the Multi-Tenant plugin didn't help.
java.lang.ClassCastException: com.infusion.util.domain.event.hibernate.InterceptableSessionFactory cannot be cast to org.hibernate.impl.SessionFactoryImpl at org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector.injectLifecycle(DefaultHibernateEntityLifecycleInjector.java:95) at org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityCollectionLifecycleInjector.injectLifecycle(DefaultHibernateEntityCollectionLifecycleInjector.java:46) at org.compass.gps.device.hibernate.HibernateGpsDevice.doStart(HibernateGpsDevice.java:149) at org.compass.gps.device.AbstractGpsDevice.start(AbstractGpsDevice.java:125) at org.compass.gps.device.support.parallel.AbstractParallelGpsDevice.start(AbstractParallelGpsDevice.java:73) at org.compass.gps.impl.AbstractCompassGps.start(AbstractCompassGps.java:166) at SearchableGrailsPlugin$_closure3.doCall(SearchableGrailsPlugin.groovy:144) at grails.web.container.EmbeddableServer$start.call(Unknown Source) Any ideas? Ken |
It turns out that the only reason the Compass code casts the sessionFactory to SessionFactoryImpl is so that it can call the getEventListeners() method which is not declared in any of the interfaces. The Falcone wrapper already provides the getEventListeners() method, so I checked out the Compass code and fixed it such that it now uses reflection if the sessionFactory is not a SessionFactoryImpl. My next problem is that the search indexing code somehow thinks that there is a tenantId property in my searchable domain class, which there is not. I have NOT annotated this class with @MultiTenant. I get the following exception at startup: 2010-01-12 20:31:43,643 ERROR org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer {hibernate}: Failed to index the database org.hibernate.QueryException: could not resolve property: tenantId of: org.yacht_score.member.MemberGroup at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:67) at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:61) at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1402) at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:54) at org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1377) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:457) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumnsUsingProjection(CriteriaQueryTranslator.java:417) at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:68) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:357) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:113) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:82) at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:91) at org.hibernate.impl.SessionImpl.scroll(SessionImpl.java:1550) at org.hibernate.impl.CriteriaImpl.scroll(CriteriaImpl.java:320) at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:118) at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1$1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:105) at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29) at org.compass.core.CompassTemplate.execute(CompassTemplate.java:130) at org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:162) at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1.call(ConcurrentParallelIndexExecutor.java:103) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Any suggestions would be greatly appreciated. Thanks, Ken |
Well, after a tiny bit of hacking in the MultiTenant plugin it appears that I have successfully made the two plugins work in the same grails application. In MultiTenantGrailsPlugin.groovy there is this code (line numbers shown): 117: //Listen for criteria created events 118: hibernate.criteriaCreated("tenantFilter") { 119: CriteriaContext context -> 120: boolean hasAnnotation = TenantUtils.isAnnotated(context.entityClass) 121: if (context.entityClass == null || hasAnnotation) { 122: final Integer tenant = ctx.currentTenant.get(); 123: context.criteria.add(Expression.eq("tenantId", tenant)); 124: } 125: } If I change line 121 as follows, the searchable plugin appears to work (I haven't tested exhaustively, though). 121: if ( /* context.entityClass == null || */ hasAnnotation) { I've got an email out to Eric Martineau, the author of the MultiTenant plugin, asking why the criteria expression is added if the context.entityClass is null. Ken |
|
Hi Ken
I am facing the incompatibly problem b/w searchable and multi-tenant plugin. Have you got any update from Eric Martineau on the code criteria. -- Cheers Prabhu |
|
What is the actual issue? I know both of them modify the datasource on start up. I think this has been addressed in 1.4 with a better approach but I have not looked at it yet. I imagine the only fix is for the two developers to coordinate and modify the datasource in a common way. I will take a look at it if you can give me some indication of what errors you are seeing.
Scott Ryan CTO Denver, Colorado USA (303) 263-3044 On May 18, 2011, at 4:07 AM, prabhuns wrote:
|
|
It is failing in the start-up with below exception (exactly same case happened with ken ) :
2011-05-18 15:56:30,172 [main] [tenant 0] ERROR context.GrailsContextLoader - Error executing bootstraps: com.infusion.util.domain.event.hibernate.InterceptableSessionFactory cannot be cast to org.hibernate.impl.SessionFactoryImpl java.lang.ClassCastException: com.infusion.util.domain.event.hibernate.InterceptableSessionFactory cannot be cast to org.hibernate.impl.SessionFactoryImpl at org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector.injectLifecycle(DefaultHibernateEntityLifecycleInjector.java:95) at org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityCollectionLifecycleInjector.injectLifecycle(DefaultHibernateEntityCollectionLifecycleInjector.java:46) at org.compass.gps.device.hibernate.HibernateGpsDevice.doStart(HibernateGpsDevice.java:149) at org.compass.gps.device.AbstractGpsDevice.start(AbstractGpsDevice.java:125) at org.compass.gps.device.support.parallel.AbstractParallelGpsDevice.start(AbstractParallelGpsDevice.java:73) at org.compass.gps.impl.AbstractCompassGps.start(AbstractCompassGps.java:166) at org.compass.gps.CompassGps$start.call(Unknown Source) at SearchableGrailsPlugin$_closure3.doCall(SearchableGrailsPlugin.groovy:144) at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212) at grails.web.container.EmbeddableServer$start.call(Unknown Source) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149) at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116) at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59) at RunApp$_run_closure1.doCall(RunApp.groovy:33) at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:427) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:415) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.executeTargets(Gant.groovy:590) at gant.Gant.executeTargets(Gant.groovy:589) Thanks Prabhu |
|
In reply to this post by scryan
I've heard people report a ClassCastException that happens somewhere in the Compass code. This is likely caused by an explicit cast to SessionImpl which will cause things to break (as the MT plugin replaces the Session instance with an InterceptableSession that doesn't inherit from SessionImpl). At least this is the way things were before the multi-plugin split. Maybe some of the other contributors can chime in on whether this is still the case.
Eric On May 18, 2011, at 6:48 AM, Scott Ryan wrote:
|
|
Hi,
I am using multi-tenant-core 1.0.3 and still have the problem with the class cast in the compass code. I think I will give Lucene spring modules a try now although this might be probably a bit old fashioned?
|
|
In reply to this post by prabhuns
Hi,
are there some news regarding this problem? Is there any jira I can vote on to solve this? Or any kind of help needed? best sebastian Am 18.05.2011 12:07, schrieb prabhuns: > Hi Ken > > I am facing the incompatibly problem b/w searchable and multi-tenant plugin. > Have you got any update from Eric Martineau on the code criteria. > > -- > Cheers > Prabhu > > -- > View this message in context: http://grails.1312388.n4.nabble.com/Plugin-Incompatibility-Multi-Tenant-Searchable-tp1354534p3532186.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > -- Geschäftsführer (CEO) Shopotainment by Haiku Internet GmbH Schlegelstraße 26 10115 Berlin Tel.: +49 30 868702020 Fax: +49 30 57708224 Mobil: +49 179 7923088 E-Mail: [hidden email] http://www.shopotainment.de http://facebook.com/shopotainment http://twitter.com/shopotainment Handelsregister: HRB 126354 B Amtsgericht Berlin-Charlottenburg Geschäftsführung: Adrian Haß, Sebastian Kurt --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi Sebastian,
creating a HibernateExtractor which implements the org.compass.gps.device.hibernate.NativeHibernateExtractor Interface and a little adjustment in FalconeUtilPlugin helped. It is the solution of pdanielsen. I found it in this thread: http://grails.1312388.n4.nabble.com/Compilation-failed-after-installing-falcone-util-plugin-td1754560.html Best, Erik On 08.10.11 15:19, Sebastian Kurt wrote: > Hi, > are there some news regarding this problem? Is there any jira I can > vote on to solve this? Or any kind of help needed? > > best sebastian > > Am 18.05.2011 12:07, schrieb prabhuns: >> Hi Ken >> >> I am facing the incompatibly problem b/w searchable and multi-tenant >> plugin. >> Have you got any update from Eric Martineau on the code criteria. >> >> -- >> Cheers >> Prabhu >> >> -- >> View this message in context: >> http://grails.1312388.n4.nabble.com/Plugin-Incompatibility-Multi-Tenant-Searchable-tp1354534p3532186.html >> Sent from the Grails - user mailing list archive at Nabble.com. >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | See how NAML generates this page |
