Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.3.5
-
Component/s: Persistence
-
Labels:None
Description
Since grails 1.3.5, I have the bellow exception if I use DefaultGrailsDomainConfiguration:
org.hibernate.HibernateException: No such filter configured [dynamicFilterEnabler]
The reason is that DefaultGrailsDomainConfiguration doesn't add the filter dynamicFilterEnabler.
if (configClass == null) { try { configClass = cl.loadClass("org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration") } catch (Throwable e) { // probably not Java 5 or missing some annotation jars, use default configClass = DefaultGrailsDomainConfiguration.class; } }
See JIRA 6681 - http://jira.codehaus.org/browse/GRAILS-6681
-
Hide
- GRAILS6807.zip
- 10/Nov/10 10:32 PM
- 348 kB
- Brad Rhoads
-
- GRAILS6807/.classpath 0.7 kB
- GRAILS6807/.project 0.5 kB
- GRAILS6807/.../org.codehaus.groovy.eclipse.preferences.prefs 0.1 kB
- GRAILS6807/application.properties 0.2 kB
- GRAILS6807/grails-app/.../BootStrap.groovy 0.6 kB
- GRAILS6807/grails-app/.../BuildConfig.groovy 1 kB
- GRAILS6807/grails-app/conf/Config.groovy 3 kB
- GRAILS6807/grails-app/.../DataSource.groovy 1.0 kB
- GRAILS6807/grails-app/.../resources.groovy 0.0 kB
- GRAILS6807/grails-app/.../UrlMappings.groovy 0.2 kB
- GRAILS6807/.../CustomerController.groovy 4 kB
- GRAILS6807/.../TransactionsController.groovy 4 kB
- GRAILS6807/grails-app/.../Customer.groovy 0.1 kB
- GRAILS6807/.../Transactions.groovy 0.3 kB
- GRAILS6807/.../messages.properties 3 kB
- GRAILS6807/.../messages_da.properties 3 kB
- GRAILS6807/.../messages_de.properties 4 kB
- GRAILS6807/.../messages_es.properties 3 kB
- GRAILS6807/.../messages_fr.properties 2 kB
- GRAILS6807/.../messages_it.properties 2 kB
- GRAILS6807/.../messages_ja.properties 2 kB
- GRAILS6807/.../messages_nl.properties 3 kB
- GRAILS6807/.../messages_pt_BR.properties 3 kB
- GRAILS6807/.../messages_pt_PT.properties 3 kB
- GRAILS6807/.../messages_ru.properties 4 kB
- GRAILS6807/.../messages_th.properties 5 kB
- GRAILS6807/.../messages_zh_CN.properties 2 kB
- GRAILS6807/grails-app/.../create.gsp 2 kB
- GRAILS6807/grails-app/.../customer/edit.gsp 3 kB
- GRAILS6807/grails-app/.../customer/list.gsp 2 kB
-
Hide
- Grails-6807-bug-report-19112010.zip
- 19/Nov/10 4:45 AM
- 20 kB
- MediaInvest Webteam
-
- grails-app/conf/BootStrap.groovy 0.1 kB
- grails-app/conf/BuildConfig.groovy 1 kB
- grails-app/conf/Config.groovy 4 kB
- grails-app/conf/DataSource.groovy 0.9 kB
- grails-app/conf/UrlMappings.groovy 0.2 kB
- grails-app/conf/spring/resources.groovy 0.0 kB
- grails-app/.../BlockController.groovy 4 kB
- grails-app/domain/Block.groovy 0.3 kB
- grails-app/i18n/messages.properties 3 kB
- grails-app/i18n/messages_da.properties 3 kB
- grails-app/i18n/messages_de.properties 4 kB
- grails-app/i18n/messages_es.properties 3 kB
- grails-app/i18n/messages_fr.properties 2 kB
- grails-app/i18n/messages_it.properties 2 kB
- grails-app/i18n/messages_ja.properties 2 kB
- grails-app/i18n/messages_nl.properties 3 kB
- grails-app/.../messages_pt_BR.properties 3 kB
- grails-app/.../messages_pt_PT.properties 3 kB
- grails-app/i18n/messages_ru.properties 4 kB
- grails-app/i18n/messages_th.properties 5 kB
- grails-app/.../messages_zh_CN.properties 2 kB
- grails-app/views/error.gsp 2 kB
- grails-app/views/index.gsp 4 kB
- grails-app/views/layouts/main.gsp 0.7 kB
- test/unit/.../BlockControllerTests.groovy 0.3 kB
- application.properties 0.2 kB
-
- HibernateFilterAnnotationConfiguration.groovy
- 10/Nov/10 3:00 AM
- 2 kB
- boillod manuel
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
We've also encountered the problem after upgrading to 1.3.5. The error occurs in projects that replace the default configuration class with a special implementation.
In our configuration, the hibernate filters plugin needs a subclassed version of DefaultGrailsDomainConfiguration to manage the filter config. Despite the (misleading?) class name, grails actually seems to use GrailsAnnotationConfiguration as its default configuration class. Graeme's changeset that implements the workaround for http://jira.codehaus.org/browse/GRAILS-6681 contains changes only to GrailsAnnotationConfiguration.
As manuel pointed out correctly, this change needs to be appended to DefaultGrailsDomainConfiguration – override the method buildSessionFactory():
... @Override public SessionFactory buildSessionFactory() throws HibernateException { // work around HHH-2624 addFilterDefinition(new FilterDefinition( "dynamicFilterEnabler","1=1", Collections.emptyMap() )); SessionFactory sessionFactory = super.buildSessionFactory(); return sessionFactory; } ...
I'll admit freely that the fix does look rather simplistic, but it seems to work for us – at least the application starts up correctly.
In our case, we made the change to the plugin-specific Configuration class. That way, we don't have to manage a local grails fork until this is fixed in the official version.
Same problem here with Hibernate Filter plugin installed. Everything has been running smoothly with Grails 1.3.2, but after upgrade to 1.3.5 I get the specified exception.
Thank you for the supplied workaround, overriding buildSessionFactory() in the Hibernate Filter plugin seems to work! Let us know here if you find any problem with the workaround and I will let you know too. This plugin is critical to us and our site's security.
I will also let you know Graeme if I can come up with a simplistic example.
I have the problem too and it's definitely related to the Hibernate Filter plugin. It works fine in 1.3.4, but breaks with this error 1.3.5.
We are having the same issue with Hibernate Filter. As part of the Multi Tenant plugin one of the contributors has developed a Session Hijacker plugin that provides a standard way to interact with the hibernate session. I think there should be a standard manner or plugin for this as many many plugins mess with the session and they seem to be constantly walking on each other. I would like to see this fixed as we need to upgrade to 1.3.5 and 1.3.6 but have to keep the hibernate plugin. If there is a standard work around that would be great too. I imagine other plugins will have this issue as well. The project that has the hijacker is on github
Raising priority to blocker, please can someone provide steps to reproduce.
A join a class which fix the problem for the plugin HibernateFilter. The Hibernate Configuration must use Annotation instead of Domain (like grails).
To use it, just add the following line in DataSource.groovy :
dataSource.configClass = HibernateFilterAnnotationConfiguration.class
I'm not sure how to use this fix.
Currently in my domain class I do:
static hibernateFilters =
{ customerFilter(condition: ':custID = customer_id', types:'long',default:false) }What do I need to change?
Thanks!
Here's an example to recreate the problem. http://jira.codehaus.org/secure/attachment/52146/GRAILS6807.zip
Run the attached app under Grail 1.3.4. Go to the grails6807.transactions controller and verify that two records are displayed, both for customer 2. The bootstrap actually adds 4 records, 2 for customer 1 and 2 for customer 2. This shows the hibrnate filter working correctly.
Then grail upgrade to 1.3.5. and grail run-app and you will get:
org.hibernate.HibernateException: No such filter configured [dynamicFilterEnable
r]
I tried Manuel's work around the sample app as follows:
1. drop HibernateFilterAnnotationConfiguration.groovy in \src\groovy
2. changed datasource.groovy to configClass = HibernateFilterAnnotationConfiguration.class
3. grails run-app
which results in and endless loop of staring/restarting the app:
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Server running. Browse to http://localhost:8080/GRAILS6807
[groovyc] Compiling 1 source file to C:\src\GRAILS6807\target\classes
[groovyc] Compiling 2 source files to C:\src\GRAILS6807\target\classes
[delete] Deleting directory C:\Users\Brad_2\.grails\1.3.5\projects\GRAILS6807
\tomcat
Running Grails application..
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Server running. Browse to http://localhost:8080/GRAILS6807
[groovyc] Compiling 1 source file to C:\src\GRAILS6807\target\classes
[groovyc] Compiling 2 source files to C:\src\GRAILS6807\target\classes
[delete] Deleting directory C:\Users\Brad_2\.grails\1.3.5\projects\GRAILS6807
\tomcat
Running Grails application..
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Server running. Browse to http://localhost:8080/GRAILS6807
[groovyc] Compiling 1 source file to C:\src\GRAILS6807\target\classes
[groovyc] Compiling 2 source files to C:\src\GRAILS6807\target\classes
[delete] Deleting directory C:\Users\Brad_2\.grails\1.3.5\projects\GRAILS6807
\tomcat
Running Grails application..
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Server running. Browse to http://localhost:8080/GRAILS6807
[groovyc] Compiling 1 source file to C:\src\GRAILS6807\target\classes
[groovyc] Compiling 2 source files to C:\src\GRAILS6807\target\classes
[delete] Deleting directory C:\Users\Brad_2\.grails\1.3.5\projects\GRAILS6807
\tomcat
Running Grails application..
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
customer
(id, version, name)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
transactions
(id, version, customer_id, description)
values
(null, ?, ?, ?)
Hibernate:
call identity()
Server running. Browse to http://localhost:8080/GRAILS6807
Application context shutting down...
Application context shutdown.
Terminate batch job (Y/N)? y
C:\src\GRAILS6807>
Brad,
What is you problem exactly ?
I made a new release of HibernateFilterPlugin with HibernateFilterAnnotationConfiguration in directory src/groovy.
When application context shutdown, look at stackstrace.log for the reason.
I'm in the same problem. Is the new release of hibernate filter 0.2 ? But I can't find HibernateFilterAnnotationConfiguration class under src/groovy folder.
It's a "homemade" new release of the plugin. You'll find HibernateFilterAnnotationConfiguration in the attachments of this JIRA.
I've contact the plugin's developper and asked him to release a new version of its plugin.
The same problem. Why it is minor? This is breaking change for 1.3.5!!!