Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Discovered a fix for the issue at least with what I am working with: IBM WebSphere 7 and MyEclipse Blue (Spring), or Bling, ver. 10.6. I created an application that has dependencies on other projects, one of these using Hibernate 3.6.3, requiring JPA 2.0. IBM WS loads JPA 1.0 to support itself ahead of JPA 2.0 and resolves all references to JPA to ver. 1.0. In the case of IBM WS, this causes the error reported above. The only fix I have come across since now includes adding JPA 2.0 as a shared library, then setting the server to load that library ahead of its native classes, similar to the method discussed here: </p> <p><a href="http://www.mkyong.com/websphere/websphere-7-javaxpersistenceonetomany-orphanremoval-error/" rel="nofollow">http://www.mkyong.com/websphere/websphere-7-javaxpersistenceonetomany-orphanremoval-error/</a></p> <p>But our server admins will not allow changes to the server-wide classloader policy. So I still needed to find a way to get my project to use JPA 2.0 and not 1.0. I tried a lot of things but finally went for a Hail Mary and it worked.</p> <p>The fix is to add the JPA 2.0 .jar file to your .war and .ear projects and then edit the Class-Path line in the manifest file in both your .war and .ear projects to point to the .jar files. It seems they must be in both or the approach will not work, so the JPA 2.0 .jar has to be in both the .war and .ear.</p> <p>In your app (.war project), add hibernate-jpa-2.0-api-1.0.0.Final.jar to the project root. MyEclipse Blue will show it as a file at that location and also listed under "Referenced Libraries" in the Package Explorer view. Then open the manifest file at /WebRoot/META-INF/MANIFEST.MF and make sure the Class-Path line reads:</p> <pre><code>Class-Path: /hibernate-jpa-2.0-api-1.0.0.Final.jar </code></pre> <p>In your .ear project, add hibernate-jpa-2.0-api-1.0.0.Final.jar to folder 'lib' at your project root. If there is no 'lib' folder there, create one. Then in /META-INF/MANIFEST.MF, make sure the Class-Path line reads:</p> <pre><code>Class-Path: /lib/hibernate-jpa-2.0-api-1.0.0.Final.jar </code></pre> <p>Make sure all files are saved and do a clean build. Then export the .ear and deploy it as usual by the Integrated Solutions Console. But there is another thing you must do before the change will work; it does require changing the class-load policy for the app, but not the server. You are much more likely to get your WAS admin to go for that than changing the classloader policy for the entire server. To make the necessary change, after installing the .ear file, follow the left-hand nav bar click trail <code>"Applications\Application Types\Websphere enterprise applications"</code> and click on the name of your application, then click "Class loading and <code>update detection"</code>. Then select <code>"Classes loaded with local class loader first (parent last)"</code> under <code>"Class loader order"</code>, then click <code>Apply</code>, then <code>Save</code>. Now back at click trail <code>"Applications\Application Types\Websphere enterprise applications"</code>, either start or restart your application. Test out your app and hopefully you will be good to go. </p> <p><strong>Final note:</strong> Evey time you re-deploy your .ear file, you will need to set the classloader option I just discussed. The preference is not retained between deployments.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload