title: websphere 7 and (application based) open-jpa 2
body: <p>I want to not use the built in Websphere 7 jpa plugin, instead use an application WEB-INF/lib/open-jpa 2 and a proprietary persistence provider.  I cannot install the OSGI and JPA 2 feature pack for Websphere.  </p>
  
  <p>Originally, I was getting a sax parse error simply trying to load the persistence.xml (version="2" not supported). The error was thrown by a class in open-jpa 1.2.3.  When I run websphere/appserver/bin/wsjpaversion.bat, the open-jpa 1.2.3 jar is displayed.  By default it overrides the open-jpa 2 jar in the app.  I created a shared library containing the open-jpa 2 jar with this config option checked: 'Use an isolated class loader for this shared library'.  I set my application classloader to load parent last and assigned it the new shared library resource.  The 'version 2' error is gone, but there is another problem.  When I try to initialize an EntityManager I get an error:</p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: Failed to load provider from META-INF/services
      at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:121)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:91)
      at java.lang.J9VMInternals.initializeImpl(Native Method)
      at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
      ... 2 more
  Caused by: java.lang.ClassCastException: com.ibm.websphere.persistence.PersistenceProviderImpl incompatible with javax.persistence.spi.PersistenceProvider
      at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:110)
      ... 11 more
  </code></pre>
  
  <p>One more detail: inside the persistence.xml, the provider element is set to the proprietary PersistenceProviderImpl not the default Websphere persistence provider.  So where is this websphere default coming from and how do I prevent it?  (another important note: <strong>when I remove persistence.xml completely, I get the same error</strong>)</p>
  
  <p>Thank you</p>