这段时间初学javaweb开发。
开发过程中,发现jboss总是需要不停重启,浪费时间,于是baidu搜索jboss的热部署。
发现网上都是说在%JBOSS_HOME%\server\default\deploy\jbossweb.sar\context.xml,这个下面修改
<Context cookies="true" crossContext="true" reloadable="true" antiResourceLocking="true" antiJARLocking="true">
但是在我这边不生效,不仅class修改了不生效,vm文件修改了也不生效。
于是尝试把antiResourceLocking这个修改为false,居然vm文件的修改生效了。
antiJARLocking这个即使修改为true、false都不起作用。不过后来发现,jboss要以debug方式启动就生效了(需要设置antiJARLocking=true)
所以最终结论应该是
<Context cookies="true" crossContext="true" reloadable="true" antiResourceLocking="false" antiJARLocking="true">,
然后jboss以Debug方式启动即可。
===================================
另外网上还有一个方法是
(1)修改路径:server\default\deploy\jboss-web.deployer\server.xml
修改内容:<Host name="localhost" autoDeploy="true" deployOnStartup="false" deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig" >
(2)修改路径:server\default\deploy\jboss-web.deployer\context.xml
修改内容:<Context cookies="true" crossContext="true" reloadable="true"> <Manager pathname="" /> <InstanceListener>org.jboss.web.tomcat.security.RunAsListener</InstanceListener> </Context>
(3)修改路径:server\default\conf\jboss-service.xml
修改内容:<attribute name="ScanEnabled">true</attribute>
这种方法,每次修改class之后,jboss重新加载一边,速度慢,而且发现加载第二次就出现error错误。