Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with Grails Searchable plugin, start-up error #4

Open
vahidpaz opened this issue Jan 11, 2014 · 4 comments
Open

Conflict with Grails Searchable plugin, start-up error #4

vahidpaz opened this issue Jan 11, 2014 · 4 comments

Comments

@vahidpaz
Copy link

My Grails app does not start-up if I have the Grails Searchable plugin enabled, version 0.6.6. Error:

2014-01-10 17:00:55,905 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: com.sun.proxy.$Proxy49 cannot be cast to org.hibernate.impl.SessionFactoryImpl
Message: com.sun.proxy.$Proxy49 cannot be cast to org.hibernate.impl.SessionFactoryImpl
    Line | Method
->>   95 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|     46 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityCollectionLifecycleInjector
|    147 | doStart . . . . in org.compass.gps.device.hibernate.HibernateGpsDevice
|    124 | start           in org.compass.gps.device.AbstractGpsDevice
|     73 | start . . . . . in org.compass.gps.device.support.parallel.AbstractParallelGpsDevice
|    166 | start           in org.compass.gps.impl.AbstractCompassGps
|    149 | doCall . . . .  in SearchableGrailsPlugin$_closure3
|    262 | run             in java.util.concurrent.FutureTask
|   1145 | runWorker . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run             in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . . . . in java.lang.Thread

tags: compass, lucene

@jalessandro
Copy link
Member

@vahidpaz I've installed both plugins, but I didn't see any errors when starting my app.

@vahidpaz
Copy link
Author

vahidpaz commented Mar 5, 2014

@jalessandro That's strange because I just reproduced it again right now (more debug output below). I'm using Grails 2.3.6 and still at Searchable 0.6.6.

I temporarily went into Logical Delete and removed the dependency on hibernate-hijacker, and then I could successfully load both Searchable and Logical Delete in my Grails app. Obviously I had to modify DeleteHibernateFilterConfigurator.java temporarily so that it would not extend HibernateConfigPostProcessor, thus making Logical Delete unusable, but the point was to find out what's going on. So my conclusion is a conflict between Searchable and Hibernate Hijacker.

My error stack points out line 95. I think the code looks something like this: http://grepcode.com/file/repo1.maven.org/maven2/com.github.lhanson/compass/2.2.2-ldh/org/compass/gps/device/hibernate/lifecycle/DefaultHibernateEntityLifecycleInjector.java#95

It looks like Hijacker uses WrappedSessionFactoryBean.buildSessionFactory() to wrap the real factory with its own proxy, while Compass is expecting the SessionFactoryImpl concrete type.

Should we contact the Compass developers and see if they can use the org.hibernate.SessionFactory interface rather than a concrete type?

2014-03-04 18:19:04,825 [localhost-startStop-1] INFO  config.ConsumerAnnotationReader  - Subscribing hibernate.sessionCreated to deleteHibernateFilterEnabler, method enableDeleteHibernateFilter
| Error 2014-03-04 18:19:04,918 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: com.sun.proxy.$Proxy44 cannot be cast to org.hibernate.impl.SessionFactoryImpl
Message: com.sun.proxy.$Proxy44 cannot be cast to org.hibernate.impl.SessionFactoryImpl
    Line | Method
->>   95 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|     46 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityCollectionLifecycleInjector
|    147 | doStart . . . . in org.compass.gps.device.hibernate.HibernateGpsDevice
|    124 | start           in org.compass.gps.device.AbstractGpsDevice
|     73 | start . . . . . in org.compass.gps.device.support.parallel.AbstractParallelGpsDevice
|    166 | start           in org.compass.gps.impl.AbstractCompassGps
|    151 | doCall . . . .  in SearchableGrailsPlugin$_closure3
|    262 | run             in java.util.concurrent.FutureTask
|   1145 | runWorker . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run             in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . . . . in java.lang.Thread
2014-03-04 18:19:04,952 [Thread-13] INFO  impl.DefaultCompass  - Closing Compass [default]
2014-03-04 18:19:04,958 [Thread-13] INFO  impl.DefaultCompass  - Closed Compass [default]
2014-03-04 18:19:05,069 [Thread-14] INFO  hibernate.WrappedSessionFactoryBean  - Closing Hibernate SessionFactory

@carlosorrego
Copy link

i get thwe same error in grails 2.4.2

@luchovelez
Copy link

Switching back to the:

runtime ":hibernate:3.6.10.17"
and changing

cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
in the DataSource.groovy resolves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants