java.lang.IllegalStateException: Two resources with the same name (v1/visitdocument) must not have the same order

Hi I am using visitdocumentsui module for uploading and getting exception

java.lang.IllegalStateException: Two resources with the same name (v1/visitdocument) must not have the same order at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImpl.initializeResources(RestServiceImpl.java:288) at org.openmrs.module.webservices.rest.web.api.impl.RestServiceImpl.getResourceBySupportedClass(RestServiceImpl.java:423) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:121

Hi @mukesh, could you provide more details on how you got there? Which version of the Ref App distribution are you seeing this on? Did you install any other modules, and if yes, which ones? Which version of Visit Documents UI have you installed? You need to provide a little bit more context for others to understand what exact steps lead to this error.

I am using VisitDocumentsUI 2.0 and integrating with my custom module.I am integrating visidocumentui using url on gsp page.

The error stated is:

Did you by any chance add a resource with the same name and the same order in your custom module?

You would have to provide a lot more details than this for us to be able to help you. Pointing to the repo of your custom module for instance would be a start. And also describe detailed steps as to what you did exactly.

privous problem is solved.The main cause of privious problem is I have not injected dependency in pom.xml of custom module.Ryt now I am facing problem that upload option is not displaying on the page.

@mukesh its not very clear how you got over this .Running into the same issue with web.restservices module after introducing a new property to the TaskAction Resources getTaskActionByUuid

Ref : https://issues.openmrs.org/browse/RESTWS-764

For anyone who may run into a similar issue in the future

My issue had risen from extending TaskActionResource1_8 as below

@Resource(name = RestConstants.VERSION_1 + "/taskaction", order = 2, supportedClass = TaskAction.class, supportedOpenmrsVersions = {
        "1.8.*", "1.9.*", "1.10.*", "1.11.*", "1.12.*", "2.0.*", "2.1.*", "2.2.*", "2.3.*", "2.4.*" })
public class TaskActionResource2_4 extends TaskActionResource1_8 implements Creatable {
}

Issue disappeared by adding order = 2 to the @Resource Signature as above

1 Like