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

IllegalArgumentException after reloading classes. #36

Open
vkolotov opened this issue Nov 28, 2011 · 3 comments
Open

IllegalArgumentException after reloading classes. #36

vkolotov opened this issue Nov 28, 2011 · 3 comments

Comments

@vkolotov
Copy link

After "hot reloading" classes of play application (e.g. changing source code while application is running) elasticsearch fails.
It happens when you just want to make a simple query. BUT, if you run application/test without code changes (even several times one after another), elastic search works well.

java.lang.IllegalArgumentException: Can not set java.util.List field models.Article.editions to models.Article
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
at java.lang.reflect.Field.get(Field.java:358)
at play.modules.elasticsearch.util.ReflectionUtil.getFieldValue(ReflectionUtil.java:115)
at play.modules.elasticsearch.mapping.impl.CollectionFieldMapper.addToDocument(CollectionFieldMapper.java:77)
at play.modules.elasticsearch.mapping.impl.PlayModelMapper.addModel(PlayModelMapper.java:130)
at play.modules.elasticsearch.mapping.impl.PlayModelMapper.addModel(PlayModelMapper.java:26)
at play.modules.elasticsearch.adapter.ElasticSearchAdapter.indexModel(ElasticSearchAdapter.java:147)
at play.modules.elasticsearch.ElasticSearchIndexAction.invoke(ElasticSearchIndexAction.java:53)
at play.modules.elasticsearch.ElasticSearchIndexer.doJob(ElasticSearchIndexer.java:54)
at play.jobs.Job.doJobWithResult(Job.java:50)
at play.jobs.Job.call(Job.java:146)
at play.jobs.Job$1.call(Job.java:66)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

@bgooren
Copy link
Contributor

bgooren commented Nov 28, 2011

Aha! thanks for pointing this out.
We hit this sometimes as well and I was wondering what caused it since it doesn't show up while unit testing.

@bgooren
Copy link
Contributor

bgooren commented Nov 28, 2011

I think the reason for this is simply because two different classloaders/classes are involved (one for the old version of the class, one for the new version).
This explains why quite often in the play code classes are referred to by name instead of by getClass().equals(class).

bgooren added a commit to bgooren/playframework-elasticsearch that referenced this issue Dec 5, 2011
@bgooren
Copy link
Contributor

bgooren commented Dec 5, 2011

Fixed. We had a class cache somewhere which was not emptied on hot reload.

@bgooren bgooren mentioned this issue Dec 5, 2011
iskra-vitaly added a commit to iskra-vitaly/playframework-elasticsearch that referenced this issue Mar 6, 2012
* org_elastic/master: (28 commits)
  0.4 release
  Add MapperTransformer
  Use AbstractFieldMapper#getFieldValue()
  Some refactoring; Mapper prefix folded into AbstractFieldMapper
  feliperazeek#32 Added a transformer which uses a mapper
  Make sure the user has not requested unknown fields
  Minor restructuring
  Made AFM#addField() non-static so we can access meta directly
  Log json for index operation
  Fix for feliperazeek#36 (Class references not cleaned up on hot reload)
  Fix for feliperazeek#38 (@onetomany causes "Type not allowed" exception)
  Fix for feliperazeek#34 (cannot parse indexed date on record retrieval)
  Upgrade to ES 0.18.5
  Fix for feliperazeek#37 (do not index @transient fields)
  Fixed elasticSearch tag path (fixes bug in _at least_ 1.2.4-RC3)
  Fixed route indentation to make file more readable
  Add support for Float conversion to ReflectionUtil
  Releasing 0.3
  setQuery(QueryBuilder) is available from es-0.17.0 (See ES issue 994)
  Log type mapping
  ...

Conflicts:
	conf/routes
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

2 participants