[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3708?page=c...
]
Adam Warski resolved HHH-3708.
------------------------------
Assignee: Adam Warski
Resolution: Fixed
Fix Version/s: 3.5
Suboptimal exception on m:n relations with an unaudited entity
--------------------------------------------------------------
Key: HHH-3708
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3708
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1, Envers 3.4-Snapshot, Java 6, Spring 2.5
Reporter: Eike Hirsch
Assignee: Adam Warski
Priority: Minor
Fix For: 3.5
The following code will produce a NullPointerException on listener startup when **B** is
not audited. The exception should state that there is an audited collection to an
unaudited entity. (And for debugging it would be really cool to log both entity class
names)
{code}
@ManyToMany( cascade= {CascadeType.ALL} )
public List<B> getBs() {
return bs;
}
{code}
As described in
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=148392.
{code}
2009-01-09 16:46:11.872::WARN: Nested in
org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name 'sessionFactory' defined in ServletContext resource
[/WEB-INF/applicati
onContext.xml]: Invocation of init method failed; nested exception is
org.hibernate.HibernateExcepti
on: could not init listeners:
java.lang.NullPointerException
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addValueToMiddleTable(Co
llectionMetadataGenerator.java:380)
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addWithMiddleTable(Colle
ctionMetadataGenerator.java:303)
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(Collection
MetadataGenerator.java:152)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerat
or.java:136)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGe
nerator.java:155)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetad
ataGenerator.java:343)
at
org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:96)
at
org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
at
org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
at
org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:232)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
at
org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactory
Bean.java:814)
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFacto
ryBean.java:732)
at
org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSession
FactoryBean.java:211)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(A
bstractAutowireCapableBeanFactory.java:1369)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(Abst
ractAutowireCapableBeanFactory.java:1335)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(Abstra
ctAutowireCapableBeanFactory.java:473)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutow
ireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abstract
AutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.ja
va:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingl
etonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java
:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:1
85)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:1
64)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(De
faultListableBeanFactory.java:423)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(A
bstractApplicationContext.java:728)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContex
t.java:380)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255
)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.j
ava:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
at
org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:220)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:345)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:286)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:204)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:183)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycl
eExecutor.java:498)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycl
eExecutor.java:265)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor
.java:191)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira