1

I have IBM Websphere 8.5.5.10. and hibernate-jpa-2.0-api-1.0.0.Final.jar is a default jar. However, I want to use a newer version -> hibernate-jpa-2.1-api-1.0.0.Final.jar. I set "Classes loaded with local class loader first (parent last)" and "Single class loader for application". In spite of that, I get the following error:

Caused by: java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index; ... Delegation Mode: PARENT_FIRST). at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:973) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] ... 

Looks like this error occurs because the old/parent's jar is loaded first. Also. please notice that Delegation Mode is PARENT_FIRST although I defined different. And I checked many times my classloader definition, restarted the application and even the server and always the same:(

Can someone help, please?

7
  • Where is that "Delegation Mode" string coming from? That usually isn't in a stack trace like that... are you dumping out the ClassLoader.toString() for that class or something like that? Commented Dec 9, 2016 at 14:23
  • No, I'm not dumping or anything similar. Websphere prints that Commented Dec 9, 2016 at 14:33
  • Ah, okay... can you paste in the stuff between the exception and that point of the message? It's an odd fit for that point in an exception message, unless the JDK is formatting this a bit odd (or Hibernate is doing its own formatting). Commented Dec 9, 2016 at 15:04
  • Caused by: java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index; (loaded from file:/C:/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@acd6f9c9) called from class org.hibernate.cfg.annotations.EntityBinder (loaded from ... com.ibm.ws.classloader.CompoundClassLoader@c11559f8[war:early-repayment/early-repayment.war] Local ClassPath: ... Parent: com.ibm.ws.classloader.CompoundClassLoader@7567bcff[PL][app:early-repayment] Delegation Mode: PARENT_FIRST). at org.hibernate... Commented Dec 9, 2016 at 15:27
  • @Ivan it would be helpful if you could include the full stack trace in the question (it's hard to read a stack trace in a comment) Commented Dec 9, 2016 at 15:32

1 Answer 1

2

This was already discussed in few posts , check this. You cannot use JPA 2.1 with WAS 8.5.5.x in a container managed way, as it only supports 2.0. You either have to upgrade to WAS 9.0, switch to WebSphere Liberty, or use JPA in application managed way.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.