Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine DataNucleus 3.1.1 Unexpected Exception Error

Trying to find a way to get rid of this error on eclipse.

DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
Encountered a problem: Unexpected exception

Here is the log

java.lang.RuntimeException: Unexpected exception
    at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
    at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
    at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
    ... 2 more
Caused by: java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.datanucleus.enhancer.asm.ASMClassEnhancer.getClassNameForFileName(ASMClassEnhancer.java:272)
    at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:727)
    at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)
    at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)
    ... 7 more

I have two versions of java, one is 1.8.0_25, the other is 1.7.0_46

this is my path

 C:\Program Files (x86)\Java\jre7\bin;;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\ProgramData\Oracle\Java\javapath;

and as a default I use the jre7 on eclipse, dont know what else to mention here. I found no solutions clearly explained here or on the other websites rather than trying to change the java version, tried all java instances on my computer, uninstalled and installed again. I am guessing it may be about java and datanucleus compability issue, but currently using the java7 and the plugins i am using were downloaded automatically from eclipse so no clue. If you need any clarifications, ask me out please.

jar files

like image 603
Karavana Avatar asked Nov 06 '14 00:11

Karavana


3 Answers

If you are using Java 8, you need to set the compiler compliance level to 1.7 in project properties. You will also need to change the java facet version

Compiler ComplianceJava Facet Version

like image 173
Pankaj Bodani Avatar answered Nov 15 '22 06:11

Pankaj Bodani


Note that (GoogleAppEngine Enhancer Error Code 1:)

App Engine doesn't work with Java 1.8. Try doing it again, with Java 1.7

Setting Java 1.7 in Project settings solves me the problem.

like image 45
matteolel Avatar answered Nov 15 '22 06:11

matteolel


Well like I have guessed, it is all about the compatibility issue. If you are getting this error, make sure EVERYTHING your eclipse AND your computer use is the same version of java everywhere. What I mean is you need to check; In eclipse, from the top menu choose Project->Properties, then make sure all the versions of java used by eclipse are the same.

build path

AND

LIBRARIES

AND

compiler

and of course your environment variable should point to the same version that eclipse uses.

environment

Hope this helps. Post comments if you found it unclear. Getting errors before even started coding sucks :p

like image 23
Karavana Avatar answered Nov 15 '22 08:11

Karavana