Skip to content
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

Random error while loading beans from neo4j #7

Closed
dmichels opened this issue Dec 5, 2013 · 12 comments
Closed

Random error while loading beans from neo4j #7

dmichels opened this issue Dec 5, 2013 · 12 comments

Comments

@dmichels
Copy link

dmichels commented Dec 5, 2013

Hi,

sometimes I get an error while trying to load a bean from the database. Not always, but somtimes.

[error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[error] application -

! @6gfdalfig - Internal server error, for (POST) [/authenticate] ->

play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.reflect.InvocationTargetException]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.1]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at play.data.Form.bind(Form.java:391) ~[play-java_2.10.jar:2.2.1]
at play.data.Form.bindFromRequest(Form.java:215) ~[play-java_2.10.jar:2.2.1]
at controllers.Application.authenticate(Application.java:95) ~[na:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$5$$anonfun$apply$5.apply(routes_routing.scala:97) ~[na:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$5$$anonfun$apply$5.apply(routes_routing.scala:97) ~[na:na]
at play.core.Router$HandlerInvoker$$anon$7$$anon$2.invocation(Router.scala:183) ~[play_2.10.jar:2.2.1]
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at play.data.Form.bind(Form.java:388) ~[play-java_2.10.jar:2.2.1]
at play.data.Form.bindFromRequest(Form.java:215) ~[play-java_2.10.jar:2.2.1]
Caused by: java.lang.ClassCastException: neo4j.models.User cannot be cast to neo4j.models.User
at neo4j.services.UserService.authenticate(UserService.java:24) ~[na:na]
at controllers.Application$Login.validate(Application.java:60) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]

It's strange that he can't cast from neo4j.models.User to neo4j.models.User.

public boolean authenticate(final String name, final String password) {
    User user = userRepository.findByPropertyValue(User.NAME, name);

    return (user != null && user.password.equals(password));
}

But like I said: It fails randomly.

@tuxBurner
Copy link
Owner

Hi @dmichels,

thanks for the report. I will try to reproduce this. One question, are you using neo4j in embedded or remote mote ?

@dmichels
Copy link
Author

dmichels commented Dec 6, 2013

Hi,

I'm using neo4j in remote mode

@dmichels
Copy link
Author

dmichels commented Dec 7, 2013

Hi,
I think I hunted down the problem, the error occurs every time when I modified something on the code and Play reloads. Seems like the plugin doesn't get reloaded probably and the Class versions of the Play instance and the plugin differ.

@tuxBurner
Copy link
Owner

Hi,
thanks i will take a look @ it tomorrow.

@unterstein
Copy link
Collaborator

Hi Sepp,

i have the same error. Its not randomly, it occurs each time after redeployment (onStop/onStart cycle) after changing a file locally. This bug happens each time sine the 1.3.0 version. This issue never occurs in the past versions like the 1.1.1. Can you please have a look? :) I guess something is not shutdown correctly. I have an additional stacktrace:

Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: object is not an instance of declaring class; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
at org.springframework.data.neo4j.support.Neo4jExceptionTranslator.translateExceptionIfPossible(Neo4jExceptionTranslator.java:47) ~[spring-data-neo4j-3.0.0.M1.jar:na]
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58) ~[spring-tx-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) ~[spring-tx-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163) ~[spring-tx-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at $Proxy45.findByName(Unknown Source) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_11]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_11]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198) ~[spring-aop-3.2.5.RELEASE.jar:3.2.5.RELEASE]
at $Proxy46.findByName(Unknown Source) ~[na:na]
at Global$.initData(Global.scala:16) ~[na:na]

Cheers,
Jo

@tuxBurner
Copy link
Owner

Oh :(

Forgot this one over my vacations 📦

Will take a look at it tomorrow :P

@tuxBurner
Copy link
Owner

Okay problem found :)
Seems to be this problem: https://groups.google.com/forum/#!topic/play-framework/73_CijiIxWA
All entities are stuck in the reloadable class loader v1 :( I am still trying to find the fix for this but spring and classloader .... is a stoy

@tuxBurner
Copy link
Owner

Nailed it org.springframework.data.repository.core.support.RepositoryFactorySupport#getRepositoryInformation has a nice cache !!11!!! the metadata comes from the correct classloader but the cache holds the old one omfg

@tuxBurner
Copy link
Owner

https://jira.springsource.org/browse/DATACMNS-395 well i think here it broke :)

@tuxBurner
Copy link
Owner

Bugreport at spring data is open https://jira.springsource.org/browse/DATACMNS-395#comment-96947

@unterstein
Copy link
Collaborator

Hi,

is it possible to invalide the cache programmatically onStop of the playApp?

Cheers

tuxBurner pushed a commit that referenced this issue Jan 3, 2014
@tuxBurner
Copy link
Owner

Okay version 1.3.1 fixes this one have fun guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants