1

I have a Vaadin application and I'm trying to incorporate Spring Data Neo4j 4 into it. In my Vaadin app, I use JPAContainer to access some MySQL database, and JPAContainer depends on the javax.persistence jar in order to access it. When I incorporate SDN 4, I've been able to successfully persist Node and relationship entities into my remote Neo4j server, but my JPAContainer fails. This is the error I receive:

[EL Info]: 2015-08-12 08:57:44.44--ServerSession(1000914620)--EclipseLink, version: Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd

[EL Info]: connection: 2015-08-12 08:57:46.984--ServerSession(1000914620)--file:/Users/jlam/Downloads/johnson-master/Sprint02d/target/Sprint02d-1.0-SNAPSHOT/WEB-INF/classes/_Basil_v1_PersistenceUnit login successful

Aug 12, 2015 8:58:01 AM com.vaadin.server.DefaultErrorHandler doDefault

SEVERE: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persistence/criteria/CriteriaBuilder; at com.vaadin.addon.jpacontainer.provider.LocalEntityProvider.createFilteredQuery(LocalEntityProvider.java:379) at com.vaadin.addon.jpacontainer.provider.CachingSupport.getIds(CachingSupport.java:477) at com.vaadin.addon.jpacontainer.provider.CachingSupport$FilterCacheEntry.getAllIds(CachingSupport.java:408) at com.vaadin.addon.jpacontainer.provider.CachingSupport.getAllEntityIdentifiers(CachingSupport.java:750) at com.vaadin.addon.jpacontainer.provider.CachingMutableLocalEntityProvider.getAllEntityIdentifiers(CachingMutableLocalEntityProvider.java:106)

It says I successfully connected to MySQL database. I've checked by getting the size of my JPAContainers and it matches the size of my database. I believe the issue is that SDN 4 also comes with some other version of the javax.persistence dependency and in this version, the CriteriaBuilder method does not exist. JPAContainer is getting confused and is using the SDN 4 javax.persistence dependency rather than the one that is listed javax.persistence-2.1.0.jar in my dependencies folder.

When I remove the my SDN 4 dependency, everything works fine. Any ideas on if my theory is correct or how to overcome this issue? Thanks!

jlam1618
  • 25
  • 6

1 Answers1

0

You're right, the javax.persistence dependency shouldn't be included in SDN 4.

If you're using the snapshot (4.0.0.BUILD-SNAPSHOT), it's been removed- please give it a go. Otherwise, the next release won't have this dependency.

Luanne
  • 19,145
  • 1
  • 39
  • 51
  • I just updated my dependency to 4.0.0.BUILD-SNAPSHOT and it's still giving me the same error. Do I basically just have to wait until the next release comes out? If so, do you know when it will be released? – jlam1618 Aug 12 '15 at 19:20
  • Are you quite sure you've got the right dependency? Maybe force an update with mvn -U ? I've just checked the dependency:tree again and I don't see a javax.persistence dependency – Luanne Aug 13 '15 at 03:21
  • Sorry, you're right. Everything is working now after forcing the update. Thank you for your help! – jlam1618 Aug 13 '15 at 13:13