1

I'm having a lot of issues getting Netbeans 12 to hot deploy a JavaEE project (using Ant) to Wildfly. Surprisingly, any changes to my Java code hot deploys as usual upon save, but any changes to my web markup (.xhtml) will only show up after a fresh deployment.

Here's a list of what I've done and my current settings:

Settings:

  • Copy Static Resources on Save
  • Compile on Save

In my web.xml:

<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>

What I've tried:

Wildfly system Property:

<system-properties>
    <property name="java.net.preferIPv4Stack" value="true"/>
    <property name="org.jboss.as.web.deployment.DELETE_WORK_DIR_ONCONTEXTDESTROY" value="true"/>
</system-properties>

Wildfly Deployment Scanner:

    <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
        <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" 
                            scan-interval="100" 
                            auto-deploy-exploded="true" 
                            untime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
    </subsystem>

In addition to the above, I've also modified the Ant script to copy the required files over to the appropriate directories. This DOES work, but each time I do this, I lose any session state with the app that I had prior to the save.

What I'm hoping to achieve is to be able to modify either my backing Java code or my front-end markup and upon saving the file (or clicking the hot deploy button, doesn't really matter to me) have the changes reflected on my application server.

I've worked on other projects that used WebLogic as the application server with no issues. Netbeans (8) simply "works" when you attach the debugger and modify a file (using WebLogic). The changes are immediately reflected in the browser upon a refresh without loss of state. I'm hoping that I'm missing something really small and it's easy to do with Netbeans 12 + Wildfly as well.

Thank you!! Hopefully I'm just missing something small!

  • Do you see you exploded war in the deployment folder ? Are the files properly changed when you save them ? Scan interval to 100 seems a bit extreme to me. – ehsavoie Sep 25 '20 at 11:31
  • Thanks for your response! Yes, I can see the exploded content of the war in the deployment folder. Unfortunately the files (xhtml) are not properly updated when saved from Netbeans. Class files are good and are updated, but the web markup is not. Agree on the 100 scan interval. This was just something I tried to make sure the issue wasn't my impatience :) Sadly, it was not. – KelciTheCat Sep 25 '20 at 14:03
  • It looks strange to me as static content is 'just' copied over without a redeploy of the application iirc. It might be cached by wildfly/undertow. – ehsavoie Sep 26 '20 at 15:47
  • Thanks again for trying to help!! Just want to be clear: Netbeans does not copy over the .xhtml, for example. I have an Ant script that does that on demand. The only files that appear to be updated automatically are the class files because I can see behavior changes in the back-end code. When I change the xhtml AND run my Ant script, I can see changes in the view rendering, but the app's state is completely lost. I can see in the Wildfly deployment directories the exploded content of the war. This is indeed an odd one! – KelciTheCat Sep 27 '20 at 13:39
  • I guess that the scanner will detect the file changes and redeploy. What happens if you don't disable the scanner ? – ehsavoie Sep 28 '20 at 16:32
  • From what I can tell in the configuration, the scanner is working? Another wrinkle though ... when I was playing around with this, I noticed that backing changes (EJBs and page beans) are no longer being hot fixed. This is a real conundrum! – KelciTheCat Sep 29 '20 at 13:53
  • ...errr what I meant to say is that from what I can tell, the scanner is enabled, not necessarily working :) – KelciTheCat Sep 29 '20 at 14:13
  • Could you create a reproducer of your application to shared so i may took a look ? – ehsavoie Sep 29 '20 at 15:00
  • I absolutely can, but there's nothing special about my current application vs any app that is created by template in Netbeans. For example, I created a new JavaEE project (EJB and Web), attached the Primefaces 7.0 jar, compiled, deployed with debugger, and no dice. This time I was able to hot deploy class/bean/ejb changes, but the xhtml markup requires a full redeployment. – KelciTheCat Sep 29 '20 at 18:55

0 Answers0