****  Startup code****

I removed that strange code and worked the same as if it were not there. The
privileges problem I have is still there.

2011/10/20 Juan David Pastás Rivera <[email protected]>

> **** DcmOF and DcmRcv ****
>
> I tried putting the references as fields in MainImpl, with getters and
> setters in Main, but did not work. I am going to try that again, maybe I
> forgot something.
>
> ****  Startup code****
>
> I am using Activator public void started().... I've just see something
> strange in my code:
>
>         static int runs = 0;
>         public void started() {
> if (++runs == 1) {
> start();
>  }
> }
>
> that ++runs was because the activator was executing two times at startup.
> Maybe it is all the problem.
>
> However, why the started method could be being executed twice? I know that
> sound strange. But I said this because before I bypassed that issue, the
> console was printing a binding exception because the ports of the servers
> were occupied.
>
> ****This is when creating the order type:****
>
> org.openmrs.api.APIAuthenticationException: Privileges required: [View
> Order Types]
> at
> org.openmrs.aop.AuthorizationAdvice.throwUnauthorized(AuthorizationAdvice.java:115)
>  at
> org.openmrs.aop.AuthorizationAdvice.before(AuthorizationAdvice.java:94)
> at
> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.ja
> va:49)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
>  at $Proxy88.getAllOrderTypes(Unknown Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
>  at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:18
> 3)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>  at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>  at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
> at $Proxy88.getAllOrderTypes(Unknown Source)
>  at
> org.openmrs.module.radiologymodule.Utils.getRadiologyOrderType(Utils.java:96)
> at
> org.openmrs.module.radiologymodule.Activator.typeAndRoles(Activator.java:79)
>  at org.openmrs.module.radiologymodule.Activator.start(Activator.java:67)
> at org.openmrs.module.radiologymodule.Activator.started(Activator.java:45)
>  at
> org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:746)
> at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:791)
>  at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:615)
> at org.openmrs.web.Listener.startOpenmrs(Listener.java:207)
>  at org.openmrs.web.Listener.contextInitialized(Listener.java:146)
> at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>  at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
> at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>  at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
>  at
> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
> at
> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
>  at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
>  at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
>  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
>  at
> org.apache.catalina.core.StandardService.start(StandardService.java:519)
> at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>  at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
>  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>
>
> ****This is when creating the roles:****
>
> org.openmrs.api.APIAuthenticationException: Privileges required: [View
> Users]
> at
> org.openmrs.aop.AuthorizationAdvice.throwUnauthorized(AuthorizationAdvice.java:115)
>  at
> org.openmrs.aop.AuthorizationAdvice.before(AuthorizationAdvice.java:94)
> at
> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.ja
> va:49)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
>  at $Proxy80.getUser(Unknown Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
>  at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:18
> 3)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>  at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>  at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
> at $Proxy80.getUser(Unknown Source)
>  at
> org.openmrs.module.radiologymodule.Activator.typeAndRoles(Activator.java:97)
> at org.openmrs.module.radiologymodule.Activator.start(Activator.java:67)
>  at
> org.openmrs.module.radiologymodule.Activator.started(Activator.java:45)
> at
> org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:746)
>  at
> org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:791)
> at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:615)
>  at org.openmrs.web.Listener.startOpenmrs(Listener.java:207)
> at org.openmrs.web.Listener.contextInitialized(Listener.java:146)
>  at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
>  at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
> at
> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
>  at
> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
>  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
> at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
>  at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>  at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
> at org.apache.catalina.core.StandardService.start(StandardService.java:519)
>  at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
>  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>
> On Thu, Oct 20, 2011 at 5:54 AM, Ben Wolfe <[email protected]> wrote:
>
>> DcmOF is a class in your module, so you don't need to worry about how you
>> load it.  When you load external classes from libraries or other modules you
>> need to load it through the openmrsclassloader (Context.loadClass())
>>
>> I am out of ideas as to why the variable is not "persisting" as a static
>> var on your classes.
>>
>> The problem with creating roles seems strange to me too.  If you set the
>> creator to a valid user it should just work in a subclass of
>> ModuleActivator.  Which method in the activator are you using?
>>
>> And can you attach a stack trace of the error?
>>
>>
>> Ben
>>
>> 2011/10/19 Juan David Pastás Rivera <[email protected]>
>>
>>> I think I am messing some things:
>>>
>>> **** my first problem ****
>>>
>>> I want to call DcmOF.main and DcmRcv.main methods, which I changed to
>>> return a DcmOF and DcmRcv objects from which I could call stop. I do not
>>> have clear knowledge about the scope of the returned object (This object is
>>> from whom I want to have a reference which I can use in a controller).
>>>
>>> You said me that with Context.loadClass("org.dcm4che2.tool.dcmof.DcmOF")
>>> I can get the class loaded, but I think I need the instance to stop the
>>> server. I am not sure where is good to put that instance, maybe as a spring
>>> bean or do not know what other options are.
>>>
>>> **** my second problem ****
>>>
>>> Create order type and roles from Activator.startup(), this problem seems
>>> to be caused by not to have an authenticated user at startup, because when I
>>> call the code that creates the order type and roles with a authenticated
>>> user accessing a route the order type and roles are created successfully.
>>>
>>> On Wed, Oct 19, 2011 at 1:31 PM, Ben Wolfe <[email protected]> wrote:
>>>
>>>> The only reasons I can think of are:
>>>> 1) Its getting cleared/reset by something else
>>>> 2) You're actually getting two different classes
>>>>
>>>> For the second one if would be a classloader issue.  Is the class
>>>> duplicated in another jar somewhere?  Are you calling the right static
>>>> class?
>>>>
>>>> (Please leave the previous email thread in your replies.  It helps for
>>>> those people on the list that /don't/ use gmail. :-))
>>>>
>>>> Ben
>>>>
>>>> 2011/10/19 Juan David Pastás Rivera <[email protected]>
>>>>
>>>>> The static variable prints null from a controller.
>>>>> ------------------------------
>>>>> Click here to 
>>>>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from
>>>>>  OpenMRS Developers' mailing list
>>>>>
>>>>
>>>> ------------------------------
>>>> Click here to 
>>>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from
>>>>  OpenMRS Developers' mailing list
>>>>
>>>
>>> ------------------------------
>>> Click here to 
>>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from 
>>> OpenMRS Developers' mailing list
>>>
>>
>> ------------------------------
>> Click here to 
>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from 
>> OpenMRS Developers' mailing list
>>
>
>

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to