Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Java 8 #96

Closed
2 of 4 tasks
sbliven opened this issue Mar 17, 2016 · 16 comments
Closed
2 of 4 tasks

Update to Java 8 #96

sbliven opened this issue Mar 17, 2016 · 16 comments
Assignees
Milestone

Comments

@sbliven
Copy link
Member

sbliven commented Mar 17, 2016

It would be nice to switch EPPIC to Java 8. This can't happen quite yet, but I wanted to start an issue to track progress.

Dependency support:

  • BioJava
  • GWT (should be in GWT 2.8, currently in beta)
  • GXT (4.0 with GWT 2.8)
  • Hibernate (Supposedly works with 3., but extended support in 5. through hibernate-java8)
@josemduarte
Copy link
Contributor

Isn't the update of EPPIC to Java 8 independent of the libraries? I mean EPPIC can be in 8 whilst the libraries can still be 7.

@sbliven
Copy link
Member Author

sbliven commented Mar 18, 2016

We can try it, but I think that all the reflection that happens in GWT might mean that eppic-wui would actually not work with GWT<2.8. That's certainly easy enough to test.

@josemduarte
Copy link
Contributor

Alright I've tried it out and all works! So I've pushed the commit and a build on dev server.

I've also upgraded the java jdk to 8 in both dev and production servers.

We should check if some of the libraries can be updated to newer versions now that we are on 8.

@josemduarte
Copy link
Contributor

So there seems to be an issue with current hibernate version and java 8. The entity manager is currently broken. We need to upgrade hibernate-entitymanager and perhaps other dependencies.

The issue while running a script in dbtools:

javax.persistence.PersistenceException: Unable to configure EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:375)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
    at eppic.db.tools.DBHandler.<init>(DBHandler.java:86)
    at eppic.db.tools.ClusterCrystalForms.main(ClusterCrystalForms.java:135)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at eppic.db.tools.Main.callTheTool(Main.java:23)
    at eppic.db.tools.Main.main(Main.java:13)
Caused by: java.lang.RuntimeException: Error while reading file:/home/spencer/dev/biojava/eppic/eppic-dbtools/target/uber-eppic-dbtools-3.0-SNAPSHOT.jar
    at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:131)
    at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:475)
    at org.hibernate.ejb.Ejb3Configuration.addMetadataFromScan(Ejb3Configuration.java:465)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:351)
    ... 10 more
Caused by: java.io.IOException: invalid constant type: 18
    at javassist.bytecode.ConstPool.readOne(ConstPool.java:1027)
    at javassist.bytecode.ConstPool.read(ConstPool.java:970)
    at javassist.bytecode.ConstPool.<init>(ConstPool.java:127)
    at javassist.bytecode.ClassFile.read(ClassFile.java:722)
    at javassist.bytecode.ClassFile.<init>(ClassFile.java:109)
    at org.hibernate.ejb.packaging.AbstractJarVisitor.checkAnnotationMatching(AbstractJarVisitor.java:243)
    at org.hibernate.ejb.packaging.AbstractJarVisitor.executeJavaElementFilter(AbstractJarVisitor.java:209)
    at org.hibernate.ejb.packaging.AbstractJarVisitor.addElement(AbstractJarVisitor.java:170)
    at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:119)
    at org.hibernate.ejb.packaging.AbstractJarVisitor.getMatchingEntries(AbstractJarVisitor.java:146)
    at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:128)
    ... 13 more
Unable to configure EntityManagerFactory
Error initializing Entity Manager Factory

A related SO thread:

http://stackoverflow.com/questions/24281235/error-creating-entitymanagerfactory-due-to-error-tying-to-scan-jar-file

@josemduarte
Copy link
Contributor

Now fixed by upgrading hibernate to latest 4 version. I'm still playing with upgrading to 5.

@josemduarte
Copy link
Contributor

I've finally managed to upgrade to hibernate 5 (just merged the branch into master), so now we are in latest and greatest hibernate version.

@sbliven
Copy link
Member Author

sbliven commented May 8, 2016

Awesome, @josemduarte. Do I need to do anything to migrate my local database, or does this happen automatically?

@josemduarte
Copy link
Contributor

The migration should be automatic. It is controlled by a setting in the persistence.xml file. At the moment it is set to hibernate.hbm2ddl.auto=update which means that the schema will be updated upon start-up.

Hibernate 5 has some more foreign key constraints in the tables so it does need to update those. In the full database in dev server, that took quite a while but in a smaller db it should be pretty fast.

@sbliven
Copy link
Member Author

sbliven commented May 24, 2016

I'm going to reopen this issue since we can't actually use Java 8 methods in the WUI currently. For this, we need to move to GWT 2.8 and GXT 4.0. I've started a gwt2.8 branch to work on this. Getting the java to compile was fairly straightforward, but I can't get the java to js working yet. It's possible there are still bugs due to the beta.

@sbliven sbliven reopened this May 24, 2016
@josemduarte
Copy link
Contributor

Is GXT 4.0 available in maven central? I couldn't find it

@sbliven
Copy link
Member Author

sbliven commented May 25, 2016

@josemduarte It's not on maven central, but Sencha host a repo for it. I seem to have forgotten to check in that file originally. The branch should compile now.

@josemduarte
Copy link
Contributor

Cool thanks! Actually I've just checked out branch gwt2.8 and it compiled without problems. I haven't tried running it though.

@sbliven
Copy link
Member Author

sbliven commented May 25, 2016

I had it running on dev for a while today. It compiles fully, but the pages fail to load. I see one additional javascript error relative to the master branch (some variable is null/undefined), but I haven't been able to debug it. GWT 2.8 is supposed to be much easier to debug, so I'll have to try setting up the embedded mode.

If you try to debug it yourself, I recommend the following modifications. It would be good to set up a dev maven profile for these options:

  • In eppic-wui/src/main/java/ch/systemsx/sybit/crkwebui/Crkwebui.gwt.xml, uncomment the user.agent line. This reduces the number of compiled permutations from 42 to 18. I would love to get this down to one permutation but I haven't figured out how.
  • In eppic-wui/pom.xml, add the line <style>PRETTY</style> to the configuration section of the gwt-maven-plugin to disable minification

@josemduarte
Copy link
Contributor

GWT 2.8 is supposed to be much easier to debug, so I'll have to try setting up the embedded mode.

That is supposedly the theory, if I understand they introduced the SuperDev mode that makes things easier. A year ago or so we tried to set it up (with 2.7) but we never managed. Perhaps it got easier now.

In any case it would be fantastic to have some debugging capabilities for the client code, for the last year we've had to live without a debug mode.

@sbliven
Copy link
Member Author

sbliven commented Nov 8, 2016

How important is it to use BioJava 5? Can we postpone upgrading until 3.1, given these problems?

@sbliven sbliven added this to the 3.1 milestone Nov 8, 2016
@sbliven sbliven self-assigned this Nov 8, 2016
@josemduarte
Copy link
Contributor

I don't think using BioJava 5 is urgent. Plus it would require a lot of refactoring due to the new protein structure data model. Definitely let's leave BioJava 5 for 3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants