Unclosed Parenthesis exception on CREATE in spring-data-neo4j - java

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.

Related

playtika.testcontainers Error creating bean with name 'embeddedClickHouse'

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.

Runtime error in creating beans. java.lang.AbstractMethodError:

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.

Issue with creating bean

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.

where will i get ActivePivot.lic for ActivePivot In Memory Analytical tool. I am trying to run MDX query from Java

where will i get ActivePivot.lic for ActivePivot In Memory Analytical tool. I am trying to run MDX query from Java. But getting below error,
SEVERE: Error loading Quartet FS license: License could not be found
either in the classpath (ActivePivot.lic) neither at the system
property location 'activepivot.license' = null neither at the
environment variable location 'ACTIVEPIVOT_LICENSE' = null
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'cubeJettyConfig': Injection of autowired
dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: protected com.qfs.store.IDatastore
com.met.oxf.qfs.cfg.CubeJettyConfig.datastore; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'datastore' defined in class
com.met.oxf.qfs.cfg.DatastoreConfig: Instantiation of bean failed;
nested exception is
org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public com.qfs.store.IDatastore
com.met.oxf.qfs.cfg.DatastoreConfig.datastore(com.quartetfs.biz.pivot.definitions.IActivePivotManagerDescription)]
threw exception; nested exception is
java.lang.UnsupportedOperationException: The current license does not
enable the 'datastore' component, only one store can be defined in the
schema, instead of 10
Can you contact the person who generated the license for you through QFS jira
It seems you do not have datastore module enabled and your intance uses 10 stores
This is why you have such message

WebAppConfiguration doesn't play well with ContextConfiguration?

I have an existing Java app using Spring MVC 3.2.1. The existing unit tests all work fine. Now I'm trying to a new unit test, using the #WebAppConfiguration annotation for the first time, and it's blowing up with a wacky error.
Here's my new unit test, taken almost verbatim from this page:
#RunWith(SpringJUnit4ClassRunner.class)
#WebAppConfiguration
#ContextConfiguration(locations={"classpath:war-test-context.xml"})
#Transactional
public class GenericPageControllerTest {
#Autowired
private WebApplicationContext webApplicationContext;
private MockMvc mockMvc;
#Before
public void setup() {
this.mockMvc = webAppContextSetup(this.webApplicationContext).build();
}
#Test
public void testControllerSecurityTestThingyTestWithALongNameTest() throws Exception {
this.mockMvc.perform(get("/payOptions.html"))
.andExpect(redirectedUrl("/login.html"));
}
}
Here's the error I'm getting:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [war-test-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [war-test-context.xml]: Cannot resolve reference to bean 'persistenceUnitManager' while setting bean property 'persistenceUnitManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceUnitManager' defined in class path resource [war-test-context.xml]: Cannot resolve reference to bean 'caDataSource' while setting bean property 'dataSources' with key [TypedStringValue: value [caDataSource], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'caDataSource': Invocation of init method failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from ServletContext resource [/database/myapp_schema.sql]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [war-test-context.xml]: Cannot resolve reference to bean 'persistenceUnitManager' while setting bean property 'persistenceUnitManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceUnitManager' defined in class path resource [war-test-context.xml]: Cannot resolve reference to bean 'caDataSource' while setting bean property 'dataSources' with key [TypedStringValue: value [caDataSource], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'caDataSource': Invocation of init method failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from ServletContext resource [/database/myapp_schema.sql]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceUnitManager' defined in class path resource [war-test-context.xml]: Cannot resolve reference to bean 'caDataSource' while setting bean property 'dataSources' with key [TypedStringValue: value [caDataSource], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'caDataSource': Invocation of init method failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from ServletContext resource [/database/myapp_schema.sql]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'caDataSource': Invocation of init method failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from ServletContext resource [/database/myapp_schema.sql]
Caused by: org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from ServletContext resource [/database/myapp_schema.sql]
Caused by: org.springframework.jdbc.datasource.init.CannotReadScriptException: Cannot read SQL script from ServletContext resource [/database/myapp_schema.sql]
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/database/myapp_schema.sql]
Other tests using just the #ContextConfiguration annotation find this file and instantiate this bean just fine. Can anyone tell me why the #WebAppConfiguration bean is making it throw up? Here's the configuration section it's telling me won't work:
<jdbc:embedded-database id="caDataSource" type="HSQL">
<jdbc:script location="database/myapp_schema.sql"/>
<jdbc:script location="database/myapp_data.sql"/>
</jdbc:embedded-database>
The files are on the classpath, but they're in a different project - that might be the only wrinkle. Anyone got any ideas, or handy links?
Looks like this is the reason.
When you use WebApplicationContext you lose the ability to use classpath: configuration or other stuff, and are limited to whatever's in /src/main/webapp (or another location as provided).
WebAppContext javadoc is here.

Categories

Resources