error using curl command

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”

···

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)

···

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

not working

···

On Thu, Sep 3, 2015 at 5:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Channara, are you using GOW?

https://github.com/bmatzelle/gow

···

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works

···

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow


Morten

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

yes, it work too.

···

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Morten,
Hi tried test with user:password first. but still error.

···

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Can you show us the file you are trying to send?

···

On Fri, Sep 4, 2015 at 3:46 PM, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Morten

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

···

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

···

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20

Inline image 1

1.json (860 Bytes)

···

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi

Can you add -v and have a look at the Authorization header? see if its present / the same for both the GET and the POST query

···

On Mon, Sep 7, 2015 at 5:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Morten

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

image

image

image

···

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

OH!, ok let me check character-set

Hi Morten, when i add -v. i got this message.

···

On Mon, Sep 7, 2015 at 5:39 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

so which encoding should i choose? now default is “UTF-8-BOM”

image

···

On Mon, Sep 7, 2015 at 5:42 PM, channara rin rin.channara@gmail.com wrote:

OH!, ok let me check character-set

Hi Morten, when i add -v. i got this message.

On Mon, Sep 7, 2015 at 5:39 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Do not use BOM. Just utf-8.

image

···

On 7 September 2015 at 11:44, channara rin rin.channara@gmail.com wrote:

so which encoding should i choose? now default is “UTF-8-BOM”

On Mon, Sep 7, 2015 at 5:42 PM, channara rin rin.channara@gmail.com wrote:

OH!, ok let me check character-set

Hi Morten, when i add -v. i got this message.

On Mon, Sep 7, 2015 at 5:39 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

it doesn’t work.

image

···

On Mon, Sep 7, 2015 at 5:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Do not use BOM. Just utf-8.

On 7 September 2015 at 11:44, channara rin rin.channara@gmail.com wrote:

so which encoding should i choose? now default is “UTF-8-BOM”

On Mon, Sep 7, 2015 at 5:42 PM, channara rin rin.channara@gmail.com wrote:

OH!, ok let me check character-set

Hi Morten, when i add -v. i got this message.

On Mon, Sep 7, 2015 at 5:39 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi ,
This should work.

{

“trackedEntity”: “PtPf474EHLM”,

“orgUnit”: “NcA7HpabeAG”,

“attributes”: [{

“attribute”: “jZbsh2zpVWa”,

“value”: “0201”

}, {

“attribute”: “j9sScvXsXVO”,

“value”: “Name of Person”

}, {

“attribute”: “szmBW8EDWLx”,

“value”: “Male”

}, {

“attribute”: “adZnoplDPyx”,

“value”: “48”

}, {

“attribute”: “j16LxVcr8hV”,

“value”: “1967-08-31”

}, {

“attribute”: “T82mY6tjGVY”,

“value”: “Married”

}, {

“attribute”: “pyX2F5mjX5L”,

“value”: “Siem Reap”

}, {

“attribute”: “CakCGhhkSJK”,

“value”: “Siem Reap”

}, {

“attribute”: “zAKBPz96mci”,

“value”: “Siem Reap”

}, {

“attribute”: “VstyNjHv8KM”,

“value”: “%u1782%u17C4%u1780%u1785%u1780”

}, {

“attribute”: “SmHt9k5t501”,

“value”: “%u1782%u17C4%u1780%u1785%u1780”

}, {

“attribute”: “CQqQwvsiZsg”,

“value”: “%u1797%u17BC%u1798%u17B7%A0%u178F%u17D2%u179A%u1796%u17B6%u17C6%u1784%u179F%u17C1%u17C7”

}, {

“attribute”: “HVcRcWAW55I”,

“value”: “ART”

}, {

“attribute”: “RtAymQ0PT5p”,

“value”: “410”

}, {

“attribute”: “ZSEdw9AHbIC”,

“value”: “1641”

}, {

“attribute”: “JQtRizheDhD”,

“value”: “2005-04-11”

}]

}

Also,you also had an extra comma after {

“attribute”: “JQtRizheDhD”,

“value”: “2005-04-11”

}

Please use http://jsonlint.com/ to verfiy your JSON.

Regards,

Jason

image

image

image

image

image

···

On Mon, Sep 7, 2015 at 12:49 PM, channara rin rin.channara@gmail.com wrote:

it doesn’t work.

On Mon, Sep 7, 2015 at 5:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Do not use BOM. Just utf-8.

On 7 September 2015 at 11:44, channara rin rin.channara@gmail.com wrote:

so which encoding should i choose? now default is “UTF-8-BOM”

On Mon, Sep 7, 2015 at 5:42 PM, channara rin rin.channara@gmail.com wrote:

OH!, ok let me check character-set

Hi Morten, when i add -v. i got this message.

On Mon, Sep 7, 2015 at 5:39 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

Yes, i changed alredy to make very my json. now is valide.
But it is still error using curl command. it always display this messge like below:

image

image

···

On Mon, Sep 7, 2015 at 5:52 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi ,
This should work.

{

“trackedEntity”: “PtPf474EHLM”,

“orgUnit”: “NcA7HpabeAG”,

“attributes”: [{

“attribute”: “jZbsh2zpVWa”,

“value”: “0201”

}, {

“attribute”: “j9sScvXsXVO”,

“value”: “Name of Person”

}, {

“attribute”: “szmBW8EDWLx”,

“value”: “Male”

}, {

“attribute”: “adZnoplDPyx”,

“value”: “48”

}, {

“attribute”: “j16LxVcr8hV”,

“value”: “1967-08-31”

}, {

“attribute”: “T82mY6tjGVY”,

“value”: “Married”

}, {

“attribute”: “pyX2F5mjX5L”,

“value”: “Siem Reap”

}, {

“attribute”: “CakCGhhkSJK”,

“value”: “Siem Reap”

}, {

“attribute”: “zAKBPz96mci”,

“value”: “Siem Reap”

}, {

“attribute”: “VstyNjHv8KM”,

“value”: “%u1782%u17C4%u1780%u1785%u1780”

}, {

“attribute”: “SmHt9k5t501”,

“value”: “%u1782%u17C4%u1780%u1785%u1780”

}, {

“attribute”: “CQqQwvsiZsg”,

“value”: “%u1797%u17BC%u1798%u17B7%A0%u178F%u17D2%u179A%u1796%u17B6%u17C6%u1784%u179F%u17C1%u17C7”

}, {

“attribute”: “HVcRcWAW55I”,

“value”: “ART”

}, {

“attribute”: “RtAymQ0PT5p”,

“value”: “410”

}, {

“attribute”: “ZSEdw9AHbIC”,

“value”: “1641”

}, {

“attribute”: “JQtRizheDhD”,

“value”: “2005-04-11”

}]

}

Also,you also had an extra comma after {

“attribute”: “JQtRizheDhD”,

“value”: “2005-04-11”

}

Please use http://jsonlint.com/ to verfiy your JSON.

Regards,

Jason

On Mon, Sep 7, 2015 at 12:49 PM, channara rin rin.channara@gmail.com wrote:

it doesn’t work.


Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Mon, Sep 7, 2015 at 5:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Do not use BOM. Just utf-8.

On 7 September 2015 at 11:44, channara rin rin.channara@gmail.com wrote:

so which encoding should i choose? now default is “UTF-8-BOM”

On Mon, Sep 7, 2015 at 5:42 PM, channara rin rin.channara@gmail.com wrote:

OH!, ok let me check character-set

Hi Morten, when i add -v. i got this message.

On Mon, Sep 7, 2015 at 5:39 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Channara,

You must properly encode your Khmer characters. Maybe Morten can say more about this, but I am pretty sure it has something to do with this.

Here is the actual text (not screenshot), which indicates an error related to some invalid characters.

Regards,

Jason

jason@jason-Precision-M2800:~/Downloads$ curl -d @1.jsonhttps://apps.dhis2.org/demo/api/trackedEntityInstances” -X POST -H “Content-Type: application/json” -u admin:district

Apache Tomcat/7.0.63 - Error report

HTTP Status 500 - Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')


type Exception report

message Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

description The server encountered an internal error that prevented it from fulfilling this request.

exception

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('' (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

at [Source: {"trackedEntity":"PtPf474EHLM","orgUnit":"NcA7HpabeAG","attributes":[{"attribute":"jZbsh2zpVWa","value":"0201"},{"attribute":"j9sScvXsXVO","value":"Name of Person"},{"attribute":"szmBW8EDWLx","value":"Male"},{"attribute":"adZnoplDPyx","value":"48"},{"attribute":"j16LxVcr8hV","value":"1967-08-31"},{"attribute":"T82mY6tjGVY","value":"Married"},{"attribute":"pyX2F5mjX5L","value":"Siem Reap"},{"attribute":"CakCGhhkSJK","value":"Siem Reap"},{"attribute":"zAKBPz96mci","value":"Siem Reap"},{"attribute":"VstyNjHv8KM","value":"គោកចក"},{"attribute":"SmHt9k5t501","value":"គោកចក"},{"attribute":"CQqQwvsiZsg","value":"ភូមិ ត្រពាំងសេះ"},{"attribute":"HVcRcWAW55I","value":"ART"},{"attribute":"RtAymQ0PT5p","value":"410"},{"attribute":"ZSEdw9AHbIC","value":"1641"},{"attribute":"JQtRizheDhD","value":"2005-04-11"},]}; line: 1, column: 2]

com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1487)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518)

com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1461)

com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)

com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3602)

com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3547)

com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2578)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.fromJson(JacksonTrackedEntityInstanceService.java:83)

org.hisp.dhis.dxf2.events.trackedentity.JacksonTrackedEntityInstanceService.addTrackedEntityInstanceJson(JacksonTrackedEntityInstanceService.java:133)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy177.addTrackedEntityInstanceJson(Unknown Source)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)

org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

com.sun.proxy.$Proxy127.addTrackedEntityInstanceJson(Unknown Source)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController.postTrackedEntityInstanceJson(TrackedEntityInstanceController.java:357)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$FastClassBySpringCGLIB$$cfbc2606.invoke(<generated>)

org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)

org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController$$EnhancerBySpringCGLIB$$ab43fc35.postTrackedEntityInstanceJson(<generated>)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:497)

org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)

javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)

javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:93)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.63 logs.


Apache Tomcat/7.0.63

jason@jason-Precision-M2800:~/Downloads$

On Mon, Sep 7, 2015 at 12:24 PM, channara rin rin.channara@gmail.com wrote:

hi morten,
if i coding with PHP use CURL command. i still get the following error. and my json in attached file.

By the way, i use apache v8 and DHIS2 v2.20


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Fri, Sep 4, 2015 at 3:58 PM, channara rin rin.channara@gmail.com wrote:

If i tried use test with -u … that is work fine. but if i add more function like -X POST -d -v… it doesn’t work…

On Fri, Sep 4, 2015 at 3:55 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

I just had a look at your original mail and I see that the user admin was recognized so it means the curl option was ok but some issue with the password. My guess is that you have some strange characters in the password which are being expanded/interpreted by the shell.

Try quoting like:

-u “admin:xxxxx”

or

-u ‘admin:xxxxx’

On 4 September 2015 at 09:46, channara rin rin.channara@gmail.com wrote:

Hi Morten,
Hi tried test with user:password first. but still error.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Sep 3, 2015 at 11:43 PM, channara rin rin.channara@gmail.com wrote:

yes, it work too.

On Thu, Sep 3, 2015 at 6:45 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Try to test with something simpler

curl -u user:pass http://server/api/dataElements

And see if it works


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Sep 3, 2015 at 5:23 PM, Knut Staring knutst@gmail.com wrote:

Channara, are you using GOW?

https://github.com/bmatzelle/gow

On Thu, Sep 3, 2015 at 12:08 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

I have also seen weird issues on window versions of cURL where -u user:pass is required to be FIRST (mac/linux should be fine)


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org


Morten

On Thu, Sep 3, 2015 at 5:07 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Channara

The man page for curl indicates that the format of the command is:

curl

Try moving your url to the end of the line, after the options. Also you might want to add “http://localhost.…”


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 3 September 2015 at 11:01, channara rin rin.channara@gmail.com wrote:

Hi DHIS2 friends,
i tried use curl command to import tracker, but i got error.

can you help me what is problem?

***THIS IS COMMAND RUNNING:

***THIS IS CONSOLE in APACHE


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp