Guest User

Untitled

a guest
Nov 6th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.92 KB | None | 0 0
  1. 2018-11-02 15:04:34,003 ERROR [com.thehartford.pi.esign.dao.db.ActivityDBDAOImpl] (default-threads - 4) ERROR SAVING ENTITY :: com.thehartford.pi.esign.dao.db.entity.OpportunityEntity@4753c567 For id :: null: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
  2. Internal Exception: java.sql.SQLException: IJ031017: You cannot set autocommit during a managed transaction
  3. Error Code: 0
  4. Query: InsertObjectQuery(com.thehartford.pi.esign.dao.db.entity.OpportunityEntity@4753c567)
  5. at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:879)
  6. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  7. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  8. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  9. at java.lang.reflect.Method.invoke(Method.java:498)
  10. at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298)
  11. at com.sun.proxy.$Proxy87.flush(Unknown Source)
  12. at com.thehartford.pi.esign.dao.db.ActivityDBDAOImpl.saveEntity(ActivityDBDAOImpl.java:122)
  13. at com.thehartford.pi.esign.dao.db.ActivityDBDAOImpl.saveOpportunity(ActivityDBDAOImpl.java:157)
  14. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  15. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  16. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  17. at java.lang.reflect.Method.invoke(Method.java:498)
  18. at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
  19. at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
  20. at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  21. at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
  22. at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:280)
  23. at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
  24. at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  25. at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
  26. at com.sun.proxy.$Proxy88.saveOpportunity(Unknown Source)
  27. at com.thehartford.pi.esign.service.profile.ProfileServiceImpl.saveConsumerOpportunity(ProfileServiceImpl.java:124)
  28. at com.thehartford.pi.esign.service.esignstatusnotification.StatusNotificationServiceImpl.logOpportunity(StatusNotificationServiceImpl.java:237)
  29. at com.thehartford.pi.esign.service.esignstatusnotification.StatusNotificationServiceImpl.process(StatusNotificationServiceImpl.java:371)
  30. at com.thehartford.pi.esign.service.esignstatusnotification.StatusNotificationServiceImpl.processNotificationStatusInternal(StatusNotificationServiceImpl.java:203)
  31. at com.thehartford.pi.esign.service.esignstatusnotification.StatusNotificationServiceImpl.processNotificationStatus(StatusNotificationServiceImpl.java:113)
  32. at com.thehartford.pi.esign.mdb.StatusNotificationProcessor.process(StatusNotificationProcessor.java:87)
  33. at com.thehartford.pi.esign.mdb.AbstractConsumerMDB.onMessageInternal(AbstractConsumerMDB.java:90)
  34. at com.thehartford.pi.esign.mdb.StatusNotificationProcessor.onMessage(StatusNotificationProcessor.java:155)
  35. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  36. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  37. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  38. at java.lang.reflect.Method.invoke(Method.java:498)
  39. at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
  40. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  41. at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
  42. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  43. at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
  44. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  45. at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:40)
  46. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  47. at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
  48. at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
  49. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  50. at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
  51. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  52. at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:255)
  53. at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:334)
  54. at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:240)
  55. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  56. at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
  57. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  58. at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
  59. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  60. at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
  61. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  62. at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
  63. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  64. at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
  65. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  66. at org.jboss.as.ejb3.deployment.processors.EjbSuspendInterceptor.processInvocation(EjbSuspendInterceptor.java:57)
  67. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  68. at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)
  69. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  70. at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
  71. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  72. at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
  73. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  74. at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:239)
  75. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  76. at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
  77. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  78. at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:438)
  79. at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:609)
  80. at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:57)
  81. at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
  82. at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
  83. at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)
  84. at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
  85. at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:81)
  86. at com.thehartford.pi.esign.mdb.StatusNotificationProcessor$$$view2.onMessage(Unknown Source)
  87. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  88. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  89. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  90. at java.lang.reflect.Method.invoke(Method.java:498)
  91. at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:139)
  92. at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)
  93. at com.thehartford.pi.esign.mdb.StatusNotificationProcessor$$$endpoint1.onMessage(Unknown Source)
  94. at com.ibm.mq.connector.inbound.MessageEndpointWrapper.onMessage(MessageEndpointWrapper.java:151)
  95. at com.ibm.mq.jms.MQSession$FacadeMessageListener.onMessage(MQSession.java:129)
  96. at com.ibm.msg.client.jms.internal.JmsSessionImpl.run(JmsSessionImpl.java:3250)
  97. at com.ibm.mq.jms.MQSession.run(MQSession.java:937)
  98. at com.ibm.mq.connector.inbound.ASFWorkImpl.doDelivery(ASFWorkImpl.java:104)
  99. at com.ibm.mq.connector.inbound.AbstractWorkImpl.run(AbstractWorkImpl.java:233)
  100. at org.jboss.jca.core.workmanager.WorkWrapper.runWork(WorkWrapper.java:445)
  101. at org.jboss.as.connector.services.workmanager.WildflyWorkWrapper.runWork(WildflyWorkWrapper.java:68)
  102. at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)
  103. at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
  104. at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
  105. at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
  106. at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:828)
  107. at java.lang.Thread.run(Thread.java:748)
  108. at org.jboss.threads.JBossThread.run(JBossThread.java:320)
  109. ..
  110. ..
  111. ..
  112. ..
  113. Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
  114. Internal Exception: java.sql.SQLException: IJ031017: You cannot set autocommit during a managed transaction
  115. Error Code: 0
  116. Query: InsertObjectQuery(com.thehartford.pi.esign.dao.db.entity.OpportunityEntity@4753c567)
  117. at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331)
  118. at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicBeginTransaction(DatabaseAccessor.java:245)
  119. ..
  120. ..
  121. ... 103 more
  122. Caused by: java.sql.SQLException: IJ031017: You cannot set autocommit during a managed transaction
  123. at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:973)
  124. at org.jboss.jca.adapters.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:787)
  125. at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicBeginTransaction(DatabaseAccessor.java:238)
  126. ... 133 more
  127.  
  128. <xa-datasource jndi-name="java:jboss/datasources/esign_cons_ds" pool-name="esign_cons_ds">
  129. <xa-datasource-property name="URL">
  130. jdbc:oracle:thin:@database:1521/ease.world
  131. </xa-datasource-property>
  132. <driver>oracle</driver>
  133. <xa-pool>
  134. <min-pool-size>1</min-pool-size>
  135. <max-pool-size>15</max-pool-size>
  136. </xa-pool>
  137. <security>
  138. <user-name>username</user-name>
  139. <password>password</password>
  140. </security>
  141. <validation>
  142. <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
  143. <validate-on-match>true</validate-on-match>
  144. <background-validation>false</background-validation>
  145. <use-fast-fail>true</use-fast-fail>
  146. <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
  147. <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
  148. </validation>
  149. </xa-datasource>
  150.  
  151. @Configuration
  152. @Import(EnvironmentConfig.class)
  153. @EnableTransactionManagement
  154. public class PersistenceJPAConfig implements BeanFactoryAware{
  155. /** Logger*/
  156. private static final Log LOG = LogFactory.getLog(PersistenceJPAConfig.class);
  157.  
  158. /** JNDI Name*/
  159. private static final String DATA_SOURCE_JNDI_NAME = "consumer.datasource.jndi.name";
  160. /** DAO Scan packages*/
  161. private static final String[] DAO_PACKAGE = { "com.thehartford.pi.esign.dao.*","com.thehartford.pi.esign.dao.db.entity.*" };
  162. /** beanFactory*/
  163. private BeanFactory beanFactory;
  164. @Override
  165. public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
  166. this.beanFactory = beanFactory;
  167. }
  168. private Environment getEnv(){
  169. return this.beanFactory.getBean(EnvironmentConfig.class).getEnv();
  170. }
  171.  
  172. private String getDataSourceName(){
  173. String dataSourceName = getEnv().getProperty(DATA_SOURCE_JNDI_NAME);
  174. LOG.info("Consumer JPA config ressolved jndi name : "+dataSourceName);
  175. if(StringUtils.isEmpty(dataSourceName)){
  176. throw new IllegalStateException("Invalid data source name from property file "+DATA_SOURCE_JNDI_NAME);
  177. }
  178. return dataSourceName;
  179. }
  180.  
  181. /**
  182. * EntityManager is set up by creating a Spring factory bean to manage it;
  183. * this will allow the PersistenceAnnotationBeanPostProcessor to retrieve it
  184. * from the Container.
  185. *
  186. * @return
  187. */
  188. @Bean
  189. public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
  190. LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
  191. em.setDataSource(dataSource());
  192. em.setPackagesToScan(DAO_PACKAGE);
  193.  
  194. // Do not import Eclipse JPA Provider directly here
  195. // (org.eclipse.persistence.jpa.PersistenceProvider)
  196. // Using Spring Adapter for EclipseLink
  197. JpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter();
  198. em.setJpaVendorAdapter(vendorAdapter);
  199.  
  200. // JPA properties usually specified in persistence.xml file is imported
  201. // using below statement
  202. em.setJpaProperties(additionalProperties());
  203.  
  204. return em;
  205. }
  206.  
  207. @Bean
  208. public PersistenceAnnotationBeanPostProcessor persistenceAnnotationBeanPostProcessor() {
  209. return new PersistenceAnnotationBeanPostProcessor();
  210. }
  211.  
  212. @Bean
  213. public DataSource dataSource() {
  214. DataSource dataSource = null;
  215.  
  216. try {
  217. InitialContext ctx = new InitialContext();
  218. dataSource = (DataSource) ctx.lookup(getDataSourceName());
  219. } catch (NamingException ne) {
  220. LOG.error(ne);
  221. }
  222.  
  223. return dataSource;
  224. }
  225.  
  226. @Bean
  227. public PlatformTransactionManager transactionManager() {
  228. JpaTransactionManager transactionManager = new JpaTransactionManager();
  229.  
  230. // set the EntityManagerFactory that this instance should manage
  231. // transactions for
  232. transactionManager.setEntityManagerFactory(this
  233. .entityManagerFactoryBean().getObject());
  234. return transactionManager;
  235. }
  236.  
  237.  
  238. private Properties additionalProperties() {
  239. Properties defaultProperties = new Properties();
  240. defaultProperties.put("eclipselink.logging.level", "false");
  241. try {
  242. LOG.info("loading eclipselink props");
  243. Resource resource = new ClassPathResource("/eclipselink.properties");
  244. defaultProperties = PropertiesLoaderUtils.loadProperties(resource);
  245. LOG.info("eclipselink:" + defaultProperties);
  246. } catch (IOException e) {
  247. LOG.error(e);
  248. }
  249. return defaultProperties;
  250. }
  251.  
  252. }
  253.  
  254. ##This is EclipseLink Configuration File
  255. eclipselink.logging.level=INFO
  256.  
  257. #enable weaving i.e. byte code instrumentation used by EclipseLink
  258. eclipselink.weaving=false
  259.  
  260. #Caching Disabled as limitation of the shared cache, is that if the database
  261. #is changed directly through JDBC, or by another application or server,
  262. #the objects in the shared cache will be stale
  263. eclipselink.cache.shared.default=false
  264.  
  265. #performance related properties - for future optimization
  266.  
  267. #Optimization - avoid auto flush cost on query execution
  268. eclipselink.persistence-context.flush-mode=commit
  269.  
  270. #Optimization - close EntityManager on commit, to avoid cost of resume
  271. eclipselink.persistence-context.close-on-commit=true
  272.  
  273. #Optimization - avoid cost of persist on commit
  274. #eclipselink.persistence-context.persist-on-commit=false
  275.  
  276. @Bean
  277. public PlatformTransactionManager transactionManager() {
  278.  
  279. // JtaTransactionManager.
  280. JpaTransactionManager transactionManager = new JpaTransactionManager();
  281.  
  282. // set the EntityManagerFactory that this instance should manage
  283. // transactions for
  284. transactionManager.setEntityManagerFactory(this
  285. .entityManagerFactoryBean().getObject());
  286. return transactionManager;
  287. }
  288.  
  289. @Bean
  290. public PlatformTransactionManager transactionManager() {
  291.  
  292. // JtaTransactionManager.
  293. JtaTransactionManager transactionManager = new JtaTransactionManager();
  294.  
  295.  
  296. return transactionManager;
  297. }
Add Comment
Please, Sign In to add comment