0
votes

I am trying to deploy war file on websphere 8.5.5.13. which is connected to oracle(11g) db and even i had created data sources connection on websphere. oracle db data source The application is getting installed but when i try to start the application gives me the following error:

[29/10/18 15:00:49:733 IST] 000001e1 SystemErr R Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index; (loaded from file:/C:/Program Files (x86)/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@180c62e2) called from class org.hibernate.cfg.annotations.EntityBinder (loaded from file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer/profiles/DefaultAppServer/installedApps/AntivirusServerNode01Cell/cream_war.ear/cream.war/WEB-INF/lib/hibernate-core-5.0.12.Final.jar by

[29/10/18 15:00:49:733 IST] 000001e1 SystemErr R Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index; (loaded from file:/C:/Program Files (x86)/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@180c62e2) called from class org.hibernate.cfg.annotations.EntityBinder (loaded from file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer/profiles/DefaultAppServer/installedApps/AntivirusServerNode01Cell/cream_war.ear/cream.war/WEB-INF/lib/hibernate-core-5.0.12.Final.jar by

I also tried changing the version of hibernate and jpa but that too didnt work. But when i deploy application without using oracle db (using h2 or derby) it runs properly.

Please help me out with this error.

Not able to find the path i have given the context path properly but still giving error

1
You have a Hibernate 3.5.6 module in your war. You should be using Hibernate 5.x.Andy Wilkinson
@Andy Thanks for the help I had removed the annotation 3.5.6 but it gave me new error. Please check the above error.ajay verma

1 Answers

1
votes

The NoSuchMethodError indicates that Hibernate is trying to call a method on javax.persistence.Table that doesn't exist. The Table class has been loaded from file:/C:/Program Files (x86)/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar so it's WAS itself that's providing the incompatible class.

By default, WAS 8.5.5 uses JPA 2.0 but it is possible to use JPA 2.1 by following the steps described here. You've already done most of the steps described in "Embedding a third-party persistence provider within an application". The one remaining step is to configure your application's class loader order so that it will prefer classes bundled with your application to those provided by the application server.