New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SessionFactory fails when ClassUtils cannot load vfs URI during package scan #223

Closed
bradnussbaum opened this Issue Aug 30, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@bradnussbaum

bradnussbaum commented Aug 30, 2016

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.graphgrid.graph.Config: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.RuntimeException: org.neo4j.ogm.exception.ServiceNotFoundException: Resource: vfs:/content/graphgrid-graph-rest.war/WEB-INF/lib/graphgrid-common-core-1.0.0.b1-SNAPSHOT.jar/com/graphgrid/common/domain/graph/
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 70 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.RuntimeException: org.neo4j.ogm.exception.ServiceNotFoundException: Resource: vfs:/content/graphgrid-graph-rest.war/WEB-INF/lib/graphgrid-common-core-1.0.0.b1-SNAPSHOT.jar/com/graphgrid/common/domain/graph/
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 79 more
Caused by: java.lang.RuntimeException: org.neo4j.ogm.exception.ServiceNotFoundException: Resource: vfs:/content/graphgrid-graph-rest.war/WEB-INF/lib/graphgrid-common-core-1.0.0.b1-SNAPSHOT.jar/com/graphgrid/common/domain/graph/
at org.neo4j.ogm.utils.ClassUtils.getUniqueClasspathElements(ClassUtils.java:178)
at org.neo4j.ogm.scanner.ClassPathScanner.getUniqueClasspathElements(ClassPathScanner.java:158)
at org.neo4j.ogm.scanner.ClassPathScanner.scan(ClassPathScanner.java:130)
at org.neo4j.ogm.metadata.DomainInfo.load(DomainInfo.java:316)
at org.neo4j.ogm.metadata.DomainInfo.(DomainInfo.java:67)
at org.neo4j.ogm.MetaData.(MetaData.java:48)
at org.neo4j.ogm.session.SessionFactory.(SessionFactory.java:60)
at com.graphgrid.graph.Config.sessionFactory(Config.java:37)
at com.graphgrid.graph.Config$$EnhancerBySpringCGLIB$$1a5a8c52.CGLIB$sessionFactory$2()
at com.graphgrid.graph.Config$$EnhancerBySpringCGLIB$$1a5a8c52$$FastClassBySpringCGLIB$$92b6a654.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
at com.graphgrid.graph.Config$$EnhancerBySpringCGLIB$$1a5a8c52.sessionFactory()
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 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 80 more
Caused by: org.neo4j.ogm.exception.ServiceNotFoundException: Resource: vfs:/content/graphgrid-graph-rest.war/WEB-INF/lib/graphgrid-common-core-1.0.0.b1-SNAPSHOT.jar/com/graphgrid/common/domain/graph/
at org.neo4j.ogm.service.ResourceService.resolve(ResourceService.java:53)
at org.neo4j.ogm.utils.ClassUtils.getUniqueClasspathElements(ClassUtils.java:175)
... 97 more

@luanne

This comment has been minimized.

Show comment
Hide comment
@luanne

luanne Aug 30, 2016

Contributor

@bradnussbaum a ResourceResolver has to be provided to handle the vfs protocol. Please see #48, in particular the implementation provided by @thomashug in the later comments- https://github.com/ctpconsulting/neo4j-ogm-resourceresolver-vfs

Contributor

luanne commented Aug 30, 2016

@bradnussbaum a ResourceResolver has to be provided to handle the vfs protocol. Please see #48, in particular the implementation provided by @thomashug in the later comments- https://github.com/ctpconsulting/neo4j-ogm-resourceresolver-vfs

@bradnussbaum

This comment has been minimized.

Show comment
Hide comment
@bradnussbaum

bradnussbaum Aug 30, 2016

Thanks for this. We were able to get around using #48. It would be great to see this integrated at some point otherwise others will likely hit this as well.

bradnussbaum commented Aug 30, 2016

Thanks for this. We were able to get around using #48. It would be great to see this integrated at some point otherwise others will likely hit this as well.

@sachin2411

This comment has been minimized.

Show comment
Hide comment
@sachin2411

sachin2411 Oct 15, 2016

hello I was facing similar issue while deploying on wildfly wrote a workaround by seeing the above
But I am facing one peculiar issue on wildfly I am facing below exception on query given below
11:08:29,088 INFO [org.neo4j.ogm.drivers.bolt.request.BoltRequest](default task-64) Request: match( root:EntityNode {modelId :'7b18b9b0-f77f-4957-b973-957ee421bead' , workspaceId : '8a08ecfc562102390156214405360000'}) OPTIONAL MATCH(root)-[r:HAS_ASSOCIATION]->(m) return root,r,m with params {}
11:08:32,146 ERROR [org.springframework.boot.context.web.ErrorPageFilter](default task-64) Forwarding to error page from request [/resource/erDiagramXML/7b18b9b0-f77f-4957-b973-957ee421bead] due to exception [Scalar response queries must only return one column. Make sure your cypher query only returns one item.]: java.lang.RuntimeException: Scalar response queries must only return one column. Make sure your cypher query only returns one item.
at org.neo4j.ogm.context.EntityRowModelMapper.map(EntityRowModelMapper.java:38) [neo4j-ogm-core-2.0.4.jar:]
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.executeAndMap(ExecuteQueriesDelegate.java:116) [neo4j-ogm-core-2.0.4.jar:]
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:83) [neo4j-ogm-core-2.0.4.jar:]
at org.neo4j.ogm.session.Neo4jSession.query(Neo4jSession.java:384) [neo4j-ogm-core-2.0.4.jar:]
at com.digitate.ignio.studio.neo4j.services.EntityNodeService.getRootEntityWithAssociations(EntityNodeService.java:521) [studio-data-neo4j-1.0.jar:]
at com.digitate.ignio.studio.neo4j.services.EntityNodeService.getEffectiveEntities(EntityNodeService.java:153) [studio-data-neo4j-1.0.jar:]
at com.digitate.ignio.studio.service.model.ERModelService.getERModelForResource(ERModelService.java:217) [studio-service-1.0.jar:]
at com.digitate.ignio.studio.rest.ResourceRestService.getErDiagramXML(ResourceRestService.java:255) [studio-webservice-1.0.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_31]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]

But the same query works on embedded tomcat server (spring boot application)
[org.neo4j.ogm.drivers.bolt.request.BoltRequest](default task-64) Request: match( root:EntityNode {modelId :'7b18b9b0-f77f-4957-b973-957ee421bead' , workspaceId : '8a08ecfc562102390156214405360000'}) OPTIONAL MATCH(root)-[r:HAS_ASSOCIATION]->(m) return root,r,m with params {}
Am I missing something?
Furthur I did some debugging and found out tht in wildfly it always goes in else condition below
in ExecuteQueries class in ogm-core jar

if (type != null && session.metaData().classInfo(type.getSimpleName()) != null) {
GraphModelRequest request = new DefaultGraphModelRequest(cypher, parameters);
try (Response response = session.requestHandler().execute(request)) {
return new GraphEntityMapper(session.metaData(), session.context()).map(type, response);
}
} else {
RowModelRequest request = new DefaultRowModelRequest(cypher, parameters);
try (Response response = session.requestHandler().execute(request)) {
return mapper.map(type, response);
}
}

Can anyone help

sachin2411 commented Oct 15, 2016

hello I was facing similar issue while deploying on wildfly wrote a workaround by seeing the above
But I am facing one peculiar issue on wildfly I am facing below exception on query given below
11:08:29,088 INFO [org.neo4j.ogm.drivers.bolt.request.BoltRequest](default task-64) Request: match( root:EntityNode {modelId :'7b18b9b0-f77f-4957-b973-957ee421bead' , workspaceId : '8a08ecfc562102390156214405360000'}) OPTIONAL MATCH(root)-[r:HAS_ASSOCIATION]->(m) return root,r,m with params {}
11:08:32,146 ERROR [org.springframework.boot.context.web.ErrorPageFilter](default task-64) Forwarding to error page from request [/resource/erDiagramXML/7b18b9b0-f77f-4957-b973-957ee421bead] due to exception [Scalar response queries must only return one column. Make sure your cypher query only returns one item.]: java.lang.RuntimeException: Scalar response queries must only return one column. Make sure your cypher query only returns one item.
at org.neo4j.ogm.context.EntityRowModelMapper.map(EntityRowModelMapper.java:38) [neo4j-ogm-core-2.0.4.jar:]
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.executeAndMap(ExecuteQueriesDelegate.java:116) [neo4j-ogm-core-2.0.4.jar:]
at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:83) [neo4j-ogm-core-2.0.4.jar:]
at org.neo4j.ogm.session.Neo4jSession.query(Neo4jSession.java:384) [neo4j-ogm-core-2.0.4.jar:]
at com.digitate.ignio.studio.neo4j.services.EntityNodeService.getRootEntityWithAssociations(EntityNodeService.java:521) [studio-data-neo4j-1.0.jar:]
at com.digitate.ignio.studio.neo4j.services.EntityNodeService.getEffectiveEntities(EntityNodeService.java:153) [studio-data-neo4j-1.0.jar:]
at com.digitate.ignio.studio.service.model.ERModelService.getERModelForResource(ERModelService.java:217) [studio-service-1.0.jar:]
at com.digitate.ignio.studio.rest.ResourceRestService.getErDiagramXML(ResourceRestService.java:255) [studio-webservice-1.0.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_31]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-4.2.7.RELEASE.jar:4.2.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [spring-webmvc-4.2.7.RELEASE.jar:4.2.7.RELEASE]

But the same query works on embedded tomcat server (spring boot application)
[org.neo4j.ogm.drivers.bolt.request.BoltRequest](default task-64) Request: match( root:EntityNode {modelId :'7b18b9b0-f77f-4957-b973-957ee421bead' , workspaceId : '8a08ecfc562102390156214405360000'}) OPTIONAL MATCH(root)-[r:HAS_ASSOCIATION]->(m) return root,r,m with params {}
Am I missing something?
Furthur I did some debugging and found out tht in wildfly it always goes in else condition below
in ExecuteQueries class in ogm-core jar

if (type != null && session.metaData().classInfo(type.getSimpleName()) != null) {
GraphModelRequest request = new DefaultGraphModelRequest(cypher, parameters);
try (Response response = session.requestHandler().execute(request)) {
return new GraphEntityMapper(session.metaData(), session.context()).map(type, response);
}
} else {
RowModelRequest request = new DefaultRowModelRequest(cypher, parameters);
try (Response response = session.requestHandler().execute(request)) {
return mapper.map(type, response);
}
}

Can anyone help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment