SSH中添加自定义拦截器报错:Caught Exception while registering Interceptor class,注册时出错
来源:互联网 发布:广州公务员网络大学堂 编辑:程序博客网 时间:2024/06/16 04:34
报错信息:
17:08:58,707 WARN InterceptorBuilder:56 - Unable to load config class xxxx at interceptor - file:/E:/****/struts.xml:12:86 probably due to a missing jar, which might be fine if you never plan to use the aInterceptor interceptor
17:08:58,707 ERROR InterceptorBuilder:38 - Actual exceptionCaught Exception while registering Interceptor class xxxx - interceptor - file:/***/struts.xml:12:86
at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:214)
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:1110)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildInterceptorList(XmlConfigurationProvider.java:626)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:440)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:552)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:250)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
在Struts.xml中的注册信息:
<interceptors>
<interceptor name="xxxInterceptor" class="cn.xxx.interceptor.xxxInterceptor"/>
</interceptors>
自定义拦截器类是没有错的。
问题原因:在我所使用的ssh框架中,类的创建应该是交给spring管理的,所以不能在struts.xml中直接注册,应该先在applicationcontext.xml中注册。
正确写法:
在applicationcontext.xml中,
<bean id="aInterceptor" class="cn.itcast.shop.interceptor.AInterceptor" scope="prototype">
</bean>
然后在struts.xml中引用这个bean
<interceptors>
<interceptor name="aInterceptor" class="aInterceptor"/>
</interceptors>
问题解决。主要还是要具体问题具体分析,了解框架的原理,才能从根本解决问题
- SSH中添加自定义拦截器报错:Caught Exception while registering Interceptor class,注册时出错
- [struts]异常Caught Exception while registering Interceptor class org.crazyit.auction.action.intercepto
- ssh 整合时出现:Exception starting filter struts2.x Caught exception while loading file struts-default.xml
- ssh 严重: Exception starting filter struts2 Caught exception while loading file struts-default.xml -
- Eclipse删除出错:exception has been caught while processing the refactoring 'Rename package'
- SpringMVC中添加Interceptor拦截器
- Caught exception while loading file struts-default
- BEA-149500:An exception occurred while registering the MBean null
- 严重: Caught exception while loading file xwork.xml
- Caught exception while loading file struts-default.xml
- Caught exception while loading file struts-default.xml
- Caught exception while loading file struts-default.xml
- Caught exception while loading file struts-default.xml - [unknown location]
- Caught exception while loading file struts-default.xml - [unknown location
- Caught exception while loading file struts-default.xml - [unknown location]
- Caught exception while loading file struts-default.xml 错误
- Caught exception while loading file struts-default.xml 错误
- Caught exception while loading file struts-default.xml - [unknown location]
- AM335x启动流程(BootRom->MLO->Uboot)
- Java虚拟机工作原理详解
- Java面试准备七:Java值传递/引用传递的问题
- C# 三种字节数组(byte[])拼接的性能对比测试
- 判断字符串中是否含有某个字符
- SSH中添加自定义拦截器报错:Caught Exception while registering Interceptor class,注册时出错
- InfluxDB 开源分布式时序、事件和指标数据库
- memcached使用
- delphi初级教程之delphi断点调试一
- Detect Capital
- DirContext初始化过程分析
- Apache与Tomcat 区别联系
- Android 从 View 中获取 Activity 时遇到 TintContextWrapper cannot be cast to 的问题
- delphi初级教程之delphi断点调试二