• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Weblogic trying to load PersistenceProvider from wrong jar

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good Day all ,

I am having this problem since many days now , I was able to successfully deploy JPA2.0 appliaction on weblogic 10.3.3 , the application can run select queries using JPA. But when I try to run a create or update information on the same table I get below exception


This is very strange because in my persistence.xml I have provided hibernate as JPA provider , the persistence unit defined is like below

And I have also provided the package level preferences in my weblogic.xml , below is my weblogic.xml file. As you can see I have explicitly told weblogic to prefer web app packages still it’s trying to load org.eclipse.persistence.jpa.PersistenceProvider instead of a persistenceProvider from hibernate jar.Please help me out here I am stuck at this point



I have created the same post at oracle web site
https://forums.oracle.com/forums/thread.jspa?threadID=2474374&stqc=true
 
sajjad ahmad
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was trying to debug my code and found while debugging that when I try to fetch list using JPA in my project I am getting it , but only when I try to save a record by clicking the save button on my page it doesn’t even go to create method defined in controller that’s very strange that probably means the URL pattern defined for this page which works fine in VM server is somehow not working in weblogic because this could be the only reason why I am not able to go at that break point I have.

It’s weird, also I get the Class cost exception like already mentioned


I wonder where the hell this exception is coming from ? I will dig it more and update the forum accordingly.
The fact that the persistence context is being loaded for all finder operations and even for deleting a record but giving above exception when trying to create or update a record is driving me crazy now :S.
If there was a problem loading PersitenceProvider why was it loaded when I was trying to fetch records and why it is giving ClassCastException now?
 
sajjad ahmad
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I finally figured a workaround for this problem , and now JPA2.0 application is running fine on Weblogic10.3.3 server.

I found out that the problem was actully relted to hibernate validator , In my JPA method code I had a "@Valid" annotation along with the object I was getting , I was trying to use hibernate validator to validate the object before persisting it , there I was getting all these exceptions.
To get my application running on server I had to remove those @valid annotations from my JPA code and now everything is working fine. But now I am relying on page level validation which in my case is good enough.
However the ideal solution would be to find a compatable hibernat validator jar and keep the @valid annotations in your project for the sake of better validation.
For now this solution is working for me , ASA I get time I will try to find the hibernate validator jar which can work with this version on server we have and will love to have server side validation as well.
I hope this workaround will save some days of someone out there .
 
sajjad ahmad
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please find all the other details on my below blog post

http://javaiscoool.blogspot.com/2012/12/deploy-jpa20-application-on-weblogic1033.html
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic