2013-07-02 31 views
0

我在eclipse-Juno/EE上用postgreSQL9.2使用Hibernate 3.6.4。Hibernate/postgreSQL

我不能夠run--不斷收到以下錯誤日誌:

16:07:18,605 INFO [main] Main - javax.xml.transform.TransformerFactory=null 
16:07:18,636 INFO [main] Main - java.endorsed.dirs=C:\Program Files\Java\jre7\lib\endorsed 
16:07:18,746 INFO [main] Main - launchFile: C:\Users\AYSE\workspace\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml 

16:07:20,478 FATAL [main] Main - No embedded stylesheet instruction for file: file:/C:/Users/AYSE/workspace/HiberAyse/src/hibernate.cfg.xml 

org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: 
file:/C:/Users/AYSE/workspace/HiberAyse/src/hibernate.cfg.xml 

at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225) 
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186) 
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73) 

Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: 
file:/C:/Users/AYSE/workspace/HiberAyse/src/hibernate.cfg.xml 
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214) 
... 2 more 

從我擡頭一看,這看起來可能與創建SessionFactory的實例,我的錯誤希望在代碼中使用。

我的設置,配置和代碼應該都很好 - 我按照一步一步的視頻將它們放在一起。

感謝提前幫助。

對於Hibernate來說太新了。

在一個單獨的Q中,我將要問Hibernate-and-which-DB。

// =====================

編輯:這是所有mixed--我得到一個錯誤,味精,但沒有這一項。這是從cfg文件上運行它 - 正如他在評論&下面的ans中指出的那樣。我會看看更多,並回來w /無論我已經提出。

+0

運行程序時,您正在關注hibernate.cfg.xml,對吧?如果是這樣,請關注一個java類並再次運行。 – lifus

+0

如果嘗試過「版本」,右鍵單擊以在main-method-class,project文件夾和包文件夾上運行。 – Roam

+0

這很奇怪,因爲eclipse正試圖「轉換」你的xml。 [這可能有幫助](http://stackoverflow.com/questions/2171031/how-to-stop-eclipse-from-trying-to-run-xml-files) – lifus

回答

1

引起:org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException:沒有嵌入樣式指令文件: 文件:/ C:/用戶/艾謝費裏德阿卡爾/工作區/ HiberAyse/SRC /hibernate.cfg.xml

Eclipse是trying to transform hibernate.cfg.xmlsince it's default behavior for xml files安裝XSL插件時。這必須是Eclipse XSL Developer Toolsorg.eclipse.wst.xsl.* folders/jars in plugin folder)。

請確保您的重點是.java文件當您嘗試運行您的hibernate項目。

此外,您可以按照these steps(and comments in case if this don't work for you either)optionally these steps in case if you are not working with multiple projects at the same time

+0

當焦點位於'hibernate.cfg.xml'而不是'.java文件'時,發生了同樣的錯誤。 – h4k1m