← Back to team overview

dhis2-devs team mailing list archive

Re: WebApi failing Email, FileResources and

 

Hi Mike

I'm adding in Lars.. It's been a while since i looked at it.. but I don't
think that is how it was designed, if you select an org unit.. it will send
to EVERYBODY connected to that (kinda like when you assign an OU to a
user), if you want to send to individual users.. you need to select them
manually...

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Fri, Jun 3, 2016 at 6:24 PM, Mike Nelushi <mikeevolution@xxxxxxxxx>
wrote:

> Hi Morten,
>
> The messageConversations web-api is still a big issue because we need to
> send each user specific information to their e-mails.
>
> 1. Using  {"subject": subject, "text": message, "users": user}  json
> object, the mail gets stored on DHIS2 mail and does not send it to the user
> e-mail.
>
> LogUtil.java [http-apr-8080-exec-3])
> * INFO  2016-05-29 14:14:52,484 Invoking message sender: $Proxy53
> (DefaultMessageService.java [http-apr-8080-exec-3])
> * INFO  2016-05-29 14:14:52,529 Invoking message sender: SmsMessageSender
> (DefaultMessageService.java [http-apr-8080-exec-3])
> * ERROR 2016-05-29 14:14:52,579 Unexpected error occurred invoking async
> method 'public java.lang.String
> org.hisp.dhis.message.EmailMessageSender.sendMessage(java.lang.String,java.lang.String,jav
> a.lang.String,org.hisp.dhis.user.User,java.util.Set,boolean)'.
> (SimpleAsyncUncaughtExceptionHandler.java [taskScheduler-7])
> org.hibernate.LazyInitializationException: failed to lazily initialize a
> collection of role: org.hisp.dhis.user.User.organisationUnits, could not
> initialize proxy - no Session
>         at
> org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:569)
>         at
> org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:188)
>         at
> org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:139)
>         at
> org.hibernate.collection.internal.PersistentSet.size(PersistentSet.java:156)
>         at
> org.hisp.dhis.common.IdentifiableObjectUtils.join(IdentifiableObjectUtils.java:76)
>         at org.hisp.dhis.user.User.getOrganisationUnitsName(User.java:288)
>         at
> org.hisp.dhis.message.EmailMessageSender.renderPlainContent(EmailMessageSender.java:188)
>         at
> org.hisp.dhis.message.EmailMessageSender.sendMessage(EmailMessageSender.java:115)
>         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:302)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>         at
> org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:108)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
>
>
>
>
>
> 2, Using {"subject": subject, "text": message, "users": users,
> "organisationUnits": organisationUnits}, sends email to everyone in the
> Orgunit and we want to send to individuals.
>
> Please advice.
>
>
> Regards,
> Mike
>
>
>
> On Fri, Jun 3, 2016 at 4:58 AM, Morten Olav Hansen <morten@xxxxxxxxx>
> wrote:
>
>> Hi Mike
>>
>> I'm adding in the dev list, and Halvdan (who knows about file resource
>> API). I will have a look at the start as app functionality.
>>
>> --
>> Morten
>>
>> On Thu, Jun 2, 2016 at 5:00 PM, Mike Nelushi <mikeevolution@xxxxxxxxx>
>> wrote:
>>
>>> Hi Calle,
>>>
>>> Apologies, forgot to add you on this thread.
>>>
>>> Regards
>>> Mike
>>> On 2 Jun 2016 11:35, "Mike Nelushi" <mikeevolution@xxxxxxxxx> wrote:
>>>
>>>> Hi Morten,
>>>>
>>>> Its Mike here from HISP-SA.
>>>>
>>>> We have been strangling to send email to individual users on our new
>>>> Community Service Application which is going live tomorrow. At the moment
>>>> when I send an email to individuals it sends to everyone who is a DHIS2
>>>> user. Im user the dhis2.23 messageConversations web-api for this.
>>>>
>>>> A. The following are the two json objects I've used, the first one
>>>> doesn't send messages at all the messages stays on dhis2 mail.
>>>> 1. var json_Data = {"subject": subject, "text": message, "users":
>>>> users};
>>>> 2.var json_Data = {"subject": subject, "text": message, "users": users,
>>>> "organisationUnits": organisationUnits};
>>>>
>>>>
>>>> The following is our email settings
>>>>
>>>> [image: Inline image 1]
>>>>
>>>> B. Second Issue is that when we call fileResources webapi to save file
>>>> is does work but when you retrieve the file it says the file was not saved.
>>>> The following is the object:
>>>>                                     var file = item[0].files[0];
>>>>                                     var formData = new FormData();
>>>>                                     formData.append('file', file);
>>>>
>>>> C. The start page function on Appearance settings is not working if you
>>>> choice your own custom APP, when logging in it does it go to the landing
>>>> page instead it goes to index.action.
>>>>
>>>> Can you please help us with this issues?
>>>>
>>>> Regards,
>>>> Mike
>>>>
>>>
>>
>

PNG image


Follow ups

References