以前项目用过webwork2,感觉这两个差不多,今天用struts2开发一个helloworld程序没想到出了很多错,看来自己真实眼高手低呀。
首先是:
严重: Exception starting filter struts
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl could not be instantiated: java.lang.NullPointerException
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:830)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
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:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2009-3-11 11:23:38 org.apache.catalina.core.StandardContext start
最后在网上查到,有人建议移除$TOMCAT_HOME/common/endorsed/下的Jar包,说是很JDK的有冲突,后来,果然可以了。得感谢这些前辈们。
接着程序到时候能运行了,但日志里面出了很多错。
Caught Exception while registering Interceptor class org.apache.struts2.interceptor.debugging.DebuggingInterceptor - interceptor - jar:file:/E:/DevelopWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/struts2/WEB-INF/lib/struts2-core-2.0.11.jar!/struts-default.xml:98:115
at org.apache.struts2.impl.StrutsObjectFactory.buildInterceptor(StrutsObjectFactory.java:78)
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:57)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:905)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStack(XmlConfigurationProvider.java:743)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStacks(XmlConfigurationProvider.java:756)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptors(XmlConfigurationProvider.java:777)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:410)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:239)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:152)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=org.apache.struts2.views.freemarker.FreemarkerManager, name='default'] in public void org.apache.struts2.interceptor.debugging.DebuggingInterceptor.setFreemarkerManager(org.apache.struts2.views.freemarker.FreemarkerManager).
at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:157)
at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMethods(ContainerImpl.java:126)
at com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.java:103)
at com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:84)
at com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:82)
at com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:155)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:81)
at com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:121)
at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:452)
at com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:492)
at com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:491)
at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:542)
at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:490)
at com.opensymphony.xwork2.ObjectFactory.injectInternalBeans(ObjectFactory.java:131)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:156)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143)
at org.apache.struts2.impl.StrutsObjectFactory.buildInterceptor(StrutsObjectFactory.java:53)
... 31 more
Caused by: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=org.apache.struts2.views.freemarker.FreemarkerManager, name='default'] in public void org.apache.struts2.interceptor.debugging.DebuggingInterceptor.setFreemarkerManager(org.apache.struts2.views.freemarker.FreemarkerManager).
at com.opensymphony.xwork2.inject.ContainerImpl.createParameterInjector(ContainerImpl.java:239)
at com.opensymphony.xwork2.inject.ContainerImpl.getParametersInjectors(ContainerImpl.java:229)
at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.<init>(ContainerImpl.java:282)
at com.opensymphony.xwork2.inject.ContainerImpl$3.create(ContainerImpl.java:130)
at com.opensymphony.xwork2.inject.ContainerImpl$3.create(ContainerImpl.java:128)
at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:154)
... 49 more
后来看了看,应该是缺少freemarker的Jar文件,放进去,果然可以了,看来以后还的多学习学习。
以后在也不能想当然了,但为什么struts2不像spring那样,不用freemarker做视图,为什么还得需要那些Jar文件呢,请高人指点?
分享到:
相关推荐
### Struts2+Spring4+MyBatis3框架搭建手册 #### 一、开发环境与资源准备 **1. 开发环境** - **IDE选择**:本教程采用Eclipse作为集成开发环境。 - **JDK版本**:推荐使用Java 1.6版本,确保与项目中的第三方库...
本文将根据提供的文件信息,深入解析几个常见的Hibernate错误及其解决方案,旨在为开发者提供一份排错宝典,帮助他们迅速定位并解决问题。 ### 错误一:`java.lang.NullPointerException` **错误现象**: 在开发...
### Tomcat 排错经典案例之 404 错误...通过以上步骤,可以有效地排查和解决在搭建 `Struts2 + Spring + Hibernate` 框架过程中遇到的 404 错误。希望这些信息能帮助开发者们快速定位问题所在,并顺利完成项目开发。
1)支持三个技术栈simple(jsp,clocksimplejee或默认,s2sh(Struts2,Spring 4, Hibernate 4)和s2shcs2sh(Struts2,Spring 4, Hibernate 4 Criteria) 2)推荐工业级的S2SHC技术栈 ===============0.7.22================...
2. **命令行操作**:熟悉JDK中的常用命令,如`java`、`javac`、`jar`、`javadoc`等,以便在没有IDE的情况下也能进行开发和调试工作。 3. **IDE使用**:至少精通一种集成开发环境(IDE),如Eclipse、IntelliJ IDEA...
除了基础的Java技能外,还需要不断学习新技术和框架,如J2EE、Oracle、WebLogic、JBoss、Spring、Struts、Hibernate等。同时,了解软件架构设计、搜索引擎优化、缓存系统设计、网站负载均衡、性能调优等高级技术也...
##### 2. 预算系统 - **开发环境**:使用JDK1.6+Apache Tomcat作为开发环境。 - **开发工具**:采用MyEclipse作为集成开发环境。 - **数据库**:使用MySQL作为后端数据库。 - **系统描述**: - 使用Struts+Spring+...
除了精通Java,还应了解J2EE框架、数据库(如Oracle)、应用服务器(如WebLogic、JBoss)、框架(如Spring、Struts、Hibernate)以及软件架构、性能优化等高级主题。 综上所述,成为一个优秀的Java程序员,不仅需要...
VB+ACCESS水费管理(宁夏职工科技学院) VC++网络故障排错向导机制的设计 VB+ACCESS题库管理系统+论文.rar VC++网络游戏-四国军棋 VB+access题库与计算机自动出卷系统 VC+ACCESS学生宿舍 VB+Access图书管理系统 VC+SQL...
VB+ACCESS水费管理(宁夏职工科技学院) VC++网络故障排错向导机制的设计 VB+ACCESS题库管理系统+论文.rar VC++网络游戏-四国军棋 VB+access题库与计算机自动出卷系统 VC+ACCESS学生宿舍 VB+Access图书管理系统 VC+SQL...