posts - 40,  comments - 187,  trackbacks - 0
场景:构建Struts2.0时发生的错误。

环境:sun jdk1.5.0_01 + tomcat 5.0.28

完整的Exception:
Exception starting filter struts2
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
 at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
 at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<clinit>(DomHelper.java:167)
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:786)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:132)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:398)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:455)
 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:225)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:308)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:79)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3698)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4349)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
 at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
 at org.apache.catalina.core.StandardService.start(StandardService.java:480)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
 
错误原因:
认为是由于jdk1.5 与 tomcat5.0之间的关于 TransformerFactoryImpl 类的冲突造成的。
tomcat-5.0.28\common\endorsed下有两个jar包:xercesImpl.jar和xml-apis.jar,其中的类 javax.xml.transform.TransformerFactory 与jdk1.5中的类org.apache.xalan.processor.TransformerFactoryImpl其实是同一个类。
in tomcat java is called with the following argument:
-Djava.endorsed.dirs="X:\my_app\Portal\tomcat\common\endorsed"
In this directory you find two jar files: xercesImpl.jar and xml-apis.jar needed by tomcat and that must be loaded before all xmsl stuff present in the jdk (1.4 naming problem). And in the file xml-apis.jar the TransformerFactoryImpl is set to "org.apache.xalan.processor.TransformerFactoryImpl".

解决办法:
1. 将xml-apis.jar移出endorsed文件夹。
2. 用xalan系列jar包替换原来的xercesImpl.jar和xml-apis.jar。
   xalan系列jar包:serializer.jar、xalan.jar、xercesImpl.jar和xml-apis.jar。
3. For other application, just check this file or dom3-xml-apis.jar in your class path.


                                                                              THE END
posted on 2007-03-02 09:49 小立飞刀 阅读(3841) 评论(6)  编辑  收藏 所属分类: JavaEE Servers

FeedBack:
# re: TransformerFactoryImpl not found exception
2007-03-02 14:39 | 山风小子
What's the version of your Struts2?
Thanks:)  回复  更多评论
  
# re: TransformerFactoryImpl not found exception
2007-03-02 15:47 | 小雪飞刀
@山风小子

mine is struts-2.0.6
  回复  更多评论
  
# re: TransformerFactoryImpl not found exception
2007-05-13 17:04 | 张先生
哪儿找dom3-xml-apis.jar ???  回复  更多评论
  
# re: TransformerFactoryImpl not found exception
2007-08-28 13:57 |
极为讨厌说东西不说明白  回复  更多评论
  
# re: TransformerFactoryImpl not found exception
2007-08-28 16:03 | 小立飞刀
@纟

您哪儿不明白?直接写出来啊
  回复  更多评论
  
# re: TransformerFactoryImpl not found exception
2007-09-24 13:35 | leo yan
说的不错了..人家给你提供了解决方案,如果不对的话,肯定是你自己的问题  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
 
<2007年3月>
25262728123
45678910
11121314151617
18192021222324
25262728293031
1234567

生存或毁灭,这是个必答之问题:是否应默默的忍受坎苛命运之无情打击,还是应与深如大海之无涯苦难奋然为敌,并将其克服。此二抉择,究竟是哪个较崇高?

常用链接

留言簿(12)

随笔分类(43)

相册

收藏夹(7)

朋友的博客

电子资料

搜索

  •  

积分与排名

  • 积分 - 301962
  • 排名 - 192

最新评论

阅读排行榜

评论排行榜