Closed rnentjes closed 2 years ago
This does not yet make sense to me.
maven plugin marks the generated-sources/annotations
It is up to IntelliJ to detect that generated-sources/annotations is generated source (when the IDE compiles and builds rather than maven). IntelliJ usually detects this automatically but sometimes does not and I suspect this could be the issue here. There isn't a maven plugin which "marks the generated-source/annotations" as far as I know (usually IntelliJ auto detects this).
Can you check if IntelliJ has marked target/generated-sources/annotations as a directory containing "generated source" (blue folder). If that isn't the case and you right mouse -> mark directory as -> generated sources ... on target/generated-sources/annotations that fixes the issue correct?
So when we only use the plugin to build it will not even find the generated query beans.
I think you are saying when you are building using IntelliJ (and not maven) it doesn't "see" the classes that result from generated sources (the query beans).
Can you clarify? There is no problem using maven from the command line right?
Thanks, Rob.
So maven build works fine, and after we have build it the generated query beans are found by intellij.
When we build the imported maven project with intellij and the ebean enhancement plugin we notice the following problems:
Btw, one of our colleges still has an old plugin version installed and that one still works fine (I'll try to find out exact version).
Just now I tried with the javaagent option and that one doesn't enhance either. Maybe we missed some changes in required configuration?
The generated-sources/annotations folder is not added to the sources in intellij, but this can be manually fixed
Yes.
(although it loses this settings after a clean).
I have not experienced this behavior and I think we need to try and understand what is going on here. I'm wondering if you can create a little maven project that reproduces the problem and then see if I can reproduce it (IntelliJ losing the knowledge that generated-sources/annotations is generated source). I suspect there is some difference in the intellij setup.
The query beans in the generated-sources/annotations folder are compiled, but are not enhanced.
The new plugin doesn't enhance at compile time but instead runs as a javaagent whenever we run a test or main via intellij the java command line has the -javaagent
added to it (so enhanced at class load time).
The EbeanAlreadyEnhancedMarker annotation is not found on the query bean classes.
Looking at the .class files yes they won't be enhanced (yet). Run test or main and look at the command line and see the -javaagent
specified there (and they are enhanced at class load time).
Just now I tried with the javaagent option and that one doesn't enhance either
You'll need to be more specific on what is being done here. Maybe a screen shot of exactly what the run configuration is? ... but note that the Ebean intellij plugin does add the -javaagent
to the command line - this is how it works now (and clicking on the first line of output /usr/lib/jvm/.../bin/java ...
expands that output to show something like.
/usr/lib/jvm/jdk1.8/bin/java -ea -javaagent:/home/rob/.IntelliJIdea2019.3/config/plugins/ebean-idea/lib/ebean-agent-12.1.5.jar ... (lots of stuff)
old plugin version installed and that one still works fine
The old plugin works differently. It hooks into intellij compile and enhances the .class files (on the file system) after they are compiled. The old plugin code is a lot more complex than the new one (which just adds the -javaagent
to the java command line.
Thank you for the explanations, it helps a lot it understanding what happens.
I got a little further in debugging this, it looks like the Query beans are enhanced, but the properties are null when we try to run a query.
Take for example the class TaskDefinition, this is in the log regarding enhancement:
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: Skip intercepting static field LOG
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... add marker field "<domain>.admin.tasks.model.entity.TaskDefinition"
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... add _ebean_props field
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... add intercept and identity fields
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[<init>] desc[(Ljava/lang/String;Ljava/lang/String;Lcom/cronutils/model/CronType;Ljava/lang/String;L<domain>/admin/tasks/model/enums/TaskType;)V] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... adding intercept <init> in CONSTRUCTOR:(Ljava/lang/String;Ljava/lang/String;Lcom/cronutils/model/CronType;Ljava/lang/String;L<domain>/admin/tasks/model/enums/TaskType;)V OWNER/SUPER:<domain>/common/base/model/BaseEntity
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... constructorInitializationDone <domain>/common/base/model/BaseEntity
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_name(Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_description(Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_running(Z)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_startTime(Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_maxDuration(J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_cronType(Lcom/cronutils/model/CronType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_cron(Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_lastRun(Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_taskType(L<domain>/admin/tasks/model/enums/TaskType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[<init>] desc[(Ljava/lang/String;Ljava/lang/String;Lcom/cronutils/model/CronType;Ljava/lang/String;L<domain>/admin/tasks/model/enums/TaskType;J)V] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... Constructor PUTFIELD replaced with:_ebean_set_maxDuration(J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[calculateNextRun] desc[()V] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:calculateNextRun ()V field:cronType > _ebean_get_cronType ()Lcom/cronutils/model/CronType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:calculateNextRun ()V field:cron > _ebean_get_cron ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: PUTFIELD method:calculateNextRun ()V field:nextRun > _ebean_set_nextRun (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:calculateNextRun ()V field:cronType > _ebean_get_cronType ()Lcom/cronutils/model/CronType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getLOG] desc[()Lorg/slf4j/Logger;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: Skip intercepting static method getLOG
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getId] desc[()J] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getId ()J field:id > _ebean_get_id ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getName] desc[()Ljava/lang/String;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getName ()Ljava/lang/String; field:name > _ebean_get_name ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getDescription] desc[()Ljava/lang/String;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getDescription ()Ljava/lang/String; field:description > _ebean_get_description ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[isRunning] desc[()Z] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:isRunning ()Z field:running > _ebean_get_running ()Z
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getStartTime] desc[()Ljava/util/Date;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getStartTime ()Ljava/util/Date; field:startTime > _ebean_get_startTime ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getMaxDuration] desc[()J] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getMaxDuration ()J field:maxDuration > _ebean_get_maxDuration ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[setMaxDuration] desc[(J)V] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: PUTFIELD method:setMaxDuration (J)V field:maxDuration > _ebean_set_maxDuration (J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getCronType] desc[()Lcom/cronutils/model/CronType;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getCronType ()Lcom/cronutils/model/CronType; field:cronType > _ebean_get_cronType ()Lcom/cronutils/model/CronType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getCron] desc[()Ljava/lang/String;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getCron ()Ljava/lang/String; field:cron > _ebean_get_cron ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getLastRun] desc[()Ljava/util/Date;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getLastRun ()Ljava/util/Date; field:lastRun > _ebean_get_lastRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getNextRun] desc[()Ljava/util/Date;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getNextRun ()Ljava/util/Date; field:nextRun > _ebean_get_nextRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[getTaskType] desc[()L<domain>/admin/tasks/model/enums/TaskType;] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: GETFIELD method:getTaskType ()L<domain>/admin/tasks/model/enums/TaskType; field:taskType > _ebean_get_taskType ()L<domain>/admin/tasks/model/enums/TaskType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: --- #### method name[<clinit>] desc[()V] sig[null]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... --- #### enhance existing static init method
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... adding default constructor, super class: <domain>/common/base/model/BaseEntity
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... flush deferred: ALOAD 0
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... adding intercept <init> in CONSTRUCTOR:()V OWNER/SUPER:<domain>/common/base/model/BaseEntity
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... constructorInitializationDone <domain>/common/base/model/BaseEntity
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... add _ebean_getPropertyNames() and _ebean_getPropertyName()
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... add _ebean_getIntercept() and _ebean_setIntercept()
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: adding equals() hashCode() and _ebean_getIdentity() with Id field id index:0 primitive:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... getIdentity compare primitive field[id] type[J]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: enhanced
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method <init> (Ljava/lang/String;Ljava/lang/String;Lcom/cronutils/model/CronType;Ljava/lang/String;L<domain>/admin/tasks/model/enums/TaskType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method <init> (Ljava/lang/String;Ljava/lang/String;Lcom/cronutils/model/CronType;Ljava/lang/String;L<domain>/admin/tasks/model/enums/TaskType;J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method calculateNextRun ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getLOG ()Lorg/slf4j/Logger;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getId ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getName ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getDescription ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method isRunning ()Z
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getStartTime ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getMaxDuration ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method setMaxDuration (J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getCronType ()Lcom/cronutils/model/CronType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getCron ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getLastRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getNextRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method getTaskType ()L<domain>/admin/tasks/model/enums/TaskType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method <clinit> ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method <init> ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getMarker ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getPropertyNames ()[Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getPropertyName (I)Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getIntercept ()Lio/ebean/bean/EntityBeanIntercept;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_intercept ()Lio/ebean/bean/EntityBeanIntercept;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_id ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_id (J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_id ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_id (J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_name ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_name (Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_name ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_name (Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_description ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_description (Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_description ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_description (Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_running ()Z
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_running (Z)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_running ()Z
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_running (Z)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_startTime ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_startTime (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_startTime ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_startTime (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_maxDuration ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_maxDuration (J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_maxDuration ()J
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_maxDuration (J)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_cronType ()Lcom/cronutils/model/CronType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_cronType (Lcom/cronutils/model/CronType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_cronType ()Lcom/cronutils/model/CronType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_cronType (Lcom/cronutils/model/CronType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_cron ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_cron (Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_cron ()Ljava/lang/String;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_cron (Ljava/lang/String;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_lastRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_lastRun (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_lastRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_lastRun (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_nextRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_nextRun (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_nextRun ()Ljava/util/Date;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_nextRun (Ljava/util/Date;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_get_taskType ()L<domain>/admin/tasks/model/enums/TaskType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_set_taskType (L<domain>/admin/tasks/model/enums/TaskType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getni_taskType ()L<domain>/admin/tasks/model/enums/TaskType;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setni_taskType (L<domain>/admin/tasks/model/enums/TaskType;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getField (I)Ljava/lang/Object;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getFieldIntercept (I)Ljava/lang/Object;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setField (ILjava/lang/Object;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setFieldIntercept (ILjava/lang/Object;)V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_getIdentity ()Ljava/lang/Object;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method equals (Ljava/lang/Object;)Z
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method hashCode ()I
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_setEmbeddedLoaded ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_isEmbeddedNewOrDirty ()Z
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: ... checking method _ebean_newInstance ()Ljava/lang/Object;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/TaskDefinition msg: skipped query bean enhancement
ebean-enhance> cls: com/sun/proxy/$Proxy94 msg: ignore class
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition$Alias msg: interfaces: enhancedEntity[false] transactional[false]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition$Alias msg: ... checking method <init> ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition$Alias msg: ... checking method <clinit> ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition$Alias msg: skipped query bean enhancement
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition$Alias msg: no enhancement on class
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: interfaces: enhancedEntity[false] transactional[false]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ignore static methods on type query bean alias ()L<domain>/admin/tasks/model/entity/query/QTaskDefinition;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ignore static methods on type query bean forFetchGroup ()L<domain>/admin/tasks/model/entity/query/QTaskDefinition;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... adding marker annotation
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ignore static methods on type query bean access$000 ()L<domain>/admin/tasks/model/entity/query/QTaskDefinition;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ignore static methods on type query bean <clinit> ()V
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _id assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _name assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _description assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _running assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _startTime assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _maxDuration assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _cronType assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _cron assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _lastRun assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _nextRun assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: ... add method _taskType assocProperty:false rootBean:true
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/QTaskDefinition msg: enhanced as query bean
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: interfaces: enhancedEntity[false] transactional[false]
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... adding marker annotation
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: leaving method as is - fetch ([Lio/ebean/typequery/TQProperty;)Ljava/lang/Object; ([Lio/ebean/typequery/TQProperty<L<domain>/admin/tasks/model/entity/query/QTaskDefinition;>;)TR;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: leaving method as is - fetchQuery ([Lio/ebean/typequery/TQProperty;)Ljava/lang/Object; ([Lio/ebean/typequery/TQProperty<L<domain>/admin/tasks/model/entity/query/QTaskDefinition;>;)TR;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: leaving method as is - fetchCache ([Lio/ebean/typequery/TQProperty;)Ljava/lang/Object; ([Lio/ebean/typequery/TQProperty<L<domain>/admin/tasks/model/entity/query/QTaskDefinition;>;)TR;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: leaving method as is - fetchLazy ([Lio/ebean/typequery/TQProperty;)Ljava/lang/Object; ([Lio/ebean/typequery/TQProperty<L<domain>/admin/tasks/model/entity/query/QTaskDefinition;>;)TR;
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add fields, basic constructor, main constructor
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _id assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _name assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _description assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _running assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _startTime assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _maxDuration assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _cronType assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _cron assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _lastRun assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _nextRun assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: ... add method _taskType assocProperty:false rootBean:false
ebean-enhance> cls: <domain>/admin/tasks/model/entity/query/assoc/QAssocTaskDefinition msg: enhanced as query bean
Looks fine (I think), but when we try to query the property is null, while the class is enhanced:
Now I don't think it will be that easy to replicate our environment (it's a big project thats under development for years). But I can debug the agent atm, do you have some pointers where the field access of this property is enhanced so I can check why that doesn't happen?
What is in your ebean.mf file ?
I tried with and without a ebean.mf file, when I used the ebean.mf file I put the top package of our project in it.
I will check if the dao class is enhanced as well, here is the output:
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: interfaces: enhancedEntity[false] transactional[false]
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.findWithoutNextRun()Ljava/util/List;:19
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.findWithoutNextRun()Ljava/util/List;:19
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.findReadyToRun()Ljava/util/List;:24
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.findReadyToRun()Ljava/util/List;:24
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.updateTaskToRunning(L<package>/admin/tasks/model/entity/TaskDefinition;)Z:29
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.updateTaskToRunning(L<package>/admin/tasks/model/entity/TaskDefinition;)Z:29
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.updateTaskToRunningFinished(L<package>/admin/tasks/model/entity/TaskDefinition;)V:48
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: method - profileId:0 method:<package>/admin/tasks/dao/TaskDefinitionDao.updateTaskToRunningFinished(L<package>/admin/tasks/model/entity/TaskDefinition;)V:48
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: methods:[findWithoutNextRun, findReadyToRun, updateTaskToRunning, updateTaskToRunningFinished] qp:0 tp:4 profileLocation:false
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: enhanced transactional
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: ... checking method <init> ()V
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: ... checking method findWithoutNextRun ()Ljava/util/List;
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: ... checking method findReadyToRun ()Ljava/util/List;
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: ... checking method updateTaskToRunning (L<package>/admin/tasks/model/entity/TaskDefinition;)Z
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: ... checking method updateTaskToRunningFinished (L<package>/admin/tasks/model/entity/TaskDefinition;)V
ebean-enhance> cls: <package>/admin/tasks/dao/TaskDefinitionDao msg: skipped query bean enhancement
Rob, we have identified the cause of our problem.
If no ebean.mf file is found, then in class DetectQueryBean, method isQueryBeanPackage, always returns false. As entityPackages is empty.
/**
* Check that the class is in an expected package (sub package of a package containing entity beans).
*/
private boolean isQueryBeanPackage(String domainPackage) {
for (String aPackage : entityPackages) {
if (domainPackage.startsWith(aPackage)) {
return true;
}
}
return false;
}
Tomcat is used for development. Ebean agent does not pick up the web application classpath, that is why ebean.mf is not found.
Is it possible to keep track of the manifest information per classloader?
Tomcat is used for development. Ebean agent does not pick up the web application classpath, that is why ebean.mf is not found.
Ok.
Is it possible to keep track of the manifest information per classloader?
Hmmm.
The agent transform() method takes a classloader ... but currently that isn't (at least in this case) the classloader that the agent uses to load the manifest. So it's possible that using that classloader to read the manifest file would work in this case.
Tomcat is used for development
How exactly are you using Tomcat in development? How is tomcat run, is the agent added to that command line or ??
On Thu, 5 Dec 2019 at 23:52, casmir notifications@github.com wrote:
Rob, we have identified the cause of our problem.
If no ebean.mf file is found, then in class DetectQueryBean, method isQueryBeanPackage, always returns false. As entityPackages is empty.
/* Check that the class is in an expected package (sub package of a package containing entity beans). */ private boolean isQueryBeanPackage(String domainPackage) { for (String aPackage : entityPackages) { if (domainPackage.startsWith(aPackage)) { return true; } } return false; }
Tomcat is used for development. Ebean agent does not pick up the web application classpath, that is why ebean.mf is not found.
Is it possible to keep track of the manifest information per classloader?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ebean-orm-tools/ebean-idea-enhancer/issues/4?email_source=notifications&email_token=AABTATOTQFZY5S7DUY73MFLQXDMP7A5CNFSM4JT3JFS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGAKBGQ#issuecomment-562077850, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABTATKGPIRBKUX5HOFTUALQXDMP7ANCNFSM4JT3JFSQ .
In development we run tomcat from intellij. We tried both using the plugin which adds the agent to the tomcat jvm and adding the agent manually through VM options. In both cases the ebean.mf file is not found.
Our work-around atm is to add ebean.mf to the tomcat classpath.
If our analysis is correct then right now the ebean.mf will never be picked up from a war file running in a container.
How exactly are you using Tomcat in development? How is tomcat run, is the agent added to that command line or ??
Configured a local tomcat server configuration, added war file to be deployed at startup.
The agent is indeed being added to that command line.
....\bin\catalina.bat run
Using CLASSPATH: "...\bin\bootstrap.jar;...\bin\tomcat-juli.jar"
Command line argument: -javaagent: ...\.ebean-idea\lib\ebean-agent-12.1.5.jar
Note the old IDEA plugin is at: https://github.com/ebean-orm-tools/ebean-idea-enhancer-old
If our analysis is correct then right now the ebean.mf will never be picked up from a war file running in a container
Perhaps said differently it is "The ebean.mf can't be loaded from the classloader of the container but instead needs to use the classloader of the webapp" ... that would seem right.
On Fri, 6 Dec 2019 at 23:36, casmir notifications@github.com wrote:
How exactly are you using Tomcat in development? How is tomcat run, is the agent added to that command line or ??
Configured a local tomcat server configuration, added war file to be deployed at startup.
[image: tomcat_config] https://user-images.githubusercontent.com/939698/70316338-cb2b0800-181b-11ea-8acc-818567de8778.PNG [image: tomcat_startup] https://user-images.githubusercontent.com/939698/70316337-cb2b0800-181b-11ea-8bf8-17b47518772b.PNG
The agent is indeed being added to that command line.
....\bin\catalina.bat run Using CLASSPATH: "...\bin\bootstrap.jar;...\bin\tomcat-juli.jar" Command line argument: -javaagent: ....ebean-idea\lib\ebean-agent-12.1.5.jar
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ebean-orm-tools/ebean-idea-enhancer/issues/4?email_source=notifications&email_token=AABTATOLCPNFOSCWDN6I24TQXITKPA5CNFSM4JT3JFS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGDWQHY#issuecomment-562522143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABTATI7LO4WNEQYA5DOHLTQXITKPANCNFSM4JT3JFSQ .
You can try this agent by:
ebean-agent-12.1.7-SNAPSHOT.zip
download ebean-agent-12.1.7-SNAPSHOT.zip
mkdir ~/.ebean
unzip ebean-agent-12.1.7-SNAPSHOT.zip
mv ebean-agent-12.1.7-SNAPSHOT.jar ~/.ebean
Toggle the Ebean IntelliJ plugin off and then on (what that does is trigger the ebean intellij plugin to look for an agent in ~/.ebean ... and then switch to using that if one is there).
Run and you will see output to sysout like:
-----------------------------------------------------------
ebean-agent loading manifests using classloader: 739498517 cl:jdk.internal.loader.ClassLoaders$AppClassLoader@2c13da15
ebean-agent loaded entityPackages via: 739498517 cl:jdk.internal.loader.ClassLoaders$AppClassLoader@2c13da15 [org.ebean.monitor.domain]
-----------------------------------------------------------
ebean-agent loading manifests using classloader: 2102553920 cl:jdk.internal.loader.ClassLoaders$PlatformClassLoader@7d526d40
...
The code for this agent is on: https://github.com/ebean-orm/ebean-agent/pull/133/files
The effective change is that the transformer passes the classloader (for each class being enhanced) through to the AgentManifest. Which then checks if it is a new classloader that it hasn't seen and if so will look to load the ebean.mf file(s). If manifest files are loaded that adds to entityPackages then these are added to DetectQueryBean.
So in theory this ought to see the classloader of the webapp (and be able to load the ebean.mf using that).
Hi, this is great, thank you.
Works perfectly for us.
Tomcat does seem to use a new classloader everytime we load some resources from the classpath (every request). So there are a lot of these messages (like hundreds):
ebean-agent loading manifests using classloader: 1043581134 cl:sun.reflect.DelegatingClassLoader@3e33c8ce
-----------------------------------------------------------
ebean-agent loading manifests using classloader: 1363218790 cl:sun.reflect.DelegatingClassLoader@51411166
-----------------------------------------------------------
ebean-agent loading manifests using classloader: 1275358226 cl:sun.reflect.DelegatingClassLoader@4c046c12
-----------------------------------------------------------
ebean-agent loading manifests using classloader: 711922648 cl:sun.reflect.DelegatingClassLoader@2a6f13d8
-----------------------------------------------------------
As this is only in development mode this doesn't bother us, but just so you now.
Ok cool. That tomcat behaviour using all those classloaders is interesting
I think I am happy with that change so I'll have another review of it tonight and then will look to merge that into master tonight (removing the sout println stuff) and post back here once I've done that.
Cheers, Rob.
On Tue, 10 Dec 2019 at 03:50, Rien notifications@github.com wrote:
Hi, this is great, thank you.
Works perfectly for us.
Tomcat does seem to use a new classloader everytime we load some resources from the classpath (every request). So there are a lot of these messages (like hundreds):
ebean-agent loading manifests using classloader: 1043581134 cl:sun.reflect.DelegatingClassLoader@3e33c8ce
ebean-agent loading manifests using classloader: 1363218790 cl:sun.reflect.DelegatingClassLoader@51411166
ebean-agent loading manifests using classloader: 1275358226 cl:sun.reflect.DelegatingClassLoader@4c046c12
ebean-agent loading manifests using classloader: 711922648 cl:sun.reflect.DelegatingClassLoader@2a6f13d8
As this is only in development mode this doesn't bother us, but just so you now.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ebean-orm-tools/ebean-idea-enhancer/issues/4?email_source=notifications&email_token=AABTATNJDGBJMPHB2K7SJBTQXZLLLA5CNFSM4JT3JFS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGJN3GA#issuecomment-563273112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABTATLBYJKU5I2I3RN36ILQXZLLLANCNFSM4JT3JFSQ .
I have merged those changes into ebean-agent master.
ebean-agent-12.1.7-SNAPSHOT.zip
Uploaded the updated ebean-agent (from master branch) without the sys out console logging. If you can confirm that works as expected that would be great.
Cheers, Rob.
Seems to work great, thank you!
I'll close this one.
When we use the ebean plugin in intellij it doesn't enhance the query beans.
The beans are generated on build and compiled somewhere in the build process, but runtime the properties on the query beans are null.
We also use manve, and I noted that the maven plugin marks the generated-sources/annotations as a source folder. While the enhancer plugin doesn't. So when we only use the plugin to build it will not even find the generated query beans.
Because maven is unable to do an incremental build it would help us a lot if we could use the regular build instead during development.