Struts2问题:ClassNotFoundException: org...dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

严重: Exception starting filter struts2

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

根据错误提示,意思是找不到类org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter,可是我确实手动找到了这个类:

web.xml中配置如下:


最后弃用了add external jars, 手动将Struts2的相关jar复制到/webContent/WEB-INF/lib目录下再add,问题解决

在网上还找到了其他的解决方法:

因为我们在配置tomcat的时候选择了“调试模式”,即“debug”;需设置为“生产模式”,即“run”,之后重新部署即可。

模式设置位置:myeclipse--preferences--servers--tomcatxx--launch选择“run mode”。


阅读更多

myEclipse10配置Struts2问题ClassNotFoundException: org...dispatcher.ng.filter.Struts

07-16

已经把struts2-core-2.3.33.jar加载到lib目录下了还是出现了rn[img=http://img.bbs.csdn.net/upload/201707/16/1500136804_525140.png][/img]rnrnrn严重: Exception starting filter struts2rnjava.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng .filter.StrutsPrepareAndExecuteFilterrn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)rn at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)rn at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)rn at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4908)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5602)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1259)rn at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1998)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)rn at java.util.concurrent.FutureTask.run(FutureTask.java:266)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at java.lang.Thread.run(Thread.java:745)rn

ClassNotFoundException问题

07-14

部署时碰到了这个异常,求大神给看看该怎么弄!!rnjava.lang.ClassNotFoundException: com.wondersgroup.tyyymh.workspace.listener.InitCodeListApplicationListenerrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4149)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rn2016-7-14 9:29:45 org.apache.catalina.core.StandardContext listenerStartrn严重: Error configuring application listener of class com.wondersgroup.tyyymh.workspace.listener.ApplicationContextListenerrnjava.lang.ClassNotFoundException: com.wondersgroup.tyyymh.workspace.listener.ApplicationContextListenerrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4149)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

ClassNotFoundException:

01-13

问题描述:rn昨天下午开始复习javaweb时候 准备重温一遍LoginServlet 遇到了一个之前没遇到的问题rn点击登陆按钮后 提示错误500rnrnMyeclipse 错误信息如下:rnrn严重: Allocate exception for servlet Loginrnjava.lang.ClassNotFoundException: com.servlet.Loginrn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)rn at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520)rn at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501)rn at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1050)rn at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:779)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)rn at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)rn at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)rn at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)rn at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:745)rn rnrn 问题已经解决 根源是class没有立刻生成 XML文件配置正确 但是class在servlet创建后没有生成rn 解决方法 在Myeclipse 界面的 projecet 选项里面的 Build Automatically 打上对勾即可rn rn

ClassNotFoundException

07-20

就是我通过JUnit测试代码是没有任何问题的,但是当请求到达之后就报classNotFound,rn贴代码,结和代码说明:rnrn ApplicationContext ac;rn UserService us;rn @Beforern public void init() rn ac=new ClassPathXmlApplicationContext("spring/spring-mvc.xml","spring/spring-mybatis.xml");rn us=ac.getBean("userService",UserService.class);rn rn @Testrn public void testLogin() rn User user=us.login("18888888888", "1234");rn System.out.println(user);rn rn rn这样一个JUnit的方法测试是可以得到User对象的,先说明我这里采用的是ssm框架,rn但是如下:rnrn @Resourcern private UserService us;rn @ResponseBodyrn @RequestMapping("/login.shop")rn /**rn * 登录,成功是败都返回数据rn * @param username 可以是邮箱,昵称,手机号rn * @param password 登录密码rn * @returnrn */rn public JSONResult login(String username,String password) rn User user=null;rn try rn user=us.login(username, password);rn catch(UserNameException e) rn return new JSONResult("001",e);rn catch(PasswordException e) rn return new JSONResult("002",e);rn rn return new JSONResult(user);rn rn rn rn rn这里执行的时候那个login方法会抛出异常,已验证us,username,password是有被赋值的。异常信息如下:rnrn 严重: Servlet.service() for servlet [shop] in context with path [/MobileShop] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'] with root causern java.lang.ClassNotFoundException: oracle.jdbc.OracleDriverrn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)rn at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)rn at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)rn at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)rn at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)rn at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at com.sun.proxy.$Proxy18.registByTel(Unknown Source)rn at com.chanct.shop.personal.controller.Regist.registByTel(Regist.java:52)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)rn at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)rn at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)rn at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)rn at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)rn at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)rn at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)rn rn感觉我都是用的同一个方法,但是关系导spring就报错了,测试就蛮好rn搞了半天了,实在弄不懂是哪里错了,跪求指点rnrn大家都说驱动。。。。附图rn![图片说明](https://img-ask.csdn.net/upload/201707/20/1500544254_983255.png)![图片说明](https://img-ask.csdn.net/upload/201707/20/1500544315_581941.png)rnrn求能真正解决问题的

没有更多推荐了,返回首页