![](/img/trans.png)
[英]Could not open JPA EntityManager for transaction; nested exception is java.lang.NoSuchMethodError - Spring-Starter-JPA
[英]Could not open jpa entitymanager for transaction. nested exception is java.lang.nosuchmethod error
在點擊 PUT 和 POST API 時出現此錯誤。 嘗試了多種解決方案,但沒有運氣。 你能幫我解決一下嗎。
嵌套異常是 org.springframework.transaction.CannotCreateTransactionException:無法打開 JPA EntityManager 進行事務處理; 嵌套異常是 java.lang.NoSuchMethodError: org.springframework.orm.jpa.JpaTransactionManager.$VJpaTransactionObjectset]
java.lang.NoSuchMethodError: org.springframework.orm.jpa.JpaTransactionManager$JpaTransactionObject.setReadOnly(Z)V at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:405) ~[spring-orm-5.2. 3.RELEASE.jar:5.2.3.RELEASE]
這個問題基本上是因為版本不匹配。 它主要發生在您更新 spring 版本時。 當更新的 spring 版本與您的其他版本(如 spring-orm、spring-jdbc 等)不匹配時,會出現此問題。 在我的情況下,spring-jdbc 有兩個 jars(一個由 spring 啟動提供,另一個是外部添加的。)請檢查並嘗試使用最新版本(您可以在此處獲取 jar 的版本)或被許多人使用並且沒有漏洞。 如果最新的一個不起作用,請檢查另一個。 您必須僅根據試錯法找出適合您的 spring 版本的版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.