Closed hsn10 closed 11 years ago
it always throws ClassNotFoundException if you put class into "nosql" package. To make it work better it needs to get classloader from play app:
Class<?> entity = Class.forName(classname, true, Play.application().classloader());
even with this fix it fails to scan annotated entity classes in "nosql" package, for some reason it see every field 2 times.
play.api.UnexpectedException: Unexpected exception[RuntimeException: Failure sca nning class(see chained exception)=class nosql.Note] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$1.apply(Appli cationProvider.scala:142) ~[play_2.10-2.1.1.jar:2.1.1] at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$1.apply(Appli cationProvider.scala:106) ~[play_2.10-2.1.1.jar:2.1.1] at scala.Option.map(Option.scala:145) ~[scala-library.jar:na] at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvi der.scala:106) ~[play_2.10-2.1.1.jar:2.1.1] at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvi der.scala:104) ~[play_2.10-2.1.1.jar:2.1.1] at scala.util.Either$RightProjection.flatMap(Either.scala:523) ~[scala-l ibrary.jar:na] Caused by: java.lang.RuntimeException: Failure scanning class(see chained except ion)=class nosql.Note at com.alvazan.orm.layer0.base.MyClassAnnotationDiscoveryListener.scanCl ass(MyClassAnnotationDiscoveryListener.java:50) ~[playorm-1.5.jar:na] at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.rescan(BaseE ntityManagerFactoryImpl.java:85) ~[playorm-1.5.jar:na] at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.setup(BaseEn tityManagerFactoryImpl.java:140) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstanceImpl(Bootst rapImpl.java:65) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstance(BootstrapI mpl.java:36) ~[playorm-1.5.jar:na] at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:61) ~[playor m-1.5.jar:na] Caused by: java.lang.RuntimeException: Failure scanning field=private long nosql .Note.Id for class=Note at com.alvazan.orm.impl.meta.scan.ScannerForClass.inspectField(ScannerFo rClass.java:209) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.scanFields(ScannerForC lass.java:202) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.scanSingle(ScannerForC lass.java:122) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.addClass(ScannerForCla ss.java:80) ~[playorm-1.5.jar:na] at com.alvazan.orm.layer0.base.MyClassAnnotationDiscoveryListener.scanCl ass(MyClassAnnotationDiscoveryListener.java:48) ~[playorm-1.5.jar:na] at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.rescan(BaseE ntityManagerFactoryImpl.java:85) ~[playorm-1.5.jar:na] Caused by: java.lang.IllegalArgumentException: class=class com.alvazan.orm.impl. meta.data.MetaClassSingle has two fields that have @NoSqlId annotation. One of them may be in a superclass. The two fields are=private long nosql.Note.Id and= private long nosql.Note.Id at com.alvazan.orm.impl.meta.scan.ScannerForClass.processIdFieldWorks(Sc annerForClass.java:253) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.inspectFieldImpl(Scann erForClass.java:220) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.inspectField(ScannerFo rClass.java:207) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.scanFields(ScannerForC lass.java:202) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.scanSingle(ScannerForC lass.java:122) ~[playorm-1.5.jar:na] at com.alvazan.orm.impl.meta.scan.ScannerForClass.addClass(ScannerForCla ss.java:80) ~[playorm-1.5.jar:na]
so in present it broken and it never worked. i remove this feature for public good.
LIST_OF_EXTRA_CLASSES_TO_SCAN_KEY
re-opening this issue as this could break playframework 1.2.x which some people are still using. playframework 1.2.x developent is still way faster development-wise than 2.x branches since there is no slow scala compiler involved. (ie. code change, load web page cycle is much faster than playframework2.x).
play2 plugin is supposed to be for play 2.x, for play1 make different branch.
lol....ah, thanks....I didn't realize I ended up on a different project ;). hmmm, vikas, you must have registered me for notifications on this one....sounds good. thanks and sorry for the spam then, Dean
lol.. yes Dean...you are partner in all the crimes :) Closing it again.