tianhuilove

导航

Eclipse报错"org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException"的解决方法

16:51:58,421 INFO  [main] Main  - javax.xml.transform.TransformerFactory=null
16:51:58,422 INFO  [main] Main  - java.endorsed.dirs=C:\Program Files (x86)\Java\jre6\lib\endorsed
16:51:58,423 INFO  [main] Main  - launchFile: C:\Users\humortian\workspace\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
16:51:58,446 FATAL [main] Main  - No embedded stylesheet instruction for file: file:/C:/Users/humortian/workspace/Spring/bean.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/Users/humortian/workspace/Spring/bean.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/humortian/workspace/Spring/bean.xml
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)
    ... 2 more

以上错误是我在Eclipse中运行程序时,点击那个绿色的Run按钮时出现的。eclipse界面停留在xml文件中

我又尝试在Project上点右键,Run As->Java Application,结果居然能运行,我了个去,莫非是Eclipse的Bug?突然我灵光一闪,因为我点击Run按钮时,编辑界面显示的是一个 xml文件,莫非?于是点击Run按钮右侧的下拉列表,选择main()方法所在的类运行,居然成功了!好了,真相大白了。

分析:因为编辑界面显示的是一个xml文件,所以点Run按钮时,Eclipse并不是去Project中寻找main()方法来运行,而是“运 行”当前的xml文件,至于是在干什么我也不清楚,结果也很简单,因为你的xml不符合Eclipse的“运行”要求,所以它自然要报错了。

解决方法:运行Project时不要把编辑界面放在xml上,或者,手动选择main()方法所在的类,点"Run"。

posted on 2012-01-09 16:55  tianhuilove  阅读(1654)  评论(0编辑  收藏  举报