我們正試圖從休眠3.6.7升級到4.1.2,並使用Hibernate工具3.2.0至3.5.0Hibernate的工具:錯誤解析JNDI名稱
我們生成一個數據庫創建腳本螞蟻:
<hibernatetool destdir="${target}">
<jpaconfiguration persistenceunit="stdcmpOrderPersistenceUnit" propertyfile="@{propertyfile}"/>
<classpath refid="@{classpathid}"/>
<!-- the file name is relative to $destdir -->
<hbm2ddl outputfilename="@{output}" format="true" export="false" drop="false"/>
</hibernatetool>
我們的持久單元是這樣的:
我們得到以下錯誤升級後:
[hibernatetool] org.hibernate.service.jndi.JndiException: Error parsing JNDI name [jdbc/lakshmi_stdcmp]
[hibernatetool] javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
爲什麼Hibernate嘗試解析JNDI名稱,因爲PersistenceUnit上的所有信息都可用? 我們對舊版本沒有任何問題。
在任何情況下,我們如何指定一個NamingFactory? (和哪一個?)
歡迎來到Stack Overflow!雖然這可能在理論上回答這個問題,[這將是更可取的](http://meta.stackexchange.com/q/8259)在這裏包括答案的重要部分,並提供供參考的鏈接。 – Spontifixus
感謝您指出。 –
任何想法爲什麼冬眠不是這樣? – webber