[EJB 3.0] - Transaction annotation - cannot get desired behavior
by lpmon
JBoss 4.0.5 (em = injected entitymanger in text below)
Need a way to prevent an EntityExistsException from stopping processing (kills DB connection).
Root problem:
In a loop callimg em.persist(obj);
After an EntityExistsException is thrown I get the following trying to continue in the same method.
20:35:40,265 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
20:35:40,265 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=w2ksvr/10, BranchQual=, localId=10]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=w2ksvr/10, BranchQual=, localId=10])
After some reading I found the transaction is marked for rollback due to the exception.
So I moved the persist call into a method that has
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
This does not seem to have any affect. In fact the inserts that are being done in each call to the method (with no exception) are not committed to the DB until to top method in the call stack exits. I though that the REQUIRES_NEW annotation should force the commit of the transaction at the end of the method that it applies to???????
My server call stack is:
session bean-1 calls
session bean-2 method that does DB work
It appears the commit does not occur until the session bean-1 method exits. Ideas? Have I understood how the annotation is supposed to work?
em calls from either bean report 'Cannot open connection' on subsequent em calls
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038581#4038581
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038581
19 years
[JBoss Seam] - Strange Seam/Hibernate MissingResourceException Problem
by nstoddar
Has anybody seen this error popup in their logs? According to the Hibernate, I have compatible JARs, and the properties file is in hibernate-validator like it should ....
hibernate-3.2.2.ga
hibernate-annotations-3.2.1.ga
hibernate-entitymanager-3.2.1.ga
hibernate-validator-3.0.0.GA
[#|2007-04-18T14:22:30.103-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=19;_ThreadName=Thread-44;_RequestID=19bd62fe-51c3-465b-aae9-a8355835fad8;|WebModule[]Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
| javax.persistence.PersistenceException: java.util.MissingResourceException: Can't find bundle for base name org.hibernate.validator.resources.DefaultValidatorMessages, locale en_US
| at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:252)
| at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
| at org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1799)
| at org.jboss.seam.Component.callCreateMethod(Component.java:1739)
| at org.jboss.seam.Component.newInstance(Component.java:1728)
| at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:152)
| at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:126)
| at org.jboss.seam.init.Initialization.init(Initialization.java:430)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
| at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
| at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:662)
| at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1479)
| at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1143)
| at com.sun.enterprise.web.WebContainer.loadJ2EEApplicationWebModules(WebContainer.java:1068)
| at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:128)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:322)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:196)
| at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:633)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:908)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:892)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:445)
| at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
| at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
| at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
| at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
| at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
| at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
| at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
| at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
| at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
| at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
| at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
| at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
| at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
| at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
| at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
| at $Proxy1.invoke(Unknown Source)
| at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
| at com.sun.enterprise.deployment.client.DeploymentClientUtils.startApplication(DeploymentClientUtils.java:133)
| at com.sun.enterprise.deployment.client.DeployAction.run(DeployAction.java:517)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: java.util.MissingResourceException: Can't find bundle for base name org.hibernate.validator.resources.DefaultValidatorMessages, locale en_US
| at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1508)
| at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1262)
| at java.util.ResourceBundle.getBundle(ResourceBundle.java:717)
| at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:129)
| at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:318)
| at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
| at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
| at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
| at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
| at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
| at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
| ... 60 more
| |#]
If I leave out the hibernate-validator JAR, the application loads just fine, but Seam doesn't work properly at runtime. Any help would be wonderful!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038578#4038578
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038578
19 years