Unexpected number of Hibernate sessions created in a multi EAR context - spring
We are facing an issue when using Spring JTA + Hibernate in a multiple EAR context.
We have multiple transactional services (using #Transactional).
Our services are POJOs that have a reference to a DAO.
We also have multiple persistence units. For sake of simplicity, lets assume that each service/dao uses a distinct PU.
If Service1 in EAR1 starts a transaction and calls service2 in EAR2 multiple times then :
Calls to Service2 will create a new hibernate session per call.
All the sessions will be flushed/committed at the end of the transactions (i.e. when the Service1 calls is done and commits the transaction). -
Important note : Spring and Hibernate are not loaded by the root classloader, but by the EAR classloaders.
This implies that Spring and Hibernate classes are loaded once per EAR.
Looking into the code and debugging led us to believe that the issue comes from thread local synchronization (i.e. the TransactionSynchronizationManager class).
What happens is:
A transaction is started by Service1 in EAR1
Service1 calls Service2 in EAR2
Because Service2 is also transacted the TransactionAspectSupport kicks in around the Service2 method that is being called.
Down the road the EntityManagerFactoryUtils will check if an EntityManager is registered with TransactionSynchronizationManager. This happens when SharedEntityManagerCreator calls EntityManagerFactoryUtils.doGetTransactionalEntityManager(). See call stack 1 below.
Because no EntityManager is registered, it will create a new EntityManager and a new Hibernate Session. See call stack 2 below.
When returning from the Service2 call, the synchronization is removed because it is considered as a new one. This happens in TransactionAspectSupport.commitTransactionAfterReturning(). See call stack 3 below.
Subsequent calls to Service2 will go through the process of creating a new entity manager + session + synchronization again.
Because all the sessions are also registered with the global transaction, they all get flushed/committed at the end of said transaction.
A side effect, is that if the calls to Service2 modify the same entity, then that entity gets stored multiple times to the RDBMS (i.e. multiple identical update queries are fired).
The same scenario with both Service1 and Service2 deployed in the same EAR yields completely different results:
Only one hibernate session is created
That unique session is flushed at the end of the transaction (and a single update query is fired)
In some of our scenarios, we are seeing hundreds of sessions being created over a short period of time and this is causing performance issues.
It is possible that moving Spring and Hibernate to the root ClassLoader could fix the issue but it does not feel right.
What if the the two EARs are deployed in separate JVMs ?
Moving spring and hibernate up in the ClassLoader hierarchy would also badly break our spring context setup...
Is this the expected behavior of Spring Transactions ?
Is it possible to avoid the thread local synchronization and use transaction synchronization ?
Is our setup (see below) wrong with regard to what we are trying to achieve ?
We are using :
Spring version : 3.2.8.RELEASE
Hibernate version : 4.1.12.Final
Here are some relevant fragments of our Spring setup :
<tx:jta-transaction-manager />
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
abstract="true">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="${jpa.database}" />
<property name="generateDdl" value="${jpa.generateDdl}" />
<property name="showSql" value="true" />
</bean>
</property>
<property name="dataSource" ref="coreDataSource" />
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.transaction.jta.platform">${jpa.transaction.jta.platform}</prop>
<prop key="hibernate.jdbc.wrap_result_sets">${jpa.wrap_result_sets}</prop>
<prop key="hibernate.generate_statistics">${jpa.generateStatistics}</prop>
<prop key="hibernate.cache.region.factory_class">${jpa.cache.factory_class}</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.format_sql">${jpa.formatSql}</prop>
<prop key="hibernate.use_sql_comments">${jpa.useSqlComments}</prop>
</props>
</property>
</bean>
Where jpa.transaction.jta.platform = org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform
<bean id="referentialCoreEntityManagerFactory" parent="entityManagerFactory">
<property name="persistenceXmlLocation" value="classpath:META-INF/referential-core-persistence.xml" />
<property name="persistenceUnitName" value="referential-core" />
</bean>
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="referential-core" transaction-type="JTA" />
</persistence>
Base class of our DAOs showing how the entity managers are defined:
public abstract class BaseDAO<E extends IBaseEntity> extends com.sungard.decalog.framework.domain.dao.jpa.BaseDAO<E> {
private EntityManager entityManager;
/**
* #param entityClass
*/
public <U extends E> BaseDAO(Class<U> entityClass) {
super(entityClass);
}
#Override
protected final EntityManager getEntityManager() {
return entityManager;
}
#PersistenceContext(unitName = "referential-core")
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
}
Call stack 1 : Creation of new EntityManager and Session:
Daemon Thread [[ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended (breakpoint at line 239 in SessionImpl))
-> SessionImpl.<init>(Connection, SessionFactoryImpl, SessionOwner, TransactionCoordinatorImpl, boolean, long, Interceptor, boolean, boolean, ConnectionReleaseMode, String) line: 239
SessionFactoryImpl$SessionBuilderImpl.openSession() line: 1597
EntityManagerImpl.getRawSession() line: 121
EntityManagerImpl.getSession() line: 97
EntityManagerImpl(AbstractEntityManagerImpl).joinTransaction(boolean) line: 1207
EntityManagerImpl(AbstractEntityManagerImpl).postInit() line: 178
-> EntityManagerImpl.<init>(EntityManagerFactoryImpl, PersistenceContextType, PersistenceUnitTransactionType, boolean, Class, Map) line: 89
EntityManagerFactoryImpl.createEntityManager(Map) line: 179
EntityManagerFactoryImpl.createEntityManager() line: 174
GeneratedMethodAccessor450.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
LocalContainerEntityManagerFactoryBean(AbstractEntityManagerFactoryBean).invokeProxyMethod(Method, Object[]) line: 376
AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(Object, Method, Object[]) line: 519
$Proxy116.createEntityManager() line: not available
-> EntityManagerFactoryUtils.doGetTransactionalEntityManager(EntityManagerFactory, Map) line: 202
SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(Object, Method, Object[]) line: 211
$Proxy118.find(Class, Object) line: not available
GenericLoaderCodifDAO(BaseDAO<E>).findById(Serializable) line: 57
GenericLoaderCodifService.findGenericLoaderCodif(String, String, String) line: 18
ReferentialFacade.findGenericLoaderCodif(String, String, String) line: 161
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 317
ReflectiveMethodInvocation.invokeJoinpoint() line: 183
ReflectiveMethodInvocation.proceed() line: 150
TransactionInterceptor$1.proceedWithInvocation() line: 96
TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class, TransactionAspectSupport$InvocationCallback) line: 260
TransactionInterceptor.invoke(MethodInvocation) line: 94
ReflectiveMethodInvocation.proceed() line: 172
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy124.findGenericLoaderCodif(String, String, String) line: not available
ReferentialFacadeBean_590diy_Impl(ReferentialFacadeBean).findGenericLoaderCodif(String, String, String) line: 271
ReferentialFacadeBean_590diy_EOImpl.__WL_invoke(Object, Object[], int) line: not available
SessionRemoteMethodInvoker.invoke(BaseRemoteObject, MethodDescriptor, Object[], int, String, Class<?>) line: 40
ReferentialFacadeBean_590diy_EOImpl.findGenericLoaderCodif(String, String, String) line: not available
ReferentialFacadeBean_590diy_EOImpl_WLSkel.invoke(int, Object[], Object) line: not available
ServerRequest.sendReceive() line: 174
ClusterableRemoteRef.invoke(RemoteReference, RuntimeMethodDescriptor, Object[], Method) line: 345
ClusterableRemoteRef.invoke(Remote, RuntimeMethodDescriptor, Object[], Method) line: 259
ReferentialFacadeBean_590diy_EOImpl_1036_WLStub.findGenericLoaderCodif(String, String, String) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
RmiClientInterceptorUtils.invokeRemoteMethod(MethodInvocation, Object) line: 116
SimpleRemoteStatelessSessionProxyFactoryBean(SimpleRemoteSlsbInvokerInterceptor).doInvoke(MethodInvocation) line: 99
SimpleRemoteStatelessSessionProxyFactoryBean(AbstractRemoteSlsbInvokerInterceptor).invokeInContext(MethodInvocation) line: 141
SimpleRemoteStatelessSessionProxyFactoryBean(AbstractSlsbInvokerInterceptor).invoke(MethodInvocation) line: 189
ReflectiveMethodInvocation.proceed() line: 172
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy314.findGenericLoaderCodif(String, String, String) line: not available
ReferentialService.findGenericLoaderCodif(String, String, String) line: 54
SessionService.refreshSession(ISessionContext, ISessionSnapshot, ISessionData) line: 1114
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 317
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 198
$Proxy357.refreshSession(ISessionContext, ISessionSnapshot, ISessionData) line: not available
SessionFacadeService.loadSession(ISessionContext, ISessionSnapshot, ISessionData, ReloadSession) line: 880
SessionFacadeService.loadSession(long, ReloadSession) line: 848
...
<snip>
Call stack 2 : Registration of newly created EntityManager synchronization :
Daemon Thread [[ACTIVE] ExecuteThread: '18' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)
TransactionSynchronizationManager.registerSynchronization(TransactionSynchronization) line: 289
EntityManagerFactoryUtils.doGetTransactionalEntityManager(EntityManagerFactory, Map) line: 211
SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(Object, Method, Object[]) line: 211
$Proxy118.find(Class, Object) line: not available
GenericLoaderCodifDAO(BaseDAO<E>).findById(Serializable) line: 57
GenericLoaderCodifService.findGenericLoaderCodif(String, String, String) line: 18
ReferentialFacade.findGenericLoaderCodif(String, String, String) line: 161
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 317
ReflectiveMethodInvocation.invokeJoinpoint() line: 183
ReflectiveMethodInvocation.proceed() line: 150
TransactionInterceptor$1.proceedWithInvocation() line: 96
TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class, TransactionAspectSupport$InvocationCallback) line: 260
TransactionInterceptor.invoke(MethodInvocation) line: 94
ReflectiveMethodInvocation.proceed() line: 172
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy124.findGenericLoaderCodif(String, String, String) line: not available
ReferentialFacadeBean_590diy_Impl(ReferentialFacadeBean).findGenericLoaderCodif(String, String, String) line: 271
ReferentialFacadeBean_590diy_EOImpl.__WL_invoke(Object, Object[], int) line: not available
SessionRemoteMethodInvoker.invoke(BaseRemoteObject, MethodDescriptor, Object[], int, String, Class<?>) line: 40
ReferentialFacadeBean_590diy_EOImpl.findGenericLoaderCodif(String, String, String) line: not available
ReferentialFacadeBean_590diy_EOImpl_WLSkel.invoke(int, Object[], Object) line: not available
ServerRequest.sendReceive() line: 174
ClusterableRemoteRef.invoke(RemoteReference, RuntimeMethodDescriptor, Object[], Method) line: 345
ClusterableRemoteRef.invoke(Remote, RuntimeMethodDescriptor, Object[], Method) line: 259
ReferentialFacadeBean_590diy_EOImpl_1036_WLStub.findGenericLoaderCodif(String, String, String) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
RmiClientInterceptorUtils.invokeRemoteMethod(MethodInvocation, Object) line: 116
SimpleRemoteStatelessSessionProxyFactoryBean(SimpleRemoteSlsbInvokerInterceptor).doInvoke(MethodInvocation) line: 99
SimpleRemoteStatelessSessionProxyFactoryBean(AbstractRemoteSlsbInvokerInterceptor).invokeInContext(MethodInvocation) line: 141
SimpleRemoteStatelessSessionProxyFactoryBean(AbstractSlsbInvokerInterceptor).invoke(MethodInvocation) line: 189
ReflectiveMethodInvocation.proceed() line: 172
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy314.findGenericLoaderCodif(String, String, String) line: not available
ReferentialService.findGenericLoaderCodif(String, String, String) line: 54
SessionService.refreshSession(ISessionContext, ISessionSnapshot, ISessionData) line: 1114
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 317
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 198
$Proxy357.refreshSession(ISessionContext, ISessionSnapshot, ISessionData) line: not available
SessionFacadeService.loadSession(ISessionContext, ISessionSnapshot, ISessionData, ReloadSession) line: 880
SessionFacadeService.loadSession(long, ReloadSession) line: 848
...
<snip>
Call stack 3 : Clearing of EntityManager synchronization (this will cause a new one to be created for each Service2 call) :
Daemon Thread [[ACTIVE] ExecuteThread: '18' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended)
TransactionSynchronizationManager.clearSynchronization() line: 328
TransactionSynchronizationManager.clear() line: 464
WebLogicJtaTransactionManager(AbstractPlatformTransactionManager).cleanupAfterCompletion(DefaultTransactionStatus) line: 1006
WebLogicJtaTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 805
WebLogicJtaTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 724
TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo) line: 475
TransactionInterceptor(TransactionAspectSupport).invokeWithinTransaction(Method, Class, TransactionAspectSupport$InvocationCallback) line: 270
TransactionInterceptor.invoke(MethodInvocation) line: 94
ReflectiveMethodInvocation.proceed() line: 172
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy124.findGenericLoaderCodif(String, String, String) line: not available
ReferentialFacadeBean_590diy_Impl(ReferentialFacadeBean).findGenericLoaderCodif(String, String, String) line: 271
ReferentialFacadeBean_590diy_EOImpl.__WL_invoke(Object, Object[], int) line: not available
SessionRemoteMethodInvoker.invoke(BaseRemoteObject, MethodDescriptor, Object[], int, String, Class<?>) line: 40
ReferentialFacadeBean_590diy_EOImpl.findGenericLoaderCodif(String, String, String) line: not available
ReferentialFacadeBean_590diy_EOImpl_WLSkel.invoke(int, Object[], Object) line: not available
ServerRequest.sendReceive() line: 174
ClusterableRemoteRef.invoke(RemoteReference, RuntimeMethodDescriptor, Object[], Method) line: 345
ClusterableRemoteRef.invoke(Remote, RuntimeMethodDescriptor, Object[], Method) line: 259
ReferentialFacadeBean_590diy_EOImpl_1036_WLStub.findGenericLoaderCodif(String, String, String) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
RmiClientInterceptorUtils.invokeRemoteMethod(MethodInvocation, Object) line: 116
SimpleRemoteStatelessSessionProxyFactoryBean(SimpleRemoteSlsbInvokerInterceptor).doInvoke(MethodInvocation) line: 99
SimpleRemoteStatelessSessionProxyFactoryBean(AbstractRemoteSlsbInvokerInterceptor).invokeInContext(MethodInvocation) line: 141
SimpleRemoteStatelessSessionProxyFactoryBean(AbstractSlsbInvokerInterceptor).invoke(MethodInvocation) line: 189
ReflectiveMethodInvocation.proceed() line: 172
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy314.findGenericLoaderCodif(String, String, String) line: not available
ReferentialService.findGenericLoaderCodif(String, String, String) line: 54
SessionService.refreshSession(ISessionContext, ISessionSnapshot, ISessionData) line: 1114
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 317
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 198
$Proxy357.refreshSession(ISessionContext, ISessionSnapshot, ISessionData) line: not available
SessionFacadeService.loadSession(ISessionContext, ISessionSnapshot, ISessionData, ReloadSession) line: 880
SessionFacadeService.loadSession(long, ReloadSession) line: 848
...
<snip>
Try to avoid the use of shared classloaders, this can give rise to all sorts of problems with static variables being shared accidentally between applications.
For example static loggers will be shared, so if you turn on trace debug in one application, you will see the other application slowdown as well, this is just an example of what the shared classloader can cause as unintended side effect.
Something similar could be happening not necessarily in Spring or Hibernate but in some transitive dependency that they use, most of these libraries are meant to be deployed at the application classloader level.
Currently there is no really good reason to put spring and hibernate at a shared classloader, they hardly consume any memory compared to other things.
I personally would put Spring and Hibernate in each WAR instead of moving it further down to the JVM, that would actually make the application un-redeployable, and would try to reduce the use of shared libraries to a minimum.
Also cross EAR calls usually are not needed, it's a programming model that is mostly abandoned due to complexity problems. The usual solution is to ship the service/DAO layer in a separate jar, and deploy the jar in the two applications. The application code can then call the service layer directly without the need for a call to another EAR.
The native transaction manager auto-detected by tx:jta-transaction-manager is then no longer needed and can be replaced by something like JpaTransactionManager or HibernateTransactionManager.
Related
How do I resolve a CONSOLE WARN with "UITabBarControllerImpl" in NS Preview after tweaking Xcode settings?
I'm very new to mobile app development, and though I've settled on using Svelte-Native at this point, I was considering various frameworks a couple of weeks ago (React Native and Kivy). Svelte-Native's, Your First App, was the first tutorial I tried, and at that time everything worked just fine. I then looked at React Native and finally considered Kivy. I never ended up getting Kivy to work, but that in it of itself is fine – I'm not going to use it for the time being. However, while I was trying to get Kivy to work, I had to tinker around a lot in Xcode's settings. My suspicion is that it threw some sort of configuration on such a low level, that it's affecting NS Preview and NS Playground. When I run, ns preview, the QR code displays just fine, but then when I scan my it with my iPhone 12, and I get an error log both in my terminal and on my phone. LOG from device Peter’s iPhone: CONSOLE WARN file:///app/tns_modules/#nativescript/core/ui/tab-view/tab-view.js:17:14: Objective-C class name "UITabBarControllerImpl" is already in use - using "UITabBarControllerImpl1" instead. CONSOLE WARN file:///app/tns_modules/#nativescript/core/ui/tab-view/tab-view.js:78:14: Objective-C class name "UITabBarControllerDelegateImpl" is already in use - using "UITabBarControllerDelegateImpl1" instead. CONSOLE WARN file:///app/tns_modules/#nativescript/core/ui/tab-view/tab-view.js:116:14: Objective-C class name "UINavigationControllerDelegateImpl" is already in use - using "UINavigationControllerDelegateImpl1" instead. CONSOLE INFO file:///app/vendor.js:38:36: HMR: Hot Module Replacement Enabled. Waiting for signal. 2021-06-24 10:46:32.720 nsplaydev[20450:7282202] PlayLiveSync: applicationDidFinishLaunching CONSOLE LOG file:///app/vendor.js:5722:24: Application Launched CONSOLE ERROR file:///app/vendor.js:3057:16: [HMR][Svelte] Unrecoverable error in <App>: next update will trigger a full reload 2021-06-24 10:46:32.729 nsplaydev[20450:7282202] ***** Fatal JavaScript exception - application has been terminated. ***** 2021-06-24 10:46:32.729 nsplaydev[20450:7282202] Native stack trace: 1 0x105916348 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool) 2 0x105950434 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*) 3 0x1064bb388 ffi_closure_SYSV_inner 4 0x1064bc1b4 .Ldo_closure 5 0x1963ad6d4 <redacted> 6 0x1963ad67c <redacted> 7 0x1963acbe8 <redacted> 8 0x1963ac5a8 _CFXNotificationPost 9 0x1976b16ac <redacted> 10 0x198e3e370 <redacted> 11 0x198e44388 <redacted> 12 0x198497c98 <redacted> 13 0x198a00f58 _UIScenePerformActionsWithLifecycleActionMask 14 0x198498830 <redacted> 15 0x1984982f0 <redacted> 16 0x198498640 <redacted> 17 0x198497e7c <redacted> 18 0x1984a03c0 <redacted> 19 0x19890e970 <redacted> 20 0x198a19d68 _UISceneSettingsDiffActionPerformChangesWithTransitionContext 21 0x1984a00b8 <redacted> 22 0x1982c7fa0 <redacted> 23 0x1982c6920 <redacted> 24 0x1982c7bc8 <redacted> 25 0x198e42528 <redacted> 26 0x198937fd0 <redacted> 27 0x1a59e45d8 <redacted> 28 0x1a5a0fd44 <redacted> 29 0x1a59f36a4 <redacted> 30 0x1a5a0fa0c <redacted> 31 0x19603f81c <redacted> 2021-06-24 10:46:32.731 nsplaydev[20450:7282202] JavaScript stack trace: 2021-06-24 10:46:32.731 nsplaydev[20450:7282202] create_fragment(file:///app/bundle.js:290:17) at init(file:///app/vendor.js:7356:52) at App(file:///app/bundle.js:373:63) at createProxiedComponent(file:///app/vendor.js:3622:22) at ProxyComponent(file:///app/vendor.js:3239:92) at file:///app/vendor.js:3298:16 at resolveComponentElement(file:///app/vendor.js:5529:36) at navigate(file:///app/vendor.js:5542:60) at create(file:///app/vendor.js:5729:89) at file:///app/tns_modules/#nativescript/core/ui/builder/builder.js:18:36 at createRootView(file:///app/tns_modules/#nativescript/core/application/application.js:292:61) at file:///app/tns_modules/#nativescript/core/application/application.js:243:38 at file:///app/tns_modules/#nativescript/core/application/application.js:174:34 at file:///app/tns_modules/#nativescript/core/application/application.js:163:30 at [native code] at file:///app/tns_modules/#nativescript/core/application/application.js:36:32 at UIApplicationMain([native code]) at run(file:///app/tns_modules/#nativescript/core/application/application.js:312:26) at file:///app/vendor.js:5726:87 at initializePromise([native code]) at Promise([native code]) at svelteNative(file:///app/vendor.js:5719:23) at file:///app/bundle.js:459:67 at ./app.ts(file:///app/bundle.js:472:34) at __webpack_require__(file:///app/runtime.js:817:34) at checkDeferredModules(file:///app/runtime.js:44:42) at webpackJsonpCallback(file:///app/runtime.js:31:39) at anonymous(file:///app/bundle.js:2:61) at evaluate([native code]) at moduleEvaluation([native code]) at [native code] at asyncFunctionResume([native code]) at [native code] at promiseReactionJob([native code]) 2021-06-24 10:46:32.731 nsplaydev[20450:7282202] JavaScript error: file:///app/bundle.js:290:17: JS ERROR ReferenceError: Can't find variable: Page 2021-06-24 10:46:32.732 nsplaydev[20450:7282202] PlayLiveSync: Uncaught Exception 2021-06-24 10:46:32.732 nsplaydev[20450:7282202] *** JavaScript call stack: ( 0 UIApplicationMain#[native code] 1 run#file:///app/tns_modules/#nativescript/core/application/application.js:312:26 2 #file:///app/vendor.js:5726:87 3 initializePromise#:1:11 4 Promise#[native code] 5 svelteNative#file:///app/vendor.js:5719:23 6 #file:///app/bundle.js:459:67 7 ./app.ts#file:///app/bundle.js:472:34 8 __webpack_require__#file:///app/runtime.js:817:34 9 checkDeferredModules#file:///app/runtime.js:44:42 10 webpackJsonpCallback#file:///app/runtime.js:31:39 11 anonymous#file:///app/bundle.js:2:61 12 evaluate#[native code] 13 moduleEvaluation#:1:11 14 #:2:1 15 asyncFunctionResume#:1:11 16 #:24:9 17 promiseReactionJob#:1:11 ) 2021-06-24 10:46:32.732 nsplaydev[20450:7282202] *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: ReferenceError: Can't find variable: Page at create_fragment(file:///app/bundle.js:290:17) at init(file:///app/vendor.js:7356:52) at App(file:///app/bundle.js:373:63) at createProxiedComponent(file:///app/vendor.js:3622:22) at ProxyComponent(file:///app/vendor.js:3239:92) at file:///app/vendor.js:3298:16 at resolveComponentElement(file:///app/vendor.js:5529:36) at navigate(file:///app/vendor.js:5542:60) at create(file:///app/vendor.js:5729:89) at file:///app/tns_modules/#nativescript/core/ui/builder/builder.js:18:36 at createRootView(file:///app/tns_modules/#nativescript/core/application/application.js:292:61) at file:///app/tns_modules/#nativescript/core/application/application.js:243:38 at file:///app/tns_modules/#nativescript/core/application/application.js:174:34 at file:///app/tns_modules/#nativescript/core/application/application.js:163:30 at [native code] at file:///app/tns_modules/#nativescript/core/application/application.js:36:32 at UIApplicationMain([native code]) at run(file:///app/tns_modules/#nativescript/core/application/application.js:312:26) at file:///app/vendor.js:5726:87 at initializePromise([native code]) at Promise([native code]) at svelteNative(file:///app/vendor.js:5719:23) at file:///app/bundle.js:459:67 at ./app.ts(file:///app/bundle.js:472:34) at __webpack_require__(file:///app/runtime.js:817:34) at checkDeferredModules(file:///app/runtime.js:44:42) at webpackJsonpCallback(file:///app/runtime.js:31:39) at anonymous(file:///app/bundle.js:2:61) at evaluate([native code]) at moduleEvaluation([native code]) at [native code] at asyncFunctionResume([native code]) at [native code] at promiseReactionJob([native code]) ', reason: '(null)' *** First throw call stack: (0x196452754 0x1aaf197a8 0x105916820 0x105950434 0x1064bb388 0x1064bc1b4 0x1963ad6d4 0x1963ad67c 0x1963acbe8 0x1963ac5a8 0x1976b16ac 0x198e3e370 0x198e44388 0x198497c98 0x198a00f58 0x198498830 0x1984982f0 0x198498640 0x198497e7c 0x1984a03c0 0x19890e970 0x198a19d68 0x1984a00b8 0x1982c7fa0 0x1982c6920 0x1982c7bc8 0x198e42528 0x198937fd0 0x1a59e45d8 0x1a5a0fd44 0x1a59f36a4 0x1a5a0fa0c 0x19603f81c 0x19604330c 0x1a5a37fa0 0x1a5a37c30 0x1a5a38184 0x1963cc9e8 0x1963cc8e4 0x1963cbbe8 0x1963c5bc8 0x1963c5360 0x1ada03734 0x198e40584 0x198e45df4 0x1064bc044 0x1064baae8 0x1064ba648 0x1058d93d8 0x106487b10 0x106484f28 0x106484f28 0x106484f28 0x1064665e8 0x105a14e48 0x1061c0df0 0x1061c1478 0x106487ca8 0x106485ed4 0x106484f28 0x106484f28 0x106484f28 0x106484f28 0x106484e80 0x106484f28 0x1064665e8 0x105a14e48 0x1062b8cb4 0x1058f18f4 0x1061899d0 0x1064877cc 0x106484f28 0x106484f28 0x106484f28 0x106484e80 0x106484f28 0x1064665e8 0x105a14e48 0x1062b8e50 0x106182d9c 0x1058e7304 0x105960350 0x1069b225c 0x104dff524 0x196081cf8) libc++abi: terminating with uncaught exception of type NSException 2021-06-24 10:46:32.732 nsplaydev[20450:7282202] PlayLiveSync: Uncaught Exception How can I resolve this? Any help would be very appreciated. Thank you in advance.
Error while loading data from BigQuery table to Dataproc cluster
I'm new to Dataproc and PySpark and facing certain issues while integrating BigQuery table to Dataproc cluster via Jupyter Lab API. Below is the code that I used for loading BigQuery table to the Dataproc cluster through Jupyter Notebook API but I am getting an error while loading the table from pyspark.sql import SparkSession SparkSession.builder.appName('Jupyter BigQuery Storage').config( 'spark.jars', 'gs://spark-lib/bigquery/spark-bigquery-latest.jar').getOrCreate() df=spark.read.format("com.google.cloud.spark.bigquery").option( "table", "publicdata.samples.shakespeare").load() df.printSchema() Below, is the error I'm getting Py4JJavaErrorTraceback (most recent call last) <ipython-input-17-789ad67053e5> in <module>() 1 table = "publicdata.samples.shakespeare" ----> 2 df = spark.read.format("com.google.cloud.spark.bigquery").option("table",table).load() 3 df.printSchema() /usr/lib/spark/python/pyspark/sql/readwriter.pyc in load(self, path, format, schema, **options) 170 return self._df(self._jreader.load(self._spark._sc._jvm.PythonUtils.toSeq(path))) 171 else: --> 172 return self._df(self._jreader.load()) 173 174 #since(1.4) /opt/conda/anaconda/lib/python2.7/site-packages/py4j/java_gateway.pyc in __call__(self, *args) 1255 answer = self.gateway_client.send_command(command) 1256 return_value = get_return_value( -> 1257 answer, self.gateway_client, self.target_id, self.name) 1258 1259 for temp_arg in temp_args: /usr/lib/spark/python/pyspark/sql/utils.pyc in deco(*a, **kw) 61 def deco(*a, **kw): 62 try: ---> 63 return f(*a, **kw) 64 except py4j.protocol.Py4JJavaError as e: 65 s = e.java_exception.toString() /opt/conda/anaconda/lib/python2.7/site-packages/py4j/protocol.pyc in get_return_value(answer, gateway_client, target_id, name) 326 raise Py4JJavaError( 327 "An error occurred while calling {0}{1}{2}.\n". --> 328 format(target_id, ".", name), value) 329 else: 330 raise Py4JError( Py4JJavaError: An error occurred while calling o254.load. : java.lang.ClassNotFoundException: Failed to find data source: com.google.cloud.spark.bigquery. Please find packages at http://spark.apache.org/third-party-projects.html at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:639) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:190) at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:164) 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 py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: com.google.cloud.spark.bigquery.DefaultSource at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23$$anonfun$apply$15.apply(DataSource.scala:622) at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23$$anonfun$apply$15.apply(DataSource.scala:622) at scala.util.Try$.apply(Try.scala:192) at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23.apply(DataSource.scala:622) at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$23.apply(DataSource.scala:622) at scala.util.Try.orElse(Try.scala:84) at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:622) ... 13 more```
Please assign the SparkSession.builder result to a variable: spark = SparkSession.builder\ .appName('Jupyter BigQuery Storage')\ .config('spark.jars', 'gs://spark-lib/bigquery/spark-bigquery-latest.jar')\ .getOrCreate() Also, the reference to the public datasets is bigquery-public-data, so please change the reading to df = spark.read.format("com.google.cloud.spark.bigquery")\ .option("table", "bigquery-public-data.samples.shakespeare")\ .load()
Nativescript - TypeError: Cannot read property 'LayoutParams' of undefined
tns 2.5.0-2016-11-16-7142 npm 3.10.9 This is a NS-ng project with very minimal code. On running, the cli throws this - java.lang.RuntimeException: Unable to resume activity {org.nativescript.fundoo/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreateView failed TypeError: Cannot read property 'LayoutParams' of undefined File: "/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/core/view.js, line: 507, column: 68 StackTrace: Frame: function:'ViewStyler.setNativeLayoutParamsProperty', file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/core/view.js', line: 507, column: 69 Frame: function:'StylePropertyChangedHandler.applyProperty', file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/styling/style.js', line: 1326, column: 14 Frame: function:'Style._applyStyleProperty', file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/styling/style.js', line: 1086, column: 25 Frame: function:'Style._applyProperty', file:'/data/data/org.nativescript.fundoo/files/app/tns_modules/ui/styling/style.js', line: 1049, column: 14 Frame: function:'Style._onP This supposedly had to do with the module versions but I have it updated : "tns-core-modules": "^2.5.0-2016-11-16-4793", "tns-core-modules-widgets": "^2.5.0-2016-11-10-154"
Same Application deployed in two different websphere 8 profiles share session?
I have one application WAR. I have created two profiles AppSrv01, AppSrv02 on Websphere 8.0.0.0. My application is having MQ connectivity, J2ee application on struts 1.1. I have deployed WAR on both the server AppSrv01 as a context A and AppSrv02 as a context B. I have session listener in my application which will take note of total available session. The scenario is as given below.... Going and login to url localhost:9082/A, go to some page in it. Going and login to url localhost:9082/B, go to some page in it in another tab of same browser. Going to url localhost:9082/A, clicking on some of link or url from the existing page. on remote debug from server when it come to SessionListener ... it shows below given stack Daemon Thread [WebContainer : 10] (Suspended (breakpoint at line 24 in SessionCounterListener)) SessionCounterListener.sessionCreated(HttpSessionEvent) line: 24 WasHttpSessionObserver(HttpSessionObserver).sessionCreated(ISession) line: 111 SessionEventDispatcher.sessionCreated(ISession) line: 98 SessionManager.createISession(String, int, boolean) line: 268 SessionManager.createSession(ServletRequest, ServletResponse, SessionAffinityContext, boolean) line: 640 WsSessionContext(SessionContext).getIHttpSession(HttpServletRequest, HttpServletResponse, boolean, boolean) line: 485 WsSessionContext(SessionContext).getIHttpSession(HttpServletRequest, HttpServletResponse, boolean) line: 419 SRTRequestContext.getSession(boolean, WebApp) line: 104 SRTServletRequest.getSession(boolean) line: 2099 SRTServletRequest.getSession() line: 2083 RequestProcessor.processLocale(HttpServletRequest, HttpServletResponse) line: 631 RequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 230 ActionServlet.process(HttpServletRequest, HttpServletResponse) line: 1482 ActionServlet.doPost(HttpServletRequest, HttpServletResponse) line: 525 ActionServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 595 ActionServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 668 ServletWrapperImpl(ServletWrapper).service(ServletRequest, ServletResponse, WebAppServletInvocationEvent) line: 1147 ServletWrapperImpl(ServletWrapper).handleRequest(ServletRequest, ServletResponse, WebAppDispatcherContext) line: 722 ServletWrapperImpl(ServletWrapper).handleRequest(ServletRequest, ServletResponse) line: 449 ServletWrapperImpl.handleRequest(ServletRequest, ServletResponse) line: 178 WebAppFilterManagerImpl(WebAppFilterManager).invokeFilters(ServletRequest, ServletResponse, IServletContext, RequestProcessor, EnumSet<CollaboratorInvocationEnum>) line: 1020 CacheServletWrapper.handleRequest(ServletRequest, ServletResponse) line: 87 WSWebContainer(WebContainer).handleRequest(IRequest, IResponse) line: 883 WSWebContainer.handleRequest(IRequest, IResponse) line: 1659 WCChannelLink.ready(VirtualConnection) line: 195 HttpInboundLink.handleDiscrimination() line: 452 HttpInboundLink.handleNewRequest() line: 511 HttpInboundLink.processRequest() line: 305 HttpInboundLink.ready(VirtualConnection) line: 276 NewConnectionInitialReadCallback.sendToDiscriminators(VirtualConnection, TCPReadRequestContext, boolean) line: 214 NewConnectionInitialReadCallback.complete(VirtualConnection, TCPReadRequestContext) line: 113 AioReadCompletionListener.futureCompleted(IAbstractAsyncFuture, Object) line: 165 AsyncFuture(AbstractAsyncFuture).invokeCallback(ICompletionListener, AbstractAsyncFuture, Object) line: 217 AsyncFuture(AsyncChannelFuture).fireCompletionActions() line: 161 AsyncFuture.completed(long) line: 138 ResultHandler.complete(AsyncFuture, int, int) line: 204 ResultHandler.runEventProcessingLoop(boolean) line: 775 ResultHandler$2.run() line: 905 ThreadPool$Worker.run() line: 1648 It is creating another session instance. need to understand why it is creating another instance.
When you open the tabs in IE, for IE its same session. So you will have only one cookie JSESSIONID per domain. when you go to localhost:9082/A - you have JSESSIONID like SESSIONID-A. when you go to localhost:9082/B - you have JSESSIONID like SESSIONID-B. So when you access application on AppSrv01, JSESSIONID goes to AppSrv01 is SESSIONID-B. Appserver doesn't know about this session id, so it thinks its a new user and creates a session. Try opening a IE-> File -> New Session and access the application on AppSrv02 you won't face the above issue. If you have something like IEWATCH or Fidler, you will be able to see the JSESSIONID going from client/browser.
There's also a setting HttpSessionIdReuse that might help with this as well. I know it works for multiple Servers in the same Cell, but I'm not sure whether it works across Profiles. http://www-01.ibm.com/support/docview.wss?uid=swg21210881
Joomla 3.2: Undefined offset: 0 in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 479
My website Joomla 3.2 website was running well recently, when I got this error message and things don't work anymore. Notice: Undefined offset: 0 in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 479 Notice: Trying to get property of non-object in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483 Warning: Creating default object from empty value in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483 Notice: Undefined offset: 0 in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 479 Notice: Trying to get property of non-object in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483 Warning: Creating default object from empty value in C:\Apache2\htdocs\ictogcio\libraries\cms\application\site.php on line 483 Error displaying the error page: Could not find template "".