This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 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?
Joined: Jan 23, 2003
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 .
Joined: Jan 23, 2003
Please find all the other details on my below blog post