EndPointCorp / end-point-blog

End Point Dev blog
https://www.endpointdev.com/blog/
17 stars 65 forks source link

Comments for Hot-deploy Java classes and assets in Wildfly 8/9/10 #1333

Open phinjensen opened 7 years ago

phinjensen commented 7 years ago

Comments for https://www.endpointdev.com/blog/2017/10/hot-deploy-java-classes-and-assets-in/ By Piotr Hankiewicz

To enter a comment:

  1. Log in to GitHub
  2. Leave a comment on this issue.
phinjensen commented 7 years ago
original author: Samy Omar
date: 2017-11-01T16:13:26-04:00

Please update the github link that will look for changes in the application directory

phinjensen commented 7 years ago
original author: Peter Hankiewicz
date: 2017-11-01T16:20:21-04:00

Samy,

sorry about that, you can try it again now.

RMCampos commented 6 years ago

Hello friend!

First, thank you for the great tutorial! Second, I want to make you a question.

Situation: I have made a java program that uses git status to obtain the changed list files. With this list, the program makes a copy from the compiled directory class to the deployments directory. When it occurs (the copy), nothing happens. Nothing change. BUT, using a bat script that copy all the compiled classes (including the unchanged ones) to deployments folder, then wildfly react creating a file my-project.undeployed and gives me a message to create a file like my-project.dodeploy to start the deploy of the new files, without restart.

Q: From your tutorial, the expected result is simple override the changed class files and on the next request from that class wildfly will give the new class, OR wildfly really should create the .undeployed file and wait for the file .dodeploy?

Thanks in advance!

[]'s Ricardo.

peter-hank commented 6 years ago

Hi @RMCampos,

From your tutorial, the expected result is simple override the changed class files and on the next request from that class wildfly will give the new class

Yes. This is how it should work. I'm pretty sure that you need to deploy your application first to make Wildfly/HowSwapAgent see and update the classes.

So:

RMCampos commented 6 years ago

Thanks @peter-hank !!

But does not work like that here.

I would like to provide better information about the project and the app, then you maybe find the cause, but I even can't understand how it is built. All I know is that there is a main project, and sub-projects inside. The app seems to have a lot of services, that are triggered after deploy, after create .dodeploy file. Maybe the structure of the project can be the problem?

From the tutorial, everything is fine, the jcvm, the parameters, etc.

Thanks again!

[]'s Ricardo.

peter-hank commented 6 years ago

@RMCampos

Okay, can you see this log message in the console:

HOTSWAP AGENT: 22:24:19.502 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.0}

?

peter-hank commented 6 years ago

@RMCampos

I'm pretty sure that you will have it there. If so, the only thing I can think of right now is to play with the extraClasspath option in the HotSwapAgent config file.

https://github.com/HotswapProjects/HotswapAgent/blob/master/hotswap-agent-core/src/main/resources/hotswap-agent.properties#L10

Set it and put in: maven: src/main/resources OR webapp: WEB-INF/classes OR ant, plain java: check your classpath

RMCampos commented 6 years ago

Thanks a lot! I will look about the log message, probably it is there. And play with the HotSwapAgent config file. o/

RMCampos commented 6 years ago

@peter-hank Now I have made it!

Thank you! After adjust the HotSwapAgent config file it worked! Thanks again =D

peter-hank commented 6 years ago

@RMCampos

Thank you! After adjust the HotSwapAgent config file it worked! Thanks again =D

Awesome. You're welcome.

masumcse commented 6 years ago

Wildfy -10 app run With HotSwap Agent

step 1 : setup ok DCEVM-8u152-installer.jar

step 2 : eclipse ide with wildfy hotswap conif

-XXaltjvm=dcevm -javaagent:E:\Dev-framework\note\hotswap-agent-1.1.0-SNAPSHOT.jar=autoHotswap=true

step 3 : standalone.conf

-XXaltjvm=dcevm -javaagent:E:\Dev-framework\note\hotswap-agent-1.1.0-SNAPSHOT.jar

step 4 : it is not work . it gives deployment time error :

deployment-scanner path="PATH_TO_DEPLOYMENT_DIR" relative-to="RELATIVE_TO_PATH" scan-enabled="true" scan-interval="2000" auto-deploy-exploded="false" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"

Please give me a solution :

step 5 : if i use existing default standalone.xml file

then it show following things . No error : but no any work

https://justpaste.it/1hiue

After some changes in class , it not work

step 7 : use this file hotswap-agent.properties into maven: src/main/resources directory

@ peter-hank please help me

peter-hank commented 6 years ago

@masumcse

have you replaced the PATH_TO_DEPLOYMENT_DIR and RELATIVE_TO_PATH placeholders with your project values?

tonny1983 commented 6 years ago

Hello Peter, Thanks very much for your kind guide. I tried to set my wildfly 10.1.0 based on your article, but it seems it doesn't work.

Actually, I deployed a WAR directory to wildfly, and put a hotswap-agent.properties file on its WEB-INF\classes folder. Then, I started the wildfly and saw some HOTSWAP AGENT related messages on the console. But when I added some jar files into WEB-INF\lib folder, nothing happened... I also set the extraClasspath property with both WEB-INF\lib and WEB-INF\classes folders.

Could you help to see whether I missed something or not, please?

Thanks in advance!

peter-hank commented 6 years ago

Hi @tonny1983,

interesting. You can try setting autoHotswap to true if you're not using IDE integrations.

tonny1983 commented 6 years ago

Hi @peter-hank ,

I set autoHotswap=true in both standalone.conf and hotswap-agent.properties, and it seems hotswap starts to register many jboss resources, but there're still no effects on my WAR.

peter-hank commented 6 years ago

@tonny1983

But when I added some jar files - does it work if you update an existing class rather than add a new jar?

tonny1983 commented 6 years ago

@peter-hank

It is also negative. I checked the output log file, but found HOTSWAP AGENT just loaded a little jar files.

peter-hank commented 6 years ago

@tonny1983

do you use an absolute path for setting the extraClasspath option?

tonny1983 commented 6 years ago

@peter-hank

Yes, I use absolute paths for both WEB-INF\lib and WEB-INF\classes.

priyaramc commented 5 years ago

@peter-hank Hi Peter, thanks for wonderful tutorial. After installing hotswap jars I was able see the changes made in class files without restarting the server. Saves lot time! Unfortunately the next time while opening eclipse it's not starting up, Eclipse fails to startup, showing "Failed to create JVM" error.

Any idea how can it be fixed ? Thanks.

P.S. I changed the default java in Eclipse from version jdk1.8.0_161 to jdk1.8.0_191.