Deploying java class files without restarting JBoss
I would like to know if its possible to deploy java class files without 开发者_运维问答restarting JBoss server. I am using jboss v4.2.2.
Also, when I try to deploy jsp files, it works fine and server picks up the changes almost instantly.
Thanks a lot in advance :)
I'm better with Tomcat than JBoss, but it should be possible (as in Tomcat) to restart the application without restarting the app server. If the server has a "development mode" and this is active, then it should be possible to trigger an app restart simply by touch
ing WEB-INF/web.xml
, i.e. updating its timestamp. That should get your previously replaced class file loaded.
Theoretically, you never have to restart the whole server, you only restart specific applications (ear-s). JBoss (with default settings) will automatically redeploy your ear if it notices any changes in it. Just copy the new version over it.
If you're not using it already, check out JBoss Tools set of eclipse plugins, to simplify whole process of deploys during development: http://www.jboss.org/tools
Yes, it is possible to re-deploy your class files without stopping and starting the server each time.
The only thing you have to do is to make a junction or a symbolic link to the application directory (in eclipse is usually "WebContent") and put the name you want in Jboss.
I've made a step-by-step tutorial here.
Deploy the app as exploded (project.war folder), add in your web.xml:
<web-app>
<context-param>
<param-name>org.jboss.weld.development</param-name>
<param-value>true</param-value>
</context-param>
Overwrite the web.xml every-time you deploy:
set PRJ_HOME=C:\Temp2\MyProject\src\main\webapp
set PRJ_CLSS_HOME=%PRJ_HOME%\WEB-INF\classes\com\myProject
set JBOSS_HOME= C:\Java\jboss-4.2.3.GA-jdk6\server\default\deploy\MyProject.war
set JBOSS_CLSS_HOME= %JBOSS_HOME%\WEB-INF\classes\com\myProject
copy %PRJ_CLSS_HOME%\frontend\actions\profile\ProfileAction.class %JBOSS_CLSS_HOME%\frontend\actions\profile\ProfileAction.class
copy %PRJ_CLSS_HOME%\frontend\actions\profile\AjaxAction.class %JBOSS_CLSS_HOME%\frontend\actions\profile\AjaxAction.class
ECHO.>>%JBOSS_HOME%\WEB-INF\web.xml
精彩评论