2

I have a Java EE application running on WildFly 10.0.0 final having the following structure diagrammatically (it does not use Apache Maven).

enter image description here

I am using JRebel 6.4.1 for NetBeans (8.1). It works fine in web applications (thus not enterprise applications) but in enterprise applications, the IDE keeps on showing the following message, "Open project properties to setup remote servers", when changes to a Java file in the EE module or class library (as show in the picture above) are synchronized.

enter image description here

The message does not appear, when changes to the web module are synchronized.

Despite the message, changes made to the EE module are propagated when the module is synchronized but changes to the class library are not propagated upon synchronizing.

JRebel remote server is currently turned off since the application runs on localhost. Is it required to setup the server URL in the project properties dialog? What is the URL in that case?

Any other suggestion, in case, I am missing something?

enter image description here

Tiny
  • 27,221
  • 105
  • 339
  • 599
  • If the application is running locally, you definitely don't need to use the remote server feature. Open JRebel panel and verify that the second column (JRebel Remote column) isn't checked for any of the modules. In regard to class file changes not being synced, check that build on save would be enabled, that the .class files in the build folder would actually be updated and that the rebel.xml for the particular module you're changing is pointing to the same directory. Don't spend too much time debugging it yourself, though. Contact support@zeroturnaround.com and they'll help you. – Henri Viik Mar 27 '16 at 10:12
  • There is a "Compile on Save" option in project properties which is enabled in all of the modules including the class library. None of the check boxes in the second column of the JRebel panel has been checked. The class library have been added to both the modules namely the EJB module and the WAR module. I doubt it is out of reach of JRebel and the message, "*Open project properties to setup remote servers*" is superfluous. – Tiny Mar 27 '16 at 10:24

1 Answers1

3

Are you by chance using the synchronization button on toolbar? You need not press it if you're not using the remote servers feature, as you correctly pointed out that the server is running on localhost. The changes to class files are picked up directly from the file system, JRebel agent attached to server can find the updated classes thanks to the rebel.xml in each of the artifacts.

Furthermore, since 8.1 NetBeans doesn't necessarily update class files on save in the build directory during when project is running (at least for standalone projects), so verify that the classes are updated despite what the checkbox says. If the class files do not get updated, there's also gotcha in NetBeans compiler, hazily described in their FAQ, which essentially means that NetBeans doesn't automatically compile over the old classes if the existing classes are not compiled by the internal compiler, but are rather done by Ant or Maven. The trick to resolve it is to either:

  • Execute Clean to delete existing classes and then Run to have NB build the classes using the internal compiler
  • Create empty file named .netbeans_automatic_build inside build/classes or target/classes folder

If this does not help, as mentioned earlier, contact support@zeroturnaround.com. To speed things up, send them a trace-level jrebel.log as per manual after reproducing the issue, the class name you were trying to reload as well as link to this SO question.

Henri Viik
  • 664
  • 1
  • 5
  • 16
  • Changes are propagated automatically without pressing the "Synchronize" button which I did not notice before. The only problem now remains is the class library in which Clean or Clean & Build does not help either. After Clean or Clean & Build has been done, the server logs information like `JRebel: Reloading class 'entity.Inquiry'.`, `JRebel: Reinitialized class 'entity.Rating_$$_jvstc82_20'.` So, classes appear to have been reloaded but changes to one or more of these classes are not reflected. In the second attempt, a file name starting with a dot is not accepted by the operating system. – Tiny Mar 27 '16 at 14:54
  • I doubt the class library added to both the modules namely the EJB module (WildFly-ejb) and the web module (WildFly-war) is unreachable to JRebel and changes to this class library are unlikely to be propagated unless the class library itself is reattached to both the modules all over again from scratch. – Tiny Mar 27 '16 at 15:01
  • According to the log lines the classes indeed seem to be reloaded, so it's not compile-not-happening type of issue. What kind of changes were you doing? Constructor changes? Static initializer changes? Some kind of specific framework changes? – Henri Viik Mar 27 '16 at 15:32
  • I made changes to JPA entity classes held by the class library changing some relationship attributes to a non-existent relationship expecting an appropriate exception to be thrown but no exception is thrown, since the changes made to the class library are not propagated to the deployed EAR. It requires the class library to be reattached to both the modules all over again from scratch. – Tiny Mar 27 '16 at 17:42
  • I think this as far as I can help without seeing jrebel.log in that case, your best bet is directly to turning to the JRebel support team now. In addition, introducing broken configuration might not always be the best way of testing whether changes were propagated, depending on the framework. – Henri Viik Mar 28 '16 at 07:58