struts2.0-初学struts2 action问题,,求教

问题描述

初学struts2 action问题,,求教


输入http://localhost:8080/qiaoliang_demo/getBarcode

解决方案

感觉是包没导好,,,,NOTCLASSFOUND

解决方案二:
Struts2的Action的线程安全问题
struts2 action初始化参数问题
struts2中JSP与Action间传值的问题

解决方案三:
不是一般都写failure的么(貌似这个没硬性要求),你肯定是execute方法里那一串貌似解析条形码的有问题,你应该贴console的输出,你可以debug单步调试看看啊。

解决方案四:
严重: Servlet.service() for servlet [default] in context with path [/qiaoliang_demo] threw exception [Filter execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.jbarcode.encode.BarcodeEncoder
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2595)
at java.lang.Class.getDeclaredConstructors(Class.java:1914)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:166)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowire(AbstractAutowireCapableBeanFactory.java:308)
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154)
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:129)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:287)
at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

调用的是生成条形码的方法,这个方法单独用是没问题的,,为什么这样运行不了??

解决方案五:
严重: Servlet.service() for servlet [default] in context with path [/qiaoliang_demo] threw exception [Filter execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.jbarcode.encode.BarcodeEncoder
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2595)
at java.lang.Class.getDeclaredConstructors(Class.java:1914)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:166)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowire(AbstractAutowireCapableBeanFactory.java:308)
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154)
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:129)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:287)
at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

调用的是生成条形码的方法,这个方法单独用是没问题的,,为什么这样运行不了??

解决方案六:
感觉是包没导好,,,,NOTCLASSFOUND

时间: 2025-01-21 07:19:10

struts2.0-初学struts2 action问题,,求教的相关文章

struts2 0 国际化-struts2.0升级到2.3.15.1后 ActionSupport getText() 空指针

问题描述 struts2.0升级到2.3.15.1后 ActionSupport getText() 空指针 java.lang.NullPointerException 00:45:33,387 ERROR [STDERR] at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:361) 00:45:33,387 ERROR [STDERR] at com.opensymphony.x

checkbox 已被选中 struts2.0

问题描述 在struts2.0里面从Action传过来2个list列表:listA.listBlistB是listA的子集,用JavaScript怎么判断被listB在listA中,并被选中,用的是checkbox

Struts2.x学习:第一个Struts2.0例子

具体相关页面及相应配置如下: 在struts1.x系列中,所有的请求是通过一个servlet(ActionServlet)来管理控制的,在Struts2.0而是经过一个Filter来处理请求的 web.xml : <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter- class&g

Struts2框架,调用action出错404

问题描述 Struts2框架,调用action出错404 struts2配置文件: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.

struts2.0中,用Hibernate写分页,其中jsp页面应该怎样写?

问题描述 Action是这样写的:publicclassPageAction{HttpServletRequestrequest;publicStringexecute()throwsException{Listlist=null;inttotallRows;TEmpInfoPageExtendtEmpInfoPageExtend=newTEmpInfoPageExtend();totallRows=tEmpInfoPageExtend.getCount();System.out.println

Struts2.0 + Spring2.0 + Hibernate3.2编程新解!!!申请【精华贴】

问题描述 最近发现一款SSH代码生成的工具,介绍给大家,下面是我原文copy过来的,希望对大家有帮助,呵呵....AutoCode代码生成器(SSH版)[用于JAVA开发中的Struts2.0+Spring2.0+Hibernate3.2框架整合程序开发]强大的支撑功能,堪称JAVASSH编程的利器,你绝对值得拥有!自动生成以下所有内容(即:完整的JavaSSH支持的工程)Sturts2.0配置-->sturts.xml.struts.propertiesSpring2.0配置-->appli

关于struts2.0配置返回页面的问题

问题描述 关于struts2.0配置返回页面的问题 struts能不能够动态的指定返回哪张页面?举个例子:比如说,url中带一个参数id,我根据这个id去查,需要返回哪张界面.id有很多,并且数目不固定(会增加),所以没办法在struts的配置文件中枚举.我想了下,用通配符的方式好像是可以实现的,但是跨部门合作,让别人按照这种方式指定文件的路径还是有点蛋疼.. 解决方案 Struts2.0 xml文件的配置(package,namespace,action)Struts2.0 xml文件的配置(

tomcat-JAVA问题:初学Struts2框架遇到的浏览器报错

问题描述 JAVA问题:初学Struts2框架遇到的浏览器报错 现在是验证Struts2的参数接收,但是页面直接就显示不出来 一:JSP页面----------> 二:XML配置----------> 三:控制器类--------------> 四:TomCat没有报错,浏览器报404找不者 解决方案 你的页面用的action路径Can/user_save,而你的Action配置路径是C_method的名称,不匹配啊. 修正你的action的配置,统一一下呗. 解决方案二: 你的问题是s

struts2 jsp页面给action实体赋值

问题描述 struts2 jsp页面给action实体赋值 实体A中有实体B的List对象 List bLlist 实体B中有实体C的List对象 List cList 我想在jsp中通过A.bList[0].cList[0].属性 A.bList[0].cList[1].属性 给cList赋值~~~ 可是到action中cList的长度一直是0 没赋上值.... 想请教一下可能是什么原因.... 各个属性名都是对的 搜了好几遍..SOS~~~.