java.lang.ClassCastException: JedisConnectionFactory cannot be cast to ConnectionFactory - rabbitmq

I'm not sure why Method "connectionFactory" is returning an instance of JedisConnecionFactory, should it not be org.springframework.amqp.rabbit.connection.ConnectionFactory?
The following exception on line "new RabbitTemplate(connectionFactory())" (see code below)
Feb 23, 2015 11:50:20 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
r:4.1.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887) [catalina.jar:7.0.39]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381) [catalina.jar:7.0.39]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.39]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.39]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.39]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0]
at java.lang.Thread.run(Thread.java:744) [na:1.8.0]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.queue.MessageQueueSender]: Factory method 'messageQueueSender' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rabbitTemplate' defined in class path resource [com/config/MessageQueueConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.rabbit.core.RabbitTemplate]: Factory method 'rabbitTemplate' threw exception; nested exception is java.lang.ClassCastException: org.springframework.data.redis.connection.jedis.JedisConnectionFactory cannot be cast to org.springframework.amqp.rabbit.connection.ConnectionFactory
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
... 23 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rabbitTemplate' defined in class path resource [com/config/MessageQueueConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.rabbit.core.RabbitTemplate]: Factory method 'rabbitTemplate' threw exception; nested exception is java.lang.ClassCastException: org.springframework.data.redis.connection.jedis.JedisConnectionFactory cannot be cast to org.springframework.amqp.rabbit.connection.ConnectionFactory
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:322) ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1.rabbitTemplate(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at com.config.MessageQueueConfig.messageQueueSender(MessageQueueConfig.java:61) ~[MessageQueueConfig.class:na]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1.CGLIB$messageQueueSender$1(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1$$FastClassBySpringCGLIB$$99208f13.invoke(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309) ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1.messageQueueSender(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.rabbit.core.RabbitTemplate]: Factory method 'rabbitTemplate' threw exception; nested exception is java.lang.ClassCastException: org.springframework.data.redis.connection.jedis.JedisConnectionFactory cannot be cast to org.springframework.amqp.rabbit.connection.ConnectionFactory
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
... 45 common frames omitted
Caused by: java.lang.ClassCastException: org.springframework.data.redis.connection.jedis.JedisConnectionFactory cannot be cast to org.springframework.amqp.rabbit.connection.ConnectionFactory
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1.connectionFactory(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at com.config.MessageQueueConfig.rabbitTemplate(MessageQueueConfig.java:75) ~[MessageQueueConfig.class:na]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1.CGLIB$rabbitTemplate$2(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1$$FastClassBySpringCGLIB$$99208f13.invoke(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309) ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at com.config.MessageQueueConfig$$EnhancerBySpringCGLIB$$68caa0b1.rabbitTemplate(<generated>) ~[spring-core-4.1.5.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
... 46 common frames omitted
#Configuation Class
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
#Configuration
#ComponentScan(basePackages={"..."})
public class MessageQueueConfig {
..
#Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(url);
connectionFactory.setUsername(username);
connectionFactory.setPassword(password);
connectionFactory.setPort(port);
return connectionFactory;
}
#Bean
public RabbitTemplate rabbitTemplate() {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory());
rabbitTemplate.setConnectionFactory(connectionFactory());
rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
rabbitTemplate.setRoutingKey("message.queue");
return rabbitTemplate;
}
}

Your #ComponentScan must be finding another configuration file with a redis connection factory bean with the same name which is overriding this one.
You can use DEBUG logging for org.springframework; it emits copious logs when resolving beans.
Alternatively, simply change your bean definition to use a different bean name: rabbitConnectionFactory()

Related

Apache Ignite NoSuchMethodError using WebFlux

Having problems initializing WebClient in Apache Ignite client node.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.codec.support.DefaultClientCodecConfigurer]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.util.xml.StaxUtils.createDefensiveInputFactory()Ljavax/xml/stream/XMLInputFactory;
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) ~[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:102) ~[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at org.springframework.http.codec.CodecConfigurerFactory.create(CodecConfigurerFactory.java:72) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.ClientCodecConfigurer.create(ClientCodecConfigurer.java:77) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder.<init>(DefaultExchangeStrategiesBuilder.java:50) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder.<clinit>(DefaultExchangeStrategiesBuilder.java:40) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
... 12 more
Caused by: java.lang.NoSuchMethodError: org.springframework.util.xml.StaxUtils.createDefensiveInputFactory()Ljavax/xml/stream/XMLInputFactory;
at org.springframework.http.codec.xml.Jaxb2XmlDecoder.<clinit>(Jaxb2XmlDecoder.java:83) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.support.BaseDefaultCodecs.initObjectReaders(BaseDefaultCodecs.java:503) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.support.BaseDefaultCodecs.initReaders(BaseDefaultCodecs.java:178) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.support.BaseDefaultCodecs.<init>(BaseDefaultCodecs.java:168) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.support.ClientDefaultCodecsImpl.<init>(ClientDefaultCodecsImpl.java:52) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.support.DefaultClientCodecConfigurer.<init>(DefaultClientCodecConfigurer.java:35) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_332]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_332]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_332]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_332]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ~[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:102) ~[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at org.springframework.http.codec.CodecConfigurerFactory.create(CodecConfigurerFactory.java:72) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.http.codec.ClientCodecConfigurer.create(ClientCodecConfigurer.java:77) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder.<init>(DefaultExchangeStrategiesBuilder.java:50) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
at org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder.<clinit>(DefaultExchangeStrategiesBuilder.java:40) ~[listener-service-1.3.8-jar-with-dependencies.jar:?]
... 12 more
Simple webclient initialization:
webClient = WebClient.builder()
.baseUrl(baseUrl)
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.build();
It seems like reason is Spring-webflux and Ignite have different Spring versions (4 and 5). Also, it can be reproduced only at Linux environment.

Ignite 2.5: IgniteQueue.removeAll() throwing NPE

I am using IgniteQueue to store some POJOs in memory which are removed at a 15 minute interval after some processing. During the processing, elements are added and removed from the queue multiple times using removeAll() api.
Below is my queue configuration -
#Override
public IgniteQueue<R> create(QueueName queueName, int capacity) {
return ignite.queue(queueName.getQueueName(), // Queue name.
capacity, // Queue capacity. 0 for unbounded queue.
getCollectionConfiguration());
}
private CollectionConfiguration getCollectionConfiguration() {
CollectionConfiguration colCfg = new CollectionConfiguration();
colCfg.setCollocated(true);
colCfg.setCacheMode(REPLICATED);
colCfg.setAtomicityMode(TRANSACTIONAL);
return colCfg;
}
Recently, we have started receiving the below NPE -
2019-08-09 18:18:39,241 ERROR [Inbound-Main-Pool-13] [TransactionId: e5b5bfe3-5246-4d54-a4d6-acd550240e13 Request ID - 27845] [ APP=AladdinTransferAgentServer, ACTION=TA_SETTLEMENT, USER=tsgops ] SettlementWorkflowProcessor - Error while processing CLIENT settlement
class org.apache.ignite.IgniteException: Failed to serialize object [typeName=LinkedList]
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:990)
at org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$QueueIterator.remove(GridCacheQueueAdapter.java:687)
at java.util.AbstractCollection.removeAll(AbstractCollection.java:376)
at org.apache.ignite.internal.processors.datastructures.GridCacheQueueProxy.removeAll(GridCacheQueueProxy.java:180)
at com.bfm.app.ta.settlement.service.support.TAOrderSettlementIgniteQueueService.removeAll(TAOrderSettlementIgniteQueueService.java:63)
at com.bfm.app.ta.settlement.service.support.TAOrderContextSettlementInputManager.removeAllFromCurrentProcessing(TAOrderContextSettlementInputManager.java:201)
at com.bfm.app.ta.settlement.service.support.TAOrderContextSettlementInputManager.lambda$removeAll$3(TAOrderContextSettlementInputManager.java:100)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.bfm.app.ta.settlement.service.support.TAOrderContextSettlementInputManager.removeAll(TAOrderContextSettlementInputManager.java:100)
at com.bfm.app.ta.settlement.service.support.TAOrderContextSettlementInputManager.removeAll(TAOrderContextSettlementInputManager.java:90)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.processOrders(SettlementWorkflowProcessor.java:602)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.lambda$null$13(SettlementWorkflowProcessor.java:405)
at java.util.HashMap.forEach(HashMap.java:1289)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.lambda$null$14(SettlementWorkflowProcessor.java:368)
at java.util.HashMap.forEach(HashMap.java:1289)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.lambda$null$15(SettlementWorkflowProcessor.java:354)
at java.util.HashMap.forEach(HashMap.java:1289)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.lambda$null$16(SettlementWorkflowProcessor.java:345)
at java.util.HashMap.forEach(HashMap.java:1289)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.lambda$executeSettlementByClientSettleDateAndCurrency$17(SettlementWorkflowProcessor.java:337)
at java.util.HashMap.forEach(HashMap.java:1289)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.executeSettlementByClientSettleDateAndCurrency(SettlementWorkflowProcessor.java:330)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.executeSettlement(SettlementWorkflowProcessor.java:302)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.lambda$processSettlementFromQueue$6(SettlementWorkflowProcessor.java:282)
at com.bfm.app.ta.settlement.locking.support.IgniteLockingService.execute(IgniteLockingService.java:39)
at com.bfm.app.ta.settlement.locking.support.IgniteLockingService.execute(IgniteLockingService.java:68)
at com.bfm.app.ta.settlement.processor.support.SettlementWorkflowProcessor.processSettlementFromQueue(SettlementWorkflowProcessor.java:281)
at com.bfm.app.ta.settlement.facade.listener.support.TASettlementEventListener.listen(TASettlementEventListener.java:49)
at com.bfm.app.ta.settlement.facade.listener.support.TASettlementEventListener.listen(TASettlementEventListener.java:19)
at com.bfm.app.ta.common.listener.support.AbstractEventListener.onMessage(AbstractEventListener.java:44)
at com.bfm.app.ta.common.listener.support.AbstractEventListener$$FastClassBySpringCGLIB$$f1379f74.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at com.bfm.app.ta.common.aop.aspect.MetricsTrackingAspect.trackMetrics(MetricsTrackingAspect.java:142)
at com.bfm.app.ta.common.aop.aspect.MetricsTrackingAspect.logMetricsForListener(MetricsTrackingAspect.java:71)
at sun.reflect.GeneratedMethodAccessor657.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at com.bfm.app.ta.core.aop.aspect.LogContextAspect.logMetricsForListener(LogContextAspect.java:43)
at sun.reflect.GeneratedMethodAccessor596.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48)
at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34)
at com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
at com.bfm.app.ta.settlement.facade.listener.support.TASettlementEventListener$$EnhancerBySpringCGLIB$$de3aafae.onMessage(<generated>)
at com.bfm.beam.listeners.BeamListenerSupport.fireIncomingMessageToListener(BeamListenerSupport.java:140)
at com.bfm.beam.listeners.BeamListenerSupport.fireIncomingMessage(BeamListenerSupport.java:103)
at com.bfm.beam.listeners.BeamListenerSupport.fireOnIncomingMessage(BeamListenerSupport.java:84)
at com.bfm.beam.SimpleBeamConnectionDriver$2.run(SimpleBeamConnectionDriver.java:326)
at com.bfm.util.TransactionId$TransactionRunnable.run(TransactionId.java:116)
at com.bfm.beam.executor.BeamWorkItem.run(BeamWorkItem.java:41)
at com.bfm.beam.executor.BeamWorkerImpl.run(BeamWorkerImpl.java:109)
at java.lang.Thread.run(Thread.java:748)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to serialize object [typeName=LinkedList]
at org.apache.ignite.internal.processors.datastructures.GridTransactionalCacheQueueImpl.removeItem(GridTransactionalCacheQueueImpl.java:211)
at org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$QueueIterator.remove(GridCacheQueueAdapter.java:682)
... 67 more
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to serialize object [typeName=LinkedList]
at org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:10050)
at org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:10108)
at org.apache.ignite.internal.processors.cache.GridCacheUtils.marshal(GridCacheUtils.java:780)
at org.apache.ignite.internal.processors.cache.GridCacheUtils.marshal(GridCacheUtils.java:753)
at org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry.marshal(IgniteTxEntry.java:902)
at org.apache.ignite.internal.processors.cache.GridCacheMessage.marshalTx(GridCacheMessage.java:372)
at org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest.prepareMarshal(GridDistributedTxPrepareRequest.java:389)
at org.apache.ignite.internal.processors.cache.GridCacheIoManager.onSend(GridCacheIoManager.java:1114)
at org.apache.ignite.internal.processors.cache.GridCacheIoManager.send(GridCacheIoManager.java:1148)
at org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture.preparePessimistic(GridNearPessimisticTxPrepareFuture.java:366)
at org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture.prepare(GridNearPessimisticTxPrepareFuture.java:176)
at org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.prepareNearTxLocal(GridNearTxLocal.java:3273)
at org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.commitNearTxLocalAsync(GridNearTxLocal.java:3333)
at org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.commit(GridNearTxLocal.java:3300)
at org.apache.ignite.internal.processors.datastructures.GridTransactionalCacheQueueImpl$4.call(GridTransactionalCacheQueueImpl.java:200)
at org.apache.ignite.internal.processors.cache.GridCacheUtils.retryTopologySafe(GridCacheUtils.java:1479)
at org.apache.ignite.internal.processors.datastructures.GridTransactionalCacheQueueImpl.removeItem(GridTransactionalCacheQueueImpl.java:189)
... 68 more
Caused by: class org.apache.ignite.binary.BinaryObjectException: Failed to serialize object [typeName=LinkedList]
at org.apache.ignite.internal.binary.BinaryClassDescriptor.write(BinaryClassDescriptor.java:835)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal0(BinaryWriterExImpl.java:206)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:147)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:134)
at org.apache.ignite.internal.binary.GridBinaryMarshaller.marshal(GridBinaryMarshaller.java:251)
at org.apache.ignite.internal.binary.BinaryMarshaller.marshal0(BinaryMarshaller.java:82)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:58)
at org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:10044)
... 84 more
Caused by: class org.apache.ignite.binary.BinaryObjectException: Failed to serialize object [typeName=T2]
at org.apache.ignite.internal.binary.BinaryClassDescriptor.write(BinaryClassDescriptor.java:835)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal0(BinaryWriterExImpl.java:206)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:147)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:134)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.doWriteObject(BinaryWriterExImpl.java:496)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.doWriteCollection(BinaryWriterExImpl.java:764)
at org.apache.ignite.internal.binary.BinaryClassDescriptor.write(BinaryClassDescriptor.java:707)
... 91 more
Caused by: class org.apache.ignite.binary.BinaryObjectException: Failed to write field [name=val1]
at org.apache.ignite.internal.binary.BinaryFieldAccessor.write(BinaryFieldAccessor.java:159)
at org.apache.ignite.internal.binary.BinaryClassDescriptor.write(BinaryClassDescriptor.java:807)
... 97 more
Caused by: class org.apache.ignite.binary.BinaryObjectException: Failed to marshal object with optimized marshaller: org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$RemoveProcessor#6d82c986
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal0(BinaryWriterExImpl.java:186)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:147)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal(BinaryWriterExImpl.java:134)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.doWriteObject(BinaryWriterExImpl.java:496)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.writeObjectField(BinaryWriterExImpl.java:1160)
at org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.write0(BinaryFieldAccessor.java:682)
at org.apache.ignite.internal.binary.BinaryFieldAccessor.write(BinaryFieldAccessor.java:155)
... 98 more
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to serialize object: org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$RemoveProcessor#6d82c986
at org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller.marshal0(OptimizedMarshaller.java:206)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:58)
at org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:10044)
at org.apache.ignite.internal.binary.BinaryWriterExImpl.marshal0(BinaryWriterExImpl.java:179)
... 104 more
Caused by: java.lang.NullPointerException
at org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$RemoveProcessor.writeExternal(GridCacheQueueAdapter.java:1021)
at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectOutputStream.writeExternalizable(OptimizedObjectOutputStream.java:317)
at org.apache.ignite.internal.marshaller.optimized.OptimizedClassDescriptor.write(OptimizedClassDescriptor.java:814)
at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectOutputStream.writeObject0(OptimizedObjectOutputStream.java:240)
at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectOutputStream.writeObjectOverride(OptimizedObjectOutputStream.java:158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
at org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller.marshal0(OptimizedMarshaller.java:201)
... 107 more
P.S. We don't have any class T2 with field val1
Also, the error is not reproducible locally nor on environment on demand. Also, it occurs only once and then every subsequent calls to remove from queue work fine.
Can someone please help with this issue?
Thanks.

Ignite compute broadcast closure - class not found exception

The code final Collection<Long> result = ignite.compute(group).broadcast(() -> 42L);
Throws an exception about not being to find the lambda's declaring class. What am I missing?
package com.example;
class IgniteSandbox() {
...
public static void main(String... args) {
...
final Collection<Long> result = ignite.compute(group).broadcast(() -> 42L);
}
}
java.lang.ClassNotFoundException: com.example.IgniteSandbox
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8608)
at org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:349)
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:688)
... 30 common frames omitted
Wrapped by: org.apache.ignite.binary.BinaryInvalidTypeException: com.example.IgniteSandbox
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:697)
at org.apache.ignite.internal.binary.BinaryUtils.doReadClass(BinaryUtils.java:1631)
at org.apache.ignite.internal.binary.BinaryUtils.doReadClass(BinaryUtils.java:1568)
at org.apache.ignite.internal.binary.BinaryUtils.doReadClass(BinaryUtils.java:1545)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.readClass(BinaryReaderExImpl.java:380)
at org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.readFixedType(BinaryFieldAccessor.java:902)
at org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.read0(BinaryFieldAccessor.java:698)
at org.apache.ignite.internal.binary.BinaryFieldAccessor.read(BinaryFieldAccessor.java:183)
... 23 common frames omitted
Wrapped by: org.apache.ignite.binary.BinaryObjectException: Failed to read field [name=capturingClass]
at org.apache.ignite.internal.binary.BinaryFieldAccessor.read(BinaryFieldAccessor.java:187)
at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:870)
... 22 common frames omitted
Wrapped by: org.apache.ignite.binary.BinaryObjectException: Failed to deserialize object [typeName=java.lang.invoke.SerializedLambda]
at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:909)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714)
at org.apache.ignite.internal.binary.BinaryUtils.doReadObject(BinaryUtils.java:1793)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.readObject(BinaryReaderExImpl.java:1329)
at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2.readBinary(GridClosureProcessor.java:1872)
at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:860)
... 16 common frames omitted
Wrapped by: org.apache.ignite.binary.BinaryObjectException: Failed to deserialize object [typeName=org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2]
at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:909)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714)
at org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:310)
at org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:99)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9962)
... 10 common frames omitted
Wrapped by: org.apache.ignite.IgniteCheckedException: Failed to deserialize object [typeName=org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2]
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9968)
at org.apache.ignite.internal.processors.job.GridJobWorker.initialize(GridJobWorker.java:440)
... 9 common frames omitted
Wrapped by: org.apache.ignite.IgniteException: Failed to deserialize object [typeName=org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2]
at org.apache.ignite.internal.processors.job.GridJobWorker.initialize(GridJobWorker.java:459)
at org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1117)
at org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1921)
at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1556)
at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1184)
at org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:125)
at org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Did you enable peerClassLoading?
If not, you should have com.example.IgniteSandbox class with all dependencies on all nodes participating in computation.

ClassNotFoundException in CacheJdbcStoreExample run on cluster

I have a cluster with 2 nodes. Then I tried to run the CacheJdbcStoreExample in apache-ignite-fabric-2.1.0-bin/examples.But I got following exception:
visor> [06:51:41,113][SEVERE][tcp-disco-msg-worker-#13%null%][TcpDiscoverySpi] Failed to unmarshal discovery custom message.
class org.apache.ignite.IgniteCheckedException: Failed to find class with given class loader for unmarshalling (make sure same versions of all classes are available on all nodes or enable pee
r-class-loading) [clsLdr=sun.misc.Launcher$AppClassLoader#4aa4ceeb, cls=org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcStoreExample$1] at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:124)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:94)
at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:143)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9733)
at org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage.message(TcpDiscoveryCustomEventMessage.java:81)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.notifyDiscoveryListener(ServerImpl.java:5436)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processCustomMessage(ServerImpl.java:5321)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2629)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2420)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$MessageWorkerAdapter.body(ServerImpl.java:6576)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.body(ServerImpl.java:2506)
at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Caused by: java.lang.ClassNotFoundException: org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcStoreExample$1
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8465)
at org.apache.ignite.marshaller.jdk.JdkMarshallerObjectInputStream.resolveClass(JdkMarshallerObjectInputStream.java:54)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1817)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1982)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1917)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1527)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:420)
at java.util.ArrayList.readObject(ArrayList.java:771)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2118)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:420)
at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:121)
... 12 more
I decompiled CacheJdbcStoreExample$1.class and got following code:
CacheJdbcStoreExample$1
package org.apache.ignite.examples.datagrid.store.jdbc;
import javax.cache.configuration.Factory;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
import org.h2.jdbcx.JdbcConnectionPool;
class CacheJdbcStoreExample$1
implements Factory<CacheStoreSessionListener>
{
public CacheStoreSessionListener create()
{
CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
lsnr.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
return lsnr;
}
}
SO I think there is something wrong at row 90 in CacheJdbcStoreExample source code:
// Configure JDBC session listener.
cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
#Override public CacheStoreSessionListener create() {
CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
lsnr.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
return lsnr;
}
});
If I run the example on only one node not a cluster, it's OK.
What should I do to fix it?
The problem is that you configured a cache with a factory of CacheStoreSessionListener-s, but this factory is not visible from other nodes as they don't have it in their classpath.
You should start additional remote nodes with org.apache.ignite.examples.ExampleNodeStartup class from examples module or add examples module to the classpath of other nodes.

No [ManagedType] was found for the key class [entitiy class] in the Metamodel

I am working on a project using spring-data-jpa(1.3.2.RELEASE), eclipselink(2.5.1) over netbeans(8.0) with glassfish server(4) and maven.
The project is running fine until the second deployment in the running server. This is the error.
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'appLanguageManagerSpringImp': Injection of
autowired dependencies failed;
nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private com......AppLanguageRepository
com......AppLanguageManagerSpringImp.languageRepo;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'appLanguageRepository': FactoryBean threw
exception on object creation;
nested exception is java.lang.IllegalArgumentException: No
[ManagedType] was found for the key class
[com.pixieuniverse.nostalgia.model.entity.EAppPrefLanguage] in the
Metamodel - please verify that the [Managed] class was referenced in
persistence.xml using a specific
com.pixieuniverse.nostalgia.model.entity.EAppPrefLanguage
property or a global
false element.
Error generates when it calls to spring data code of following
//org.springframework.context.annotation.AnnotationConfigApplicationContext
new AnnotationConfigApplicationContext(ApplicationConfig.class)
This is the stackrace
java.lang.Exception: DEBUG STACK TRACE for PoolBackedDataSource.close().
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.close(AbstractPoolBackedDataSource.java:417)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:327)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:510)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:486)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:455)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:487)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
at com.pixieuniverse.nostalgia.model.crud.spring.impl.ImpFactorySpring.<init>(ImpFactorySpring.java:28)
at com.pixieuniverse.nostalgia.model.crud.ImpFactory.getInstance(ImpFactory.java:21)
at com.pixieuniverse.nostalgia.vc.servlet.util.AppServletContextListener.contextInitialized(AppServletContextListener.java:30)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5362)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:743)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)
at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2278)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1924)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appLanguageManagerSpringImp': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.pixieuniverse.nostalgia.model.crud.spring.repository.AppLanguageRepository com.pixieuniverse.nostalgia.model.crud.spring.impl.AppLanguageManagerSpringImp.languageRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appLanguageRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.pixieuniverse.nostalgia.model.entity.EAppPrefLanguage] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.pixieuniverse.nostalgia.model.entity.EAppPrefLanguage</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
at com.pixieuniverse.nostalgia.model.crud.spring.impl.ImpFactorySpring.<init>(ImpFactorySpring.java:28)
at com.pixieuniverse.nostalgia.model.crud.ImpFactory.getInstance(ImpFactory.java:21)
at com.pixieuniverse.nostalgia.vc.servlet.util.AppServletContextListener.contextInitialized(AppServletContextListener.java:30)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5362)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:743)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)
This is my persistance.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" ...>
<persistence-unit name="PU">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<!-- Error generates with or without <exclude-unlisted-classes>false</exclude-unlisted-classes> -->
<class>com.pixieuniverse.nostalgia.model.entity.EAppPrefLanguage</class>
<class>com.pixieuniverse.nostalgia.model.entity.EAppPrefLoginType</class>
</persistence-unit>
</persistence>
Please shed some light
EDIT
Now I have deleted the Persistance.xml and updated the code to work without persistance.xml but still the same error.
#Bean
#Autowired
public EntityManagerFactory entityManagerFactory(DataSource bcDataSource) {
EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter();
vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.MySQLPlatform");
vendorAdapter.setGenerateDdl(true);
vendorAdapter.setShowSql(false);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setPackagesToScan("com.pixieuniverse.nostalgia.model.entity");
factory.setJpaVendorAdapter(vendorAdapter);
factory.setDataSource(bcDataSource);
Properties properties = new Properties();
properties.setProperty("eclipselink.weaving", "false");
factory.setJpaProperties(properties);
factory.afterPropertiesSet();
return factory.getObject();
}
Any hints please?