Unable to run in JDK8

2,007 views
Skip to first unread message

smallufo

unread,
Nov 16, 2013, 6:08:00 AM11/16/13
to ninja-f...@googlegroups.com
I want to design the whole web app in Java 8
Here are the steps :
follow this page :

assign JAVA_HOME to JDK8's home
run java -version to make sure I am using JDK8

Modify the sample code : ApiController
add some lambda code in one method :
      List<String> versions = Arrays.asList("Java 7", "Java 8");
      versions.sort(String::compareTo);
      System.out.println("Language versions : " + versions);

In pom.xml
maven-compiler-plugin , source and target change to 1.8

run :
mvn jetty:run

first , it shows :
$ mvn jetty:run
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
[INFO] Scanning for projects...

then , errors occur :

18:59:24.330 [main] DEBUG o.h.ejb.packaging.AbstractJarVisitor - Filtering: controllers.ApiController
2013-11-16 18:59:24.331:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@25c2a9e3{/,[file:/Users/smallufo/Dropbox/destiny/ninja-data/src/main/webapp/, jar:file:/Users/smallufo/.m2/repository/org/webjars/tinymce-jquery/3.4.9/tinymce-jquery-3.4.9.jar!/META-INF/resources/, jar:file:/Users/smallufo/.m2/repository/org/webjars/bootstrap/3.0.0/bootstrap-3.0.0.jar!/META-INF/resources/, jar:file:/Users/smallufo/.m2/repository/org/webjars/jquery/1.9.0/jquery-1.9.0.jar!/META-INF/resources/],STARTING}{file:/Users/smallufo/Dropbox/destiny/ninja-data/src/main/webapp/}
ninja.lifecycle.FailedStartException: javax.persistence.PersistenceException: Unable to configure EntityManagerFactory
at ninja.lifecycle.LifecycleRegister.invokeTarget(LifecycleRegister.java:102)
...

Caused by: 
javax.persistence.PersistenceException: Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:387)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:58)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

Caused by: 
Caused by: 
java.lang.RuntimeException: Error while reading file:/Users/smallufo/Dropbox/destiny/ninja-data/target/classes/
at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:131)
at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:487)
at org.hibernate.ejb.Ejb3Configuration.addMetadataFromScan(Ejb3Configuration.java:477)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:363)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:58)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at com.google.inject.persist.jpa.JpaPersistService.start(JpaPersistService.java:94)
at ninja.jpa.JpaInitializer.start(JpaInitializer.java:37)




Caused by: 
java.io.IOException: invalid constant type: 18
at javassist.bytecode.ConstPool.readOne(ConstPool.java:1113)
at javassist.bytecode.ConstPool.read(ConstPool.java:1056)
at javassist.bytecode.ConstPool.<init>(ConstPool.java:150)
at javassist.bytecode.ClassFile.read(ClassFile.java:765)
at javassist.bytecode.ClassFile.<init>(ClassFile.java:109)
at org.hibernate.ejb.packaging.AbstractJarVisitor.checkAnnotationMatching(AbstractJarVisitor.java:246)


Is it hibernate's problem ?

Raphael André Bauer

unread,
Nov 16, 2013, 6:53:24 AM11/16/13
to ninja-f...@googlegroups.com
Hi smallufo,


I have no idea - but the root cause seems to be javaassist - and
javaassist does bytecode manipulation. Maybe the lib is not yet
compatible with JDK8. In any case JDK8 is a pre release version -
which may also be the problem.

Unfortunately I can not help much... You can try different / new
versions of hibernate - maybe they fix the problem...


Best,


Raphael
> --
> You received this message because you are subscribed to the Google Groups
> "ninja-framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ninja-framewo...@googlegroups.com.
> To post to this group, send email to ninja-f...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ninja-framework/CAKJWkkEsxBFchBTAy710%2BRdwYxHq4skv-d9K2Jm3GaF9G-_d%3DQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.com

smallufo

unread,
Nov 16, 2013, 7:37:47 AM11/16/13
to ninja-f...@googlegroups.com
Thanks , after I upgrade to 3.17.1-GA
It passes !

<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.17.1-GA</version>
</dependency>
            



2013/11/16 Raphael André Bauer <raphael.a...@gmail.com>

Raphael André Bauer

unread,
Nov 16, 2013, 7:41:06 AM11/16/13
to ninja-f...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages