Nick's Tech Blog: Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.ProviderUtil

Pages

Tuesday, June 14, 2011

Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.ProviderUtil

Problem

Received the following stacktrace from Websphere7.

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]
: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax.persistence.spi.ProviderUtil
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:939)
... 50 more
Caused by: java.lang.NoClassDefFoundError: javax.persistence.spi.ProviderUtil
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.(HibernateJpaVendorAdapter.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 52 more
Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.ProviderUtil
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:90)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:509)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:509)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
... 61 more


Basically, it's complaining that JPA2 libraries aren't installed.
       
Solution
  1. Stop the Websphere7 server.
  2. Install "OSGi Applications and Java Persistence API (JPA) 2.0 feature pack" using "IBM Installation Manager"
    1. http://www-01.ibm.com/software/webservers/appserv/was/featurepacks/osgi/instopt/index.html
  3. At the last step of the installation, select "Open Profile Management Tool"
  4. From the "Profile Management Tool 7.0" window...
  5. Go to the "Profile Management Tool" tab
  6. Select the relevant profile.
  7. Select "Augment..."
  8. At "Select the augment to apply to the selected profile", select "Application server with Java Persistence API 2.0 feature"
  9. Apply, then Exit the tool.
  10. Start up the Websphere7 server.

Additional Notes

Problem: The Installation Manager does not synchronize with WebSphere Application Server if WebSphere Application Server is at higher fix pack level than recommended for the feature pack.

Solution: Download the latest version of WebSphere Application Server import repositories and add it to the Installation Manager:
http://public.dhe.ibm.com/software/websphere/downloads/was/import/

No comments:

Post a Comment