SDK: Watch does not hot deploy resources in webapp/resources/partials?

Hi all, hi @raff,

I was getting back at doing some Angular development within the Ref App and I put my module under watch leveraging the SDK as usual. However I realised that the Angular views, that we put under omod/src/main/webapp/resources/partials are not hot redeployed when saving them while being under watch.

I am almost positive that this used to work but I’m picking work two months after the last time I’ve done such things.

I am now on SDK 3.8.1, @mksrom who uses 3.5.0 faces the same issue.

Obviously this is making any changes in the views really cumbersome and time consuming, I’m sure I must be missing/forgetting something.

Any ideas/workarounds?

@mksd, is your project using uiframework for UI i.e. does it have

<bean class="org.openmrs.ui.framework.StandardModuleUiConfiguration">
    <property name="moduleId" value="${project.parent.artifactId}"/>

in its …applicationContext.xml ? The watch features works only, if you do. Are you able to share a link to your project to reproduce the issue?

Hi @raff, yes it does in its webModuleApplicationContext.xml. You can clone this branch.

Thank you!

But the weird thing is that it fails only with partials. GSP fragments, JS files, all those are correctly hot redeployed upon saving. It’s just those HTML files within partials that aren’t redeployed.

@raff, did you have a chance to look into this?

I’ll look into this in the next 6 hours.

Actually, @tmarzeion, how about you try to investigate it first?

Actually this has become less urgent as I’m using the following workaround: I copy the content of my HTML partial into a GSP file that is in webapp/pages/templates. Then I make my Angular directive temporarily point to the corresponding .page file. This allows me to do the client-side development with hot redeployments. When I’m finished, I copy back the content of the GSP file into the HTML original partial file, delete the GSP file and then revert the templateUrl change in the directive. Not ideal… but it allows me to get going.

So we would love to find a solution with the partials but you can definitely look at it at a later time if that’s more convenient for you. I understand that you must be quite busy with this Nexus migration… etc.

Thanks anyway for being on the fence, really appreciated.

Hey, I’ll take a look on that and let You know if I find out whats going on :slight_smile:

Great! Thank you Tomasz.

Hi @tmarzeion, did you have a chance to look into this?

Yeah I did, sorry for not responding here. I couldn’t find out whats wrong with this feature :confused: Maybe @raff took a look on that and discovered something?

Hi @tmarzeion, thanks for looking into it. But could you reproduce the issue?

@raff, any ideas?

@mksd, the issue is most likely somewhere in the uiframework. I’ll be looking into that today.

1 Like

Hi @raff, could you look into it?

I have the impression that it does not only affect partials. I’m finding myself more and more in situations where I can’t reliably trust that the client-side resources have been reloaded. I can’t quite put my finger on it though. This is happening when debugging a distro using UI Framework 3.4.

I tried to reproduce the issue yesterday, but for some reason whenever I installed the visitdocumentsui module it broke the server for me with “could not find referenceapplication provider”… I’ll pick it up today again…

Meanwhile, did you try using ctrl+f5 to force the browser to reload all page resources? There’s also Disable cache options in Chrome developer tools, which you can use instead. Let me know if it helps.

Weird, I could install our version 1.2-SNAPSHOT on qa-refapp (the old school way of course, through module administration.) Look at patient 10H71 for instance.

Strange indeed, I get the following exception when starting up the server with module loaded. I’ll check if the same happens when I load it manually after server is started…

Exception in thread "Thread-8" java.lang.NoClassDefFoundError: org/springframework/mock/web/MockMultipartFile
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(
        at java.lang.Class.getDeclaredMethods(
        at org.springframework.util.ReflectionUtils.getDeclaredMethods(
        at org.springframework.util.ReflectionUtils.doWithMethods(
        at org.springframework.util.ReflectionUtils.doWithMethods(
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(
        at org.openmrs.module.ModuleUtil.refreshApplicationContext(
        at org.openmrs.module.web.WebModuleUtil.refreshWAC(
        at org.openmrs.web.Listener.performWebStartOfModules(
        at org.openmrs.web.Listener.performWebStartOfModules(
        at org.openmrs.web.Listener.startOpenmrs(
        at org.openmrs.web.WebDaemon$
Caused by: java.lang.ClassNotFoundException: org.springframework.mock.web.MockMultipartFile
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
        at org.openmrs.module.ModuleClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        ... 24 more

Ok sorry, you would have to pull and clone the tip of the dev branch now (the default one). What you see was an error that I cleared a little while ago while developing.