I've a java/spring application(service) which runs fine on my machine(windows). But when I deploy the same to a linux box, I keep getting following run-time error:
Error creating bean with name 'xxx' defined in class path resource
xxxx/applicationContext.xml]: Bean instantiation via factory method failed;
nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.tangosol.net.NamedCache]: Factory method 'abc' threw exception;
nested exception is (Wrapped)
java.security.PrivilegedActionException:
java.lang.reflect.InvocationTargetException
Am new to java I'm not sure how to go about fixing this error.
Thanks.
Related
Few Error Examples :
Failed to introspect annotated methods on class
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'welcomePageHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Unsatisfied dependency expressed through method 'welcomePageHandlerMapping' parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcResourceUrlProvider' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.resource.ResourceUrlProvider]: Factory method 'mvcResourceUrlProvider' threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcResourceUrlProvider' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
I only changed the version and nothing else in the code, inside parent tag.
<version>2.7.7</version>
I am trying to run tests using playtika.testcontainers embedded-clickhouse, which used to work, but now I am getting java.lang.IllegalStateException: Failed to load ApplicationContext, caused by Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedClickHouse' defined in class path resource [com/playtika/test/clickhouse/EmbeddedClickHouseBootstrapConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.testcontainers.containers.ClickHouseContainer]: Factory method 'clickHouseContainer' threw exception; nested exception is java.lang.NoClassDefFoundError: net/jpountz/lz4/LZ4Factory.
Does anybody know if something was changed in the API?
This issue might be fixed with https://github.com/PlaytikaOSS/testcontainers-spring-boot/pull/865.
In general, I would recommend using Testcontainers for Java directly on such cases.
I am getting an error in runtime of my spring 5 application. It is working fine in debug mode in eclipse but throwing the errors while creating bean from the application context. Below I have shared the error log. I have rebuild the jar many times and changed the dependencies in manifest file but still the same error while runtime. Please advice.
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'LIQBeanFactory' defined in URL [jar:file:/D:/LoanIQ/Server/sdk-post/QNB_
GL_V92_PROD_Encr.jar!/beanRefFactory.xml]: Bean instantiation via constructor fa
iled; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicati
onContext]: Constructor threw exception; nested exception is org.springframework
.beans.factory.BeanCreationException: Error creating bean with name 'LiqTransact
ionManager' defined in class path resource [applicationContext.xml]: Initializat
ion of bean failed; nested exception is java.lang.AbstractMethodError: Receiver
class org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxy
Creator does not define or inherit an implementation of the resolved method abst
ract postProcessPropertyValues(Lorg/springframework/beans/PropertyValues;[Ljava/
beans/PropertyDescriptor;Ljava/lang/Object;Ljava/lang/String;)Lorg/springframewo
rk/beans/PropertyValues; of interface org.springframework.beans.factory.config.I
nstantiationAwareBeanPostProcessor.
I am currently working on an application that fails to run after upgrading to a newer snapshot version of a custom 3rd party dependency. Upon using this updated dependency I get the following error
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'listener': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'objectMapper' defined in class path resource [com/****/****/****/WebMvcConfig.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [com.fasterxml.jackson.databind.ObjectMapper]: Factory method 'objectMapper' threw exception; nested exception is java.lang.NullPointerException
The 'mapper' is what I am using locally, 'objectMapper' refers to a remote dependency. I realize this is may be challenging without code, but what could be causing this error? If I remove my objectmapper instance, the error only shifts to another section of the program, but the stack trace always leads to this:
Error creating bean with name 'objectMapper' defined in class path resource [com/****/****/****/WebMvcConfig.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [com.fasterxml.jackson.databind.ObjectMapper]: Factory method 'objectMapper' threw exception; nested exception is java.lang.NullPointerException
Ive tried different versions of com.fasterxml.jackson.core but that does not seem to help. Any suggestions at all would be appreciated.
Edit:
Additional Stack Trace:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cashModule' defined in file
[/Users/*****/******/*******/target/classes/*****/****/****/*****/cashModule.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'service5' defined in file
[/Users/****/******/******/target/classes/****/****/*****/*****/EventProcessingService.class]: Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventSource' defined in class path resource [com/****/****/****/******/EventConfig.class]:
Unsatisfied dependency expressed through method 'eventSource' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.stream.messaging.Source': Unsatisfied dependency expressed through field 'bindingTargetFactories'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'channelFactory' defined in class path resource [org/springframework/cloud/stream/config/BinderFactoryConfiguration.class]: Unsatisfied dependency expressed through method 'channelFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMessageChannelConfigurer' defined in class path resource [org/springframework/cloud/stream/config/BinderFactoryConfiguration.class]: Unsatisfied dependency expressed through method 'compositeMessageChannelConfigurer' parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageConverterConfigurer' defined in class path resource
[org/springframework/cloud/stream/config/BinderFactoryConfiguration.class]: Unsatisfied dependency expressed through method 'messageConverterConfigurer' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compositeMessageConverterFactory' defined in class path resource [org/springframework/cloud/stream/config/ContentTypeConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.converter.CompositeMessageConverterFactory]: Factory method 'compositeMessageConverterFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'objectMapper' defined in class path resource
[com/****/****/*****/WebMvcConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fasterxml.jackson.databind.ObjectMapper]: Factory method 'objectMapper' threw exception; nested exception is java.lang.NullPointerException
I'm running Spring Data Neo4j version 2.3.3. When I try to execute a CREATE statement through my GraphRepository, I'm getting the following exception:
org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement ... nested exception is Unclosed parenthesis
"CREATE (:line{id:1})-[:ROOT]->(:point{id:10})-[:NEXT]->(:point{id:11})-[:NEXT]->(:point{id:12})-[:NEXT]->(p:point{id:13})"
^
The ... merely hides the same thing printed below it, and the ^ appears in the correct place. As you can see if you look at my query, there is no unclosed parenthesis. What's going on here?
EDIT: For testing purposes, I tried reducing the statement to: CREATE (:line{id:1}), and I get the same result.
EDIT: I tried upgrading my pom to use version 3.0.0, and now am getting the following exception:
Error creating bean with name 'controller': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.example.model.LineRepo org.example.controller.Controller.lineRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lineRepo': Cannot resolve reference to bean 'neo4jTemplate' while setting bean property 'neo4jTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': Cannot resolve reference to bean 'graphDatabaseService' while setting bean property 'graphDatabaseService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphDatabaseService' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.neo4j.kernel.EmbeddedGraphDatabase]: Constructor threw exception; nested exception is java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#61634a3b' failed to initialize. Please see attached cause exception.
The deepest root cause exception given is:
java.lang.NoSuchMethodError: org.neo4j.kernel.impl.nioneo.store.FileSystemAbstraction.getOrCreateThirdPartyFileSystem(Ljava/lang/Class;Lorg/neo4j/helpers/Function;)Lorg/neo4j/kernel/impl/nioneo/store/FileSystemAbstraction$ThirdPartyFileSystem;
Nothing was changed other than upgrading the dependency. The 'controller' bean it is referring to is the controller I have #Autowired with my GraphRepository
Spring Data Neo4j 2.3.3 is for Neo4j 1.9, which doesn't support labels (the syntax you're using in Cypher). You need to use 3.0.0 in order to get Neo4j 2.0 support.