-
1. Re: Disabling envers in jboss 7.0.2 / hib 4?
adamw Oct 24, 2011 5:23 AM (in response to mark4)But you do have classes annotated with @Audited? Because only then Envers should get activated.
Adam -
2. Re: Disabling envers in jboss 7.0.2 / hib 4?
mark4 Oct 24, 2011 5:43 AM (in response to adamw)I don't have any @Audited classes in my war, and the old-style envers config is absent from persistence.xml.
Mark
-
3. Re: Disabling envers in jboss 7.0.2 / hib 4?
egaga Oct 24, 2011 7:02 AM (in response to mark4)We have the same problem. We have no need for Envers, neither do we use any @Audited annotations. Is there other solution other than to downgrade to 7.0.1 or not use validate...?
-
4. Re: Disabling envers in jboss 7.0.2 / hib 4?
adamw Oct 25, 2011 2:43 AM (in response to egaga)That's quire weird. Can you try breakpointing at org.hibernate.envers.configuration.EntitiesConfigurator:128:
if (classesAuditingData.getAllClassAuditedData().size() > 0) {
to see what are the audited entities?
Adam
-
5. Re: Disabling envers in jboss 7.0.2 / hib 4?
jaikiran Oct 25, 2011 3:03 AM (in response to mark4)Also please post that stacktrace about the missing table. That might give us a clue on what triggers Envers.
-
6. Re: Disabling envers in jboss 7.0.2 / hib 4?
egaga Oct 25, 2011 5:39 AM (in response to jaikiran)12:35:26,341 INFO [java.sql.DatabaseMetaData] (MSC service thread 1-8) HHH00262:Table not found: REVINFO
12:35:26,344 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.persistenceunit."foobar.war#primary": org.jboss.msc.service.StartException in s
ervice jboss.persistenceunit."foobar.war#primary": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_13]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_13]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: primary] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:908)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:143)
at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:77)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
Caused by: org.hibernate.HibernateException: Missing table: REVINFO
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1263)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:446)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
... 9 more
-
7. Re: Disabling envers in jboss 7.0.2 / hib 4?
tschleuss Oct 27, 2011 11:58 AM (in response to egaga)Same here, my persistence.xml have only "validate" on "hibernate.hbm2ddl.auto" e i got the same exception
aused by: org.hibernate.HibernateException: Missing table: REVINFO
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1263)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:446)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
I'm use Jboss AS 7.0.2.Final with Hibernate 4, on a project
with Jboss Seam 3.1.0.Beta4
I don't have classes with @Audit, i'm try to use a existent database with a new aplication,
but hibernate try do force me to create this table, but i can't.
-
8. Re: Disabling envers in jboss 7.0.2 / hib 4?
adamw Oct 27, 2011 12:16 PM (in response to tschleuss)What about breakpointing at org.hibernate.envers.configuration.EntitiesConfigurator:128:
if (classesAuditingData.getAllClassAuditedData().size() > 0) {
and looking at what classes Envers thinks are audited?
Adam
-
9. Re: Disabling envers in jboss 7.0.2 / hib 4?
tschleuss Oct 28, 2011 7:17 AM (in response to adamw)Hi, thanks for fast reply.
I never had hibernate-envers dependecy on my project, but
i included her to debug. I saw, there's one of my classes that he catch:
[org.hibernate.mapping.RootClass(br.com.tiny.model.entity.Question)=org.hibernate.envers.configuration.metadata.reader.ClassAuditingData@12ce7c6]
But my class Question, don't have anything that reffer Envers:
package br.com.tiny.model.entity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* Entity of questions
* @since 0.0.1
*/
@Entity
@Table(name = "question")
@IdClass(QuestionPK.class)
public class Question extends AbstractEntity {
/**
* Default serial.
*/
private static final long serialVersionUID = 1L;
@Id
@Column(name = "id_transaction")
private Integer idTransaction;
@Id
@Column(name = "nr_seq")
private Integer nrSeq;
@Column(name = "fl_accepted")
private Integer flAccepted;
@Column(name = "dt_access")
@Temporal(TemporalType.TIMESTAMP)
private Date accessDate;
/**
* Default constructor.
*/
public Question() {
super();
}
/** gets and sets and hashcode and equals impl **/
}
Its a simple entity with compose-id.
what could be?
-
10. Re: Disabling envers in jboss 7.0.2 / hib 4?
tschleuss Oct 27, 2011 3:04 PM (in response to tschleuss)I debuger a little longer here, maybe i'm wrong, but in this method on hibernate-envers project:
private void addAuditTable(XClass clazz) {
AuditTable auditTable = clazz.getAnnotation(AuditTable.class);
if (auditTable != null) {
auditData.setAuditTable(auditTable);
} else {
auditData.setAuditTable(getDefaultAuditTable());
}
}
it will be always get as an audit table.
and with this, it will always enter on this method:
public void addClassAuditingData(PersistentClass pc, ClassAuditingData cad) {
entityNameToAuditingData.put(pc.getEntityName(), cad);
persistentClassToAuditingData.put(pc, cad);
}
Finally, the method
classesAuditingData.getAllClassAuditedData()
caled on EntitiesConfigurator will always return
this class. I have only this entity on projet now, but
iguess if you add another, shall all be considered.
-
11. Re: Disabling envers in jboss 7.0.2 / hib 4?
stianst Oct 28, 2011 10:43 AM (in response to mark4)I had the same issue with an app that uses Hibernate directly (no JPA yet), I solved the problem by adding the property "hibernate.listeners.envers.autoRegister=false" to my hibernate.cfg.xml. Not sure if it will work with JPA, but worth a try.
-
12. Re: Disabling envers in jboss 7.0.2 / hib 4?
adamw Oct 29, 2011 7:23 AM (in response to stianst)Yes, this should work with JPA as well. A very good workaround
Adam
-
13. Re: Disabling envers in jboss 7.0.2 / hib 4?
adamw Oct 29, 2011 7:24 AM (in response to tschleuss)I found the cause and I'll commit a fix shortly, see https://hibernate.onjira.com/browse/HHH-6784.
I'm very sorry for the trouble this caused and thanks a lot for debugging the problem!
Adam
-
14. Re: Disabling envers in jboss 7.0.2 / hib 4?
tschleuss Oct 31, 2011 1:02 PM (in response to adamw)Thanks for the fix !!
I am not the author of this topic, but to me he's answered!