Hot deployment on JBoss - how do I get JBoss to “see” a change?

I am developing a Java EE application that I am deploying again and again on a local JBoss installation during development. I want to speed up the build by deploying my application hot right in [JBOSS] / server / default / deploy / myApp

This seems to work - but there is also a somewhat arbitrary delay between hard deployments and when JBoss starts using new classes. I'm not very familiar with JBoss, but I assume that it caches classes, and that is what causes the problem.

Is it right, and if so, how can I get JBoss to flush its cache?

+48
java-ee deployment jboss
Jun 09 '09 at 10:34
source share
14 answers

I had the same problem in my package: (Eclipse IDE + JBoss adapter) + JBoss AS 7.0.1 (community project).

My solution is very simple - you have to go to the JBoss admin panel (by default localhost: 9990), there, in the profile settings, open Core - Deployment Scanners. Turn on Autodeploy-Exploded (set to true), and according to your wishes you can set the scan time (default 5000 ms) to match (I set 2000, for faster incremental publication in Eclipse when I make changes to projects), This. Now JBoss launches HOT not only for HTML files (JSF, XHTML, etc.), but also takes care of POJO classes (beans, etc.).

+104
Mar 17 '12 at 18:19
source share

Unfortunately, this is not so simple. There are more complex things behind the scenes in JBoss (most of them relate to ClassLoader), which will prevent you from HOTING your application.

For example, you cannot use HOT-DEPLOY if some of your class signatures change.

So far, the use of the MyEclipse IDE (Eclipse Paid Distribution) is the only thing I have found that is deploying quite successfully. However, the accuracy is not 100%. But certainly better than JBoss Tools, Netbeans, or any other Eclipse-based solution.

I was looking for free tools to accomplish what you just described, asking people on StackOverflow if you want to take a look.

+7
Jun 09 '09 at 10:52
source share

You should try JRebel , which is very convenient for hot deployment. A bit expensive, but worth the money. They have a trial version.

+5
Aug 6 '12 at 10:00
source share

Hot deployment is stable only for changes in the static parts of the application (jsf, xhtml, etc.).

Here is a working solution, according to JBoss AS 7.1.1.Final :

Create your own project. Go to [JBOSS_HOME] / standalone / tmp / vfs. Open the last modified folder with the name "deployment [some_alphanumeric_values]", that is, "deployment344b1c870c8edbd". Go to the specific view that you want to edit (usually it is in the packaged .war folder) and open it with a text editor (for example, Notepad ++). Make the necessary changes and save the file. Refresh the corresponding page in your browser. Now the changes should be visible.

When done, be sure to copy these changes into your actual development environment, rebuild and redeploy.

+2
02 Oct '15 at 2:54
source share

I had the same problem, but I think that now I have it under control.

Are you using eclipse or the command line or?

When I use the command line, I think I did “clear the seam” or “remove the seam” or maybe even “restart the seam” and then “blow the seam”. I probably tried all this at one time or another, never bothering myself with the search for what everyone does.

The idea is to remove the deployed war file from two places

 1. $JBOSS_HOME/server/default/deploy 2. $PROJECT_HOME/exploded_archives 

I am sure that “seam undeploy” removes the 1st and “clean seam” removes the 2nd.

When I use eclipse (I use free), I first turn off "Project / Build Automatically" Then, when I am ready to deploy, I do Project / Build Project or Project / Build All depending on what I changed. When I change xhtml, the Build Project is enough. When I change the Java Build source, everything works. They may be doing the same thing, and the difference is in my imagination, but some combination of this material will work for you.

You must keep track of the exit. Sometimes the application does not clean up or deploy. This will cause you to not see the changes. Sometimes I close the server first and then restore / clean / deploy the project.

Hope this helps.

Tdr

+1
Jun 10 '09 at 18:43
source share

Found solution on this link :

What to do:

  • customize an exploded artifact of war with the .war extension
  • deploy exploded artifact in WildFly or Jboss
  • Configure IntelliJ to update resources when updating.

When I change the page (network), I update and when I update the web browser: all this is with my mod. I configured Jboss for auto-scan (not sure if this helped)

+1
Jun 27 '14 at 9:16
source share

Actually my problem was that the command line mvn utility did not see the change for some reason. I turned on automatic deployment in the deployment scanner, and still there was no difference. HOWEVER ... I revolved around the Eclipse environment, and because I added the JBoss server for this Servers window, I found that I have the ability to add or remove ... in my workspace. When the project was added whenever I made changes to the code, a code change was detected using the deployment scanner, and JBoss went through a code update cycle !!! It works like a charm.

The following are the steps required to set this parameter:

First, if you haven’t done so, add your JBoss server to your Eclipse using File-> New-> Other-> Server, then go to the add your JBoss AS 7 server. Be sure to find the directory that you are using.

After adding, look down at the bottom of Eclipse on the Servers tab. You should see your JBoss server. Highlight it and find "Add or Remove ...". From there you should see your project.

After adding, make a small change to your code and see how JBoss gets to town for you.

0
Jan 11 '14 at 8:48
source share

Only my two cents:

  • Cold deployment is a way to deploy an application when you stop it (or stop the entire server), then install a new version and finally restart the application (or start the entire server). It is suitable for formal production deployments, but it would be awfully slow to do this during development. Forget fast development if you do.

  • Automatic deployment is the ability to re-scan the server for a new EAR / WAR and automatically deploy behind the scenes for you or for the IDE (Eclipse) to automatically deploy the entire application when changes are made to the source code. JBoss does this, but JBoss's marketing department mistakenly calls it "hot deployment." Automatic deployment is not as slow as a cold deployment, but very slow compared to a hot deployment.

  • Hot deployment is the ability to deploy behind the scenes on-entry. No need to relocate the entire application when making changes. Easy Deployment ONLY Deploys Changes. You change the Java source code and voila! It works already. You never noticed that it deploys it. JBoss can't do this unless you buy JRebel (or the like), but it's too much for me (I'm cheap).

Now my "sales pitch": D

How to use Tomcat during development? Comes with hot deployment all day ... for free. I do this all the time during development, and then deploy to WebSphere, JBoss, or Weblogic. Don't get me wrong, these three are great for production, but really AWFUL for quick development on your local machine. Development productivity is reduced if you use these three all day long.

In my experience, I stopped using WebSphere, JBoss, and Weblogic for rapid development. However, I still installed them in my local environment, but only for a random test that I might need to run. I don't pay for JRebel until I get amazing development speed. May I mention that Tomcat is fully compatible with JBoss?

Tomcat is free and not only has automatic deployment, but also REAL hot deployment (Java code, JSP, JSF, XHTML) when you type Eclipse ( Yes, you read well ). MYKong has a page ( https://www.mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/ ) with detailed information on how to configure it.

Did you like my sales pitch?

Hurrah!

0
Jul 15 '16 at 19:24
source share

I was developing a project with Eclipse and Wildfly, and the exploded EAR file became larger thanks to the deployment of all the third-party libraries that I need in the application. I pointed to a deployment in my Maven repository, which I think returned jars every time. Therefore, redistributing the application when I changed the Java code at the service level turned into a nightmare.

Then, by contacting the Hotswap agent, it greatly helped to see EJB code changes without redeploying the application.

However, I recently upgraded to Wildfly 10, Java 8, and JBoss Developer Studio 10, and during this process I spent time migrating all third-party applications, for example. in the Wildfly modules, and I removed the Maven repository from my deployment configuration. Now redistributing the entire application, which is quite large through Eclipse, takes only a few seconds, and it is much faster than before. I don’t even feel the need to install Hotswap and I don’t want to risk it anyway right now.

So, if you are building under Eclipse with Wildfly, then keep the application away from third-party libraries using Wildfly modules, and you will be much better.

0
Aug 19 '16 at 20:11
source share

Solution for Netbeans 8.02 and 8.1 IDE and JBOSS EAP 6.4:

  • On the Netbeans Services tab, add a JBOSS server to your node "servers".
  • If you use MAVEN, netbeans compiles files and maven copy files into a directory. / target. You need to create a symbolic link from. \ Target in JBOSS_HOME \ standalone \ deployments. Under the windows, the example command will be

    cd %JBOSS_HOME%\standalone\deployments mklink /d MyWebApplication.war %PROJECTS_HOME%\MyWebApplication\target\MyWebApplication-1.0.0

    The above creates a symbolic link from %JBOSS_HOME%\standalone\deployments\MyWebApplication.war to \target\MyWebApplication-1.0.0 , where maven transfers all files after compilation or after changing jsp, html or any other file.

  • Consider creating a CentralManagement.war.dodeploy file in% JBOSS_HOME% \ standalone \ deployments. This file will inform JBOSS of the deployment of the military “file” as a web application.

0
Sep 06 '16 at 13:12
source share

Start the server in debug mode and it will track changes inside the methods. Other changes. He will ask you to restart the module.

0
Jan 21 '17 at 16:01
source share

I am using JBoss AS 7.1.1.Final . Adding the following code snippet to my web.xml helped me modify jsp files on the fly:

 <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>development</param-name> <param-value>true</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet> 

Hope this helps. !!

0
Feb 09 '17 at 6:24
source share

Deploy the application as exploded (project.war folder), add to your web.xml:

 <web-app> <context-param> <param-name>org.jboss.weld.development</param-name> <param-value>true</param-value> </context-param> 

Update web.xml time with every deployment (add blank line):

 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 
0
Feb 16 '17 at 6:30
source share

Use an Ant script and create a target deployment.

The deployment objective should:

  • Stop jboss
  • Copy your ear or war to the deployment directory
  • Launch JBoss

==> Lack of caching + also lack of memory problems after subsequent deployments during testing.

-6
Aug 11 2018-11-11T00:
source share



All Articles