java.lang.Exception: Setting PreUpdateEventListeners

Hibernate JIRA | Nigel White | 1 decade ago
  1. 0

    I'm using EJB3/hibernate in JBoss. I have the following line in persistence.xml: <property name="hibernate.ejb.cfgfile" value="hibernate_config.xml"/> In hibernate_config.xml, I set up event handlers: <event type="pre-update"> <listener class="com.fcl.util.HibernateEventListener"/> </event> <event type="post-commit-update"> <listener class="com.fcl.util.HibernateEventListener"/> <listener class="org.hibernate.lucene.event.LuceneEventListener"/> </event> <event type="post-commit-insert"> <listener class="com.fcl.util.HibernateEventListener"/> <listener class="org.hibernate.lucene.event.LuceneEventListener"/> </event> <event type="post-commit-delete"> <listener class="com.fcl.util.HibernateEventListener"/> <listener class="org.hibernate.lucene.event.LuceneEventListener"/> </event> My own code is in com.fcl.util.HibernateEventListener. The 3 post-whatever events are being fired, and I can see my Lucene indices. My event listener, the com.fcl.util.HibernateEventListener is not called. After some investigation, I put debug statements to display a stack trace into org.hibernate.event.EventListeners.setPreUpdateEventListeners(PreUpdateEventListener[] preUpdateEventListener) From this, I discovered that the configuration setup on app deployment is configuring the SessionFactory twice. 16:54:16,015 INFO [Configuration] configuring from resource: hibernate_config.xml 16:54:16,015 INFO [Configuration] Configuration resource: hibernate_config.xml 16:54:16,031 INFO [STDOUT] java.lang.Exception: Setting PreUpdateEventListeners 16:54:16,031 INFO [STDOUT] at org.hibernate.event.EventListeners.setPreUpdateEventListeners(EventListeners.java:418) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1661) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1493) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.parseEvent(Configuration.java:1469) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1401) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1363) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1339) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.configure(Configuration.java:1259) 16:54:16,031 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:378) 16:54:16,031 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:20 2) 16:54:16,062 INFO [STDOUT] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.j ava:78) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34) and then, a few milliseconds later: 16:54:16,171 INFO [STDOUT] java.lang.Exception: Setting PreUpdateEventListeners 16:54:16,171 INFO [STDOUT] at org.hibernate.event.EventListeners.setPreUpdateEventListeners(EventListeners.java:418) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:124) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:473) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:20 2) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.j ava:78) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34) 16:54:16,171 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245) 16:54:16,171 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:228) 16:54:16,171 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:54:16,171 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 16:54:16,171 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 16:54:16,171 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) 16:54:16,171 INFO [STDOUT] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943) It's configuring once from my XML configuration file, and then it does its own configuration where it sets the pre update listener to be a org.hibernate.validator.event.ValidateEventListener The problem is that the org.hibernate.event.EventListeners class only has a method for [b]setting the entire stack[/b] of listeners. OK, you can get the array, create a new one, copy the old one, add yours, and set it, but the org.hibernate.ejb.EventListenerConfigurator doesn't do that, it just uses what's available and stomps over user-specified listeners. Surely, like most event handling patterns there should be an addBlahEventListener() call in org.hibernate.event.EventListeners? Either that or org.hibernate.ejb.EventListenerConfigurator should get the handler array, copy it to a new array, and [b]add[/b] it's own listener at the start or end of the array. I have attached the necessary files in zip archives. You will need to get the provided org.hibernate.event.EventListeners class (with the stacktrace display) into the classpath ahead of the original one, so put aamyhibernate.jar into the server/default/lib directory and restart. You don't event need an actual entity bean to see this, just deploy testcase.par. This just displays a stack trace whenever PostUpdateEventListeners are set. I've just deployed it, and it displays the stack trace [b]three times![/b]

    Hibernate JIRA | 1 decade ago | Nigel White
    java.lang.Exception: Setting PreUpdateEventListeners
  2. 0

    I'm using EJB3/hibernate in JBoss. I have the following line in persistence.xml: <property name="hibernate.ejb.cfgfile" value="hibernate_config.xml"/> In hibernate_config.xml, I set up event handlers: <event type="pre-update"> <listener class="com.fcl.util.HibernateEventListener"/> </event> <event type="post-commit-update"> <listener class="com.fcl.util.HibernateEventListener"/> <listener class="org.hibernate.lucene.event.LuceneEventListener"/> </event> <event type="post-commit-insert"> <listener class="com.fcl.util.HibernateEventListener"/> <listener class="org.hibernate.lucene.event.LuceneEventListener"/> </event> <event type="post-commit-delete"> <listener class="com.fcl.util.HibernateEventListener"/> <listener class="org.hibernate.lucene.event.LuceneEventListener"/> </event> My own code is in com.fcl.util.HibernateEventListener. The 3 post-whatever events are being fired, and I can see my Lucene indices. My event listener, the com.fcl.util.HibernateEventListener is not called. After some investigation, I put debug statements to display a stack trace into org.hibernate.event.EventListeners.setPreUpdateEventListeners(PreUpdateEventListener[] preUpdateEventListener) From this, I discovered that the configuration setup on app deployment is configuring the SessionFactory twice. 16:54:16,015 INFO [Configuration] configuring from resource: hibernate_config.xml 16:54:16,015 INFO [Configuration] Configuration resource: hibernate_config.xml 16:54:16,031 INFO [STDOUT] java.lang.Exception: Setting PreUpdateEventListeners 16:54:16,031 INFO [STDOUT] at org.hibernate.event.EventListeners.setPreUpdateEventListeners(EventListeners.java:418) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1661) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.setListeners(Configuration.java:1493) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.parseEvent(Configuration.java:1469) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1401) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1363) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1339) 16:54:16,031 INFO [STDOUT] at org.hibernate.cfg.Configuration.configure(Configuration.java:1259) 16:54:16,031 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:378) 16:54:16,031 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:20 2) 16:54:16,062 INFO [STDOUT] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.j ava:78) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230) 16:54:16,062 INFO [STDOUT] at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34) and then, a few milliseconds later: 16:54:16,171 INFO [STDOUT] java.lang.Exception: Setting PreUpdateEventListeners 16:54:16,171 INFO [STDOUT] at org.hibernate.event.EventListeners.setPreUpdateEventListeners(EventListeners.java:418) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:124) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:473) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:20 2) 16:54:16,171 INFO [STDOUT] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.j ava:78) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230) 16:54:16,171 INFO [STDOUT] at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34) 16:54:16,171 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245) 16:54:16,171 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:228) 16:54:16,171 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:54:16,171 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 16:54:16,171 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 16:54:16,171 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) 16:54:16,171 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) 16:54:16,171 INFO [STDOUT] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943) It's configuring once from my XML configuration file, and then it does its own configuration where it sets the pre update listener to be a org.hibernate.validator.event.ValidateEventListener The problem is that the org.hibernate.event.EventListeners class only has a method for [b]setting the entire stack[/b] of listeners. OK, you can get the array, create a new one, copy the old one, add yours, and set it, but the org.hibernate.ejb.EventListenerConfigurator doesn't do that, it just uses what's available and stomps over user-specified listeners. Surely, like most event handling patterns there should be an addBlahEventListener() call in org.hibernate.event.EventListeners? Either that or org.hibernate.ejb.EventListenerConfigurator should get the handler array, copy it to a new array, and [b]add[/b] it's own listener at the start or end of the array. I have attached the necessary files in zip archives. You will need to get the provided org.hibernate.event.EventListeners class (with the stacktrace display) into the classpath ahead of the original one, so put aamyhibernate.jar into the server/default/lib directory and restart. You don't event need an actual entity bean to see this, just deploy testcase.par. This just displays a stack trace whenever PostUpdateEventListeners are set. I've just deployed it, and it displays the stack trace [b]three times![/b]

    Hibernate JIRA | 1 decade ago | Nigel White
    java.lang.Exception: Setting PreUpdateEventListeners
  3. 0

    Debugger "String is null" error when hitting breakpoint

    GitHub | 2 years ago | shiffman
    java.lang.Exception: setting notice to Debugger halted.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    blendMode not retained, must be reset every frame

    GitHub | 3 years ago | RectangleWorld
    java.lang.Exception: setting blend mode to 1
  6. 0

    Bridge already registered when using two managed servers

    Oracle Community | 1 decade ago | 666705
    java.lang.Exception: javax.resource.ResourceException: Error setting message listener

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.Exception

      Setting PreUpdateEventListeners

      at org.hibernate.event.EventListeners.setPreUpdateEventListeners()
    2. Hibernate
      EventListeners.setPreUpdateEventListeners
      1. org.hibernate.event.EventListeners.setPreUpdateEventListeners(EventListeners.java:418)
      1 frame
    3. Hibernate
      Configuration.configure
      1. org.hibernate.cfg.Configuration.setListeners(Configuration.java:1661)
      2. org.hibernate.cfg.Configuration.setListeners(Configuration.java:1493)
      3. org.hibernate.cfg.Configuration.parseEvent(Configuration.java:1469)
      4. org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1401)
      5. org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1363)
      6. org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1339)
      7. org.hibernate.cfg.Configuration.configure(Configuration.java:1259)
      7 frames
    4. Hibernate EJB
      HibernatePersistence.createContainerEntityManagerFactory
      1. org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:378)
      2. org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:202)
      3. org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:78)
      3 frames
    5. org.jboss.ejb3
      Ejb3Module.createService
      1. org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512)
      2. org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253)
      3. org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230)
      4. org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
      4 frames