struts2 零配置 启动开发模式时报错。求解决。
是在加入次配置时启动TAMCAT报的错:<constantname="struts.i18n.reload"value="true"/><constantname="st...
是在加入次配置时启动TAMCAT报的错:
<constant name="struts.i18n.reload" value="true"/>
<constant name="struts.configuration.xml.reload" value="true"/>
<constant name="struts.convention.classes.reload" value="true" />
以下是报错内容:
Caused by: java.lang.NullPointerException
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:592)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:336)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415) 展开
<constant name="struts.i18n.reload" value="true"/>
<constant name="struts.configuration.xml.reload" value="true"/>
<constant name="struts.convention.classes.reload" value="true" />
以下是报错内容:
Caused by: java.lang.NullPointerException
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:592)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:336)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415) 展开
展开全部
struts.convention.classes.reload设置成false
struts2.2.1官方文档里有这一段:
Automatic configuration reloading
The Convention plugin can automatically reload configuration changes, made in classes the contain actions, without restarting the container. This is a similar behavior to the automatic xml configuration reloading. To enable this feature, add this to your struts.xml file:
<constant name="struts.devMode" value="true"/>
<constant name="struts.convention.classes.reload" value="true" />
This feature is experimental and has not been tested on all container, and it is strongly advised not to use it in production environments.
明确写道这两个选项可能会导致问题!
4个开发模式常用配置的简介---
<!-- 开启使用开发模式,详细错误提示 -->
<!-- <constant name="struts.devMode" value="true"/>-->
<!-- 指定每次请求到达,重新加载资源文件 -->
<!-- <constant name="struts.i18n.reload" value="true"/>-->
<!-- 指定每次配置文件更改后,自动重新加载 -->
<!-- <constant name="struts.configuration.xml.reload" value="true"/>-->
<!-- 指定XSLT Result使用样式表缓存 -->
<!-- <constant name="struts.xslt.nocache" value="true"/>-->
devMode模式是开发模式,开启它则默认开启了i18n.reload、configuration.xml.reload 也有可能是由于configuration.xml.reload设置为true导致的
楼主试试看
struts2.2.1官方文档里有这一段:
Automatic configuration reloading
The Convention plugin can automatically reload configuration changes, made in classes the contain actions, without restarting the container. This is a similar behavior to the automatic xml configuration reloading. To enable this feature, add this to your struts.xml file:
<constant name="struts.devMode" value="true"/>
<constant name="struts.convention.classes.reload" value="true" />
This feature is experimental and has not been tested on all container, and it is strongly advised not to use it in production environments.
明确写道这两个选项可能会导致问题!
4个开发模式常用配置的简介---
<!-- 开启使用开发模式,详细错误提示 -->
<!-- <constant name="struts.devMode" value="true"/>-->
<!-- 指定每次请求到达,重新加载资源文件 -->
<!-- <constant name="struts.i18n.reload" value="true"/>-->
<!-- 指定每次配置文件更改后,自动重新加载 -->
<!-- <constant name="struts.configuration.xml.reload" value="true"/>-->
<!-- 指定XSLT Result使用样式表缓存 -->
<!-- <constant name="struts.xslt.nocache" value="true"/>-->
devMode模式是开发模式,开启它则默认开启了i18n.reload、configuration.xml.reload 也有可能是由于configuration.xml.reload设置为true导致的
楼主试试看
追问
如果不把 struts.convention.classes.reload 开启,那还叫开发模式吗...?
我改了java代码还是不能直接编译发布到TOMCAT里面去丫
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询