-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
A database error occurs when attempting to create a new user. The following code receives input from an html form and attempts to create the new user account. The error occurs on the last line, during account.performAccountUpdate();.
// Create a new customer
account.performRegister();
account.getLoginInfo().setEmail(email);
account.getLoginInfo().setPassword(password);
// Updates the empty new Customer object created by performRegister.
account.getCustomer().setCustomerID(email);
account.getCustomer().setPassword(password);
account.getCustomer().setFirstName(firstName);
account.getCustomer().setLastName(lastName);
account.getCustomer().setAddr1(addr1);
account.getCustomer().setAddr2(addr2);
account.getCustomer().setAddrCity(city);
account.getCustomer().setAddrState(state);
account.getCustomer().setAddrZip(zipCode);
account.getCustomer().setPhone(phonenum);
// Sets the values for the new Customer.
account.performAccountUpdate();The error stack trace is included below. The error can be easily replicated by clicking login, then create account, then completing the form.
Attempting to register a new user with email: test45@test.com
[ERROR ] WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
[ERROR ] J2CA0030E: Method enlist caught java.lang.IllegalStateException: Illegal attempt to enlist multiple 1PC XAResources
at com.ibm.tx.jta.impl.RegisteredResources.enlistResource(RegisteredResources.java:441)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr.createCustomer(CustomerMgr.java:80)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer$$super(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:49)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldClientProxy.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.war.AccountBean.performAccountUpdate(AccountBean.java:86)
at com.ibm.websphere.samples.pbw.war.AccountBean$Proxy$_$$_WeldClientProxy.performAccountUpdate(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.ApplicationResource.createCustomer(ApplicationResource.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.ibm.ws.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer.serviceInvoke(JaxRsFactoryImplicitBeanCDICustomizer.java:282)
at [internal classes]
while trying to enlist resources from DataSource jdbc/PlantsByWebSphereDataSource with the Transaction Manager for the current transaction, and threw a Exception.
[ERROR ] WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
[ERROR ] J2CA0030E: Method enlist caught java.lang.IllegalStateException: Illegal attempt to enlist multiple 1PC XAResources
at com.ibm.tx.jta.impl.RegisteredResources.enlistResource(RegisteredResources.java:441)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr.createCustomer(CustomerMgr.java:80)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer$$super(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:49)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldClientProxy.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.war.AccountBean.performAccountUpdate(AccountBean.java:86)
at com.ibm.websphere.samples.pbw.war.AccountBean$Proxy$_$$_WeldClientProxy.performAccountUpdate(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.ApplicationResource.createCustomer(ApplicationResource.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.ibm.ws.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer.serviceInvoke(JaxRsFactoryImplicitBeanCDICustomizer.java:282)
at [internal classes]
while trying to enlist resources from DataSource jdbc/PlantsByWebSphereDataSource with the Transaction Manager for the current transaction, and threw a Exception.
[WARNING ] CWWJP9991W: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
[WARNING ] Application {http://bean.pbw.samples.websphere.ibm.com/}ApplicationResource has thrown exception, unwinding now
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
[WARNING ] Exception in handleFault on interceptor org.apache.cxf.jaxrs.interceptor.JAXRSDefaultFaultOutInterceptor@668dca6f
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
[ERROR ] Error occurred during error handling, give up!
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
[ERROR ] SRVE0777E: Exception thrown by application class 'org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage:116'
java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)
at [internal classes]
Caused by: org.apache.cxf.interceptor.Fault: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)
... 1 more
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:879)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr.createCustomer(CustomerMgr.java:80)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer$$super(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:49)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldClientProxy.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.war.AccountBean.performAccountUpdate(AccountBean.java:86)
at com.ibm.websphere.samples.pbw.war.AccountBean$Proxy$_$$_WeldClientProxy.performAccountUpdate(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.ApplicationResource.createCustomer(ApplicationResource.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.ibm.ws.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer.serviceInvoke(JaxRsFactoryImplicitBeanCDICustomizer.java:282)
... 1 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
... 20 more
Caused by: java.sql.SQLException: enlist: caught Exception
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1114)
... 20 more
Caused by: javax.resource.ResourceException: enlist: caught Exception
at com.ibm.ejs.j2c.LocalTransactionWrapper.enlist(LocalTransactionWrapper.java:585)
... 20 more
Caused by: java.lang.IllegalStateException: Illegal attempt to enlist multiple 1PC XAResources
at com.ibm.tx.jta.impl.RegisteredResources.enlistResource(RegisteredResources.java:441)
... 20 more
[ERROR ] SRVE0315E: An exception occurred: java.lang.Throwable: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4913)
at [internal classes]
Caused by: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)
... 1 more
Caused by: org.apache.cxf.interceptor.Fault: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)
... 1 more
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:879)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr.createCustomer(CustomerMgr.java:80)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer$$super(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:49)
at [internal classes]
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldSubclass.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.CustomerMgr$Proxy$_$$_WeldClientProxy.createCustomer(Unknown Source)
at com.ibm.websphere.samples.pbw.war.AccountBean.performAccountUpdate(AccountBean.java:86)
at com.ibm.websphere.samples.pbw.war.AccountBean$Proxy$_$$_WeldClientProxy.performAccountUpdate(Unknown Source)
at com.ibm.websphere.samples.pbw.bean.ApplicationResource.createCustomer(ApplicationResource.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.ibm.ws.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer.serviceInvoke(JaxRsFactoryImplicitBeanCDICustomizer.java:282)
... 1 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.WAS-v20160106-a06c2b3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: enlist: caught Exception
Error Code: 0
Call: INSERT INTO APP.CUSTOMER (CUSTOMERID, ADDR1, ADDR2, ADDRCITY, ADDRSTATE, ADDRZIP, FIRSTNAME, LASTNAME, PASSWORD, PHONE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [10 parameters bound]
Query: InsertObjectQuery(com.ibm.websphere.samples.pbw.jpa.Customer@db2375e)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
... 20 more
Caused by: java.sql.SQLException: enlist: caught Exception
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1114)
... 20 more
Caused by: javax.resource.ResourceException: enlist: caught Exception
at com.ibm.ejs.j2c.LocalTransactionWrapper.enlist(LocalTransactionWrapper.java:585)
... 20 more
Caused by: java.lang.IllegalStateException: Illegal attempt to enlist multiple 1PC XAResources
at com.ibm.tx.jta.impl.RegisteredResources.enlistResource(RegisteredResources.java:441)
... 20 moreReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels