this is my first time using a obfuscator (ProGuard) for obfuscation of my code. I have two J2EE projects EJB and webProject. Currently I am obfuscating only my EJB.jar project and it is also hosting webservices but before i reach that part i am getting an error
I successfully generated the output jar using ProGuard GUI app, but when I deploy that jar on my server (wildfly) it gave me this exception:
org.hibernate.AnnotationException: No identifier specified for entity: com.metadatatool.b.a
This b.a
is the obfuscated code original names were different.
This exception is basically being invoked on a entity i.e. a View and it has a @Id
identifier it works normal if I don't obfuscate my code but when I do it gives me this error.
I am using the -keep attributes
feature of ProGuard but still i am getting this error
EJB uses reflection and requires that some classes keep their original names, methods and annotations when they go through obfuscation. To fix your problem, you need add a couple of rules such as:
-keepattributes RuntimeVisibleAnnotations
-keep @javax.persistence.* class * {
*;
}
to make ProGuard not strip annotations and not touch classes annotated with @Id
.