提示java.lang.UnsupportedClassVersionError: Bad version number in .class file
Myeclipse 使用的JDK和Tomcat使用的JDK版本不一致
解决方法:
把它们的JDK版本改成一致步骤如下:
1.Window --> Preferences -->Java --> compiler中的compiler compliance level对应的下拉菜单中选择JDK版本.
2.Window --> Preferences -->MyEclipse --> Servers -->Tomcat --> Tomcat n.x -->JDK中的Tomcat JDK name下的下拉菜单中选择自身电脑上安装的JDK版本
1 、缺少文件上传JAR包 commons-io-1.3.1.jar commons-fileupload-1.2.jar
Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location]
这个问题是在使用Struts2想做一个上传文件的页面时候Tomcat报出来的错误,详细信息如下:
2007-7-19 21:34:09 org.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location]
2007-7-19 21:34:09 org.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location]
问题描述:使用Struts2.0.6+Sitemesh2.2.1+Freemark2.3.8的过程中,装饰Action请求的结果页面不会有问题,但是如果装饰直接访问的JSP页面会出现如下错误:
java 代码
1. javax.servlet.ServletException: Error applying decorator: null
解决方案:经过调试发现是FreeMarkerPageFilter的getLocale方法没有对invocation添加非空判断造成的,错误代码如下:
java 代码
1. protected Locale getLocale(ActionInvocation invocation, Configuration configuration) {
2. if (Action() instanceof LocaleProvider) {
3. return ((LocaleProvider) Action()).getLocale();
4. } else {
5. return Locale();
6. }
7. }
改正后的代码如下:
java 代码
1. protected Locale getLocale(ActionInvocation invocation, Configuration configuration) {
2. if (invocation != null && Action() instanceof LocaleProvider) {
3. return ((LocaleProvider) Action()).getLocale();
4. } else {
5. return Locale();
6. }
7. }
问题描述:使用Struts2.0.6+Sitemesh2.2.3,我有一个请求/customer/page.action,其结果页面为WEB-INF/jsp/customer/list.jsp,我希望使用main装饰器对返回结果进行装饰,如果配置如下:
xml 代码
1. <decorator name="main" page="main.ftl">
2. <pattern>/WEB-INF/jsp/customer/list.jsppattern>
3. decorator>
则无法成功进行装饰,如果配置如下:
xml 代码
1. <decorator name="main" page="main.ftl">
2. <pattern>/*pattern>
3. decorator>
则可以成功进行装饰。
解决方案:经过调试发现,原来装饰器是根据请求的URI路径匹配需要装饰的页面的,而且此URI路径是相对于上下文路径的,因此针对上述需求正确的配置如下:
xml 代码
1. <decorator name="main" page="main.ftl">
2. <pattern>/customer/page.actionpattern>
3. decorator>
1---:java.lang.NoClassDefFoundError: org/apache/struts2/dojo/views/jsp/ui/HeadTag
解决办法:原因缺少了dojo的JAR包,引入即可:struts2-dojo-plugin-2.1.2.jar
(
The "head" tag renders required JavaScript code to configure Dojo and is required in order to use any of the tags included in the Dojo plugin.
--------------------
If you are planning to nest tags from the Dojo plugin, make sure you set parseContent="fa
lse", otherwise each request made by the inner tags will be performed twice.
)
2---:Unable to load configuration. - bean - jar:file:/F:/Struts2/Struts2/WebRoot/WEB-INF/lib/struts2-core- 2.1.2.jar!/l:46:178
Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/F:/Struts2/Struts2/WebRoot/WEB-INF/lib/struts2-core-2.1.2.jar!/l:46:178
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/RequestContext
解决办法:缺少JAR包,引入commons-fileupload-1.2.1.jar,commons-io-1.3.2.jar即可
解决办法:缺少JAR包,引入commons-fileupload-1.2.1.jar,commons-io-1.3.2.jar即可
3---:No tag "datetimepicker" defined in tag library imported with prefix "s"
原因版本问题:缺少struts-dojo-plugin JAR包,以及HTML的,<HEAD></HEAD>中没有使用<s:head/>标签
If you're using Struts 2.1.x you're probably missing the> struts-dojo-plugin. Michaël's reference below applies to Struts ly. In the lasts versions (since 2.0.9 I guess), all AJAX are in dojo> plugin.
> > So you need to include <%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
> > and <sx:head/>
> >( Temp1:
<sx:datetimepicker name="picker" />
Temp2:
<sx:datetimepicker type="time" name="picker" /><br/>
Temp3:
> > So you need to include <%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
> > and <sx:head/>
> >( Temp1:
<sx:datetimepicker name="picker" />
Temp2:
<sx:datetimepicker type="time" name="picker" /><br/>
Temp3:
<sx:datetimepicker value="%{'2008-06-08'}" name="picker" />
Temp4:
<sx:datetimepicker value="date" name="picker" />)
> > and call :<sx:datetimepicker .../>
Temp4:
<sx:datetimepicker value="date" name="picker" />)
> > and call :<sx:datetimepicker .../>
error parse new
4---:使用TILES框架
If you use the Tiles 2 plugin, check l file(s) to ensure they contain a DOCTYPE.
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论