You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Arthur Vaïsse-Lesteven <ar...@yahoo.fr> on 2013/08/30 16:16:17 UTC

SPARQL autentication and HTTP 403 error code

Hi,

It seem that an error occurs when a proxy/server send a 403 HTTP status code in response to a SPARQL query.

Stack trace begins by :

org.apache.jena.atlas.web.HttpException: 403 - Forbidden
    at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:961)
    at org.apache.jena.riot.web.HttpOp.execHttpPostForm(HttpOp.java:711)
    at com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteForm.execute(UpdateProcessRemoteForm.java:88)
    ...

The code call done before this error is :

[...]

                UpdateRequest update = UpdateFactory.create(query);
                UpdateProcessRemoteForm updateExecution = (UpdateProcessRemoteForm) UpdateExecutionFactory.createRemoteForm(update, update_endpoint_ip);
                updateExecution.setAuthentication(user_id, user_pwd.toCharArray());
                updateExecution.execute();
[...]
A possible fix may be the throw of a new ARQ exception in case of HTTPError reception.

VAÏSSE-LESTEVEN Arthur.

Re: SPARQL autentication and HTTP 403 error code

Posted by Arthur Vaïsse-Lesteven <ar...@yahoo.fr>.
Hi again, 

After a short talk with a workmate, I understand what's was my problem. 
The exceptions are RunTimeException and haven't to appear in method signature.

Maybe just add to the comments of UpdateProcessRemoteForm.execute "May throw HTTPException and ARQException" may help someone who received this error to understand the why.

Sorry again for the disturbance.

VAÏSSE-LESTEVEN Arthur.




________________________________
 De : Arthur Vaïsse-Lesteven <ar...@yahoo.fr>
À : "users@jena.apache.org" <us...@jena.apache.org> 
Envoyé le : Lundi 2 septembre 2013 9h47
Objet : Re: SPARQL autentication and HTTP 403 error code
 


Hi, 


>I don't understand what the issue is.  If you get a 403, then the server 
>is rejecting the update.  HttpException indicates such a problem.  It is 
>often useful to distinguish authentication and HTTP issues from, say, 
>parse errors.

I was just expecting that the execute signature of the method include "execute() throws HTTPException {" 

but I just noticed that the signature doesn't include "throws ARQException". This must be a code design choice
of Jena.

Sorry for the disturbance.


VAÏSSE-LESTEVEN Arthur



________________________________
 De : Andy Seaborne <an...@apache.org>
À : users@jena.apache.org 
Envoyé le : Vendredi 30 août 2013 17h48
Objet : Re: SPARQL autentication and HTTP 403 error code
 

Arthur,

I don't understand what the issue is.  If you get a 403, then the server 
is rejecting the update.  HttpException indicates such a problem.  It is 
often useful to distinguish authentication and HTTP issues from, say, 
parse errors.

    Andy

On 30/08/13 15:16, Arthur Vaïsse-Lesteven wrote:
> Hi,
>
> It seem that an error occurs when a proxy/server send a 403 HTTP status code in response to a SPARQL query.
>
> Stack trace begins by :
>
> org.apache.jena.atlas.web.HttpException: 403 - Forbidden
>      at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:961)
>      at org.apache.jena.riot.web.HttpOp.execHttpPostForm(HttpOp.java:711)
>      at
 com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteForm.execute(UpdateProcessRemoteForm.java:88)
>      ...
>
> The code call done before this error is :
>
> [...]
>
>                  UpdateRequest update = UpdateFactory.create(query);
>                  UpdateProcessRemoteForm updateExecution = (UpdateProcessRemoteForm) UpdateExecutionFactory.createRemoteForm(update, update_endpoint_ip);
>                  updateExecution.setAuthentication(user_id, user_pwd.toCharArray());
>                  updateExecution.execute();
> [...]
> A possible fix may be the throw of a new ARQ exception in case of HTTPError reception.
>
> VAÏSSE-LESTEVEN Arthur.
>

Re: SPARQL autentication and HTTP 403 error code

Posted by Arthur Vaïsse-Lesteven <ar...@yahoo.fr>.
Hi, 


>I don't understand what the issue is.  If you get a 403, then the server 
>is rejecting the update.  HttpException indicates such a problem.  It is 
>often useful to distinguish authentication and HTTP issues from, say, 
>parse errors.

I was just expecting that the execute signature of the method include "execute() throws HTTPException {" 

but I just noticed that the signature doesn't include "throws ARQException". This must be a code design choice
of Jena.

Sorry for the disturbance.


VAÏSSE-LESTEVEN Arthur



________________________________
 De : Andy Seaborne <an...@apache.org>
À : users@jena.apache.org 
Envoyé le : Vendredi 30 août 2013 17h48
Objet : Re: SPARQL autentication and HTTP 403 error code
 

Arthur,

I don't understand what the issue is.  If you get a 403, then the server 
is rejecting the update.  HttpException indicates such a problem.  It is 
often useful to distinguish authentication and HTTP issues from, say, 
parse errors.

    Andy

On 30/08/13 15:16, Arthur Vaïsse-Lesteven wrote:
> Hi,
>
> It seem that an error occurs when a proxy/server send a 403 HTTP status code in response to a SPARQL query.
>
> Stack trace begins by :
>
> org.apache.jena.atlas.web.HttpException: 403 - Forbidden
>      at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:961)
>      at org.apache.jena.riot.web.HttpOp.execHttpPostForm(HttpOp.java:711)
>      at com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteForm.execute(UpdateProcessRemoteForm.java:88)
>      ...
>
> The code call done before this error is :
>
> [...]
>
>                  UpdateRequest update = UpdateFactory.create(query);
>                  UpdateProcessRemoteForm updateExecution = (UpdateProcessRemoteForm) UpdateExecutionFactory.createRemoteForm(update, update_endpoint_ip);
>                  updateExecution.setAuthentication(user_id, user_pwd.toCharArray());
>                  updateExecution.execute();
> [...]
> A possible fix may be the throw of a new ARQ exception in case of HTTPError reception.
>
> VAÏSSE-LESTEVEN Arthur.
>

Re: SPARQL autentication and HTTP 403 error code

Posted by Andy Seaborne <an...@apache.org>.
Arthur,

I don't understand what the issue is.  If you get a 403, then the server 
is rejecting the update.  HttpException indicates such a problem.  It is 
often useful to distinguish authentication and HTTP issues from, say, 
parse errors.

	Andy

On 30/08/13 15:16, Arthur Vaïsse-Lesteven wrote:
> Hi,
>
> It seem that an error occurs when a proxy/server send a 403 HTTP status code in response to a SPARQL query.
>
> Stack trace begins by :
>
> org.apache.jena.atlas.web.HttpException: 403 - Forbidden
>      at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:961)
>      at org.apache.jena.riot.web.HttpOp.execHttpPostForm(HttpOp.java:711)
>      at com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteForm.execute(UpdateProcessRemoteForm.java:88)
>      ...
>
> The code call done before this error is :
>
> [...]
>
>                  UpdateRequest update = UpdateFactory.create(query);
>                  UpdateProcessRemoteForm updateExecution = (UpdateProcessRemoteForm) UpdateExecutionFactory.createRemoteForm(update, update_endpoint_ip);
>                  updateExecution.setAuthentication(user_id, user_pwd.toCharArray());
>                  updateExecution.execute();
> [...]
> A possible fix may be the throw of a new ARQ exception in case of HTTPError reception.
>
> VAÏSSE-LESTEVEN Arthur.
>


Re: SPARQL autentication and HTTP 403 error code

Posted by Rob Vesse <rv...@yarcdata.com>.
Failed to finish a sentence in my first paragraph

Meant to say that ARQ specifically does minimal interpretation (if any) of
HTTP status codes since and leaves it up to the user to do that if they so
desire.

Rob



On 8/30/13 8:59 AM, "Rob Vesse" <rv...@cray.com> wrote:

>This is the expected behavior when authentication fails, what were you
>expecting to happen?  ARQ specifically does not attempt
>
>What version of ARQ is this?
>
>---
>
>If you are using ARQ 2.10.1 then it has a known bug with authentication
>for updates not working correctly -
>https://issues.apache.org/jira/browse/JENA-475 - the functionality is just
>broken.  If this is the case then you can try using the latest dev
>SNAPSHOTS (2.11.0-SNAPSHOT) which contain fixes for this issue and other
>authentication improvements.
>
>---
> 
>
>If you are using a dev snapshot (2.10.2-SNAPSHOT / 2.11.0-SNAPSHOT - note
>the Jena team bumped the dev versions numbers this week) then it is likely
>a user error or a server bug.
>
>You appear to have supplied credentials but they are presumably incorrect
>since the server has returned 403 Forbidden.  Either that or the server is
>not doing HTTP challenge response properly which would be a server bug.
>If the latter is true and you are using basic auth you can work around the
>server bug by forcing preemptive authentication - see
>http://jena.staging.apache.org/documentation/query/http-auth.html for more
>information on the new authentication framework used in current ARQ dev
>versions.
>
>It's also worth nothing that the dev code now does all HTTP through Apache
>HTTP client so if you configure logging for the org.apache.http package to
>the DEBUG level you can see detailed HTTP traces of the communication
>between ARQ and the server.
>
>---
>
>Rob
>
>
>On 8/30/13 7:16 AM, "Arthur Vaïsse-Lesteven" <ar...@yahoo.fr>
>wrote:
>
>>Hi,
>>
>>It seem that an error occurs when a proxy/server send a 403 HTTP status
>>code in response to a SPARQL query.
>>
>>Stack trace begins by :
>>
>>org.apache.jena.atlas.web.HttpException: 403 - Forbidden
>>    at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:961)
>>    at org.apache.jena.riot.web.HttpOp.execHttpPostForm(HttpOp.java:711)
>>    at 
>>com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteForm.execute(UpdateProce
>>s
>>sRemoteForm.java:88)
>>    ...
>>
>>The code call done before this error is :
>>
>>[...]
>>
>>                UpdateRequest update = UpdateFactory.create(query);
>>                UpdateProcessRemoteForm updateExecution =
>>(UpdateProcessRemoteForm) UpdateExecutionFactory.createRemoteForm(update,
>>update_endpoint_ip);
>>                updateExecution.setAuthentication(user_id,
>>user_pwd.toCharArray());
>>                updateExecution.execute();
>>[...]
>>A possible fix may be the throw of a new ARQ exception in case of
>>HTTPError reception.
>>
>>VAÏSSE-LESTEVEN Arthur.
>


Re: SPARQL autentication and HTTP 403 error code

Posted by Rob Vesse <rv...@yarcdata.com>.
This is the expected behavior when authentication fails, what were you
expecting to happen?  ARQ specifically does not attempt

What version of ARQ is this?

---

If you are using ARQ 2.10.1 then it has a known bug with authentication
for updates not working correctly -
https://issues.apache.org/jira/browse/JENA-475 - the functionality is just
broken.  If this is the case then you can try using the latest dev
SNAPSHOTS (2.11.0-SNAPSHOT) which contain fixes for this issue and other
authentication improvements.

---
 

If you are using a dev snapshot (2.10.2-SNAPSHOT / 2.11.0-SNAPSHOT - note
the Jena team bumped the dev versions numbers this week) then it is likely
a user error or a server bug.

You appear to have supplied credentials but they are presumably incorrect
since the server has returned 403 Forbidden.  Either that or the server is
not doing HTTP challenge response properly which would be a server bug.
If the latter is true and you are using basic auth you can work around the
server bug by forcing preemptive authentication - see
http://jena.staging.apache.org/documentation/query/http-auth.html for more
information on the new authentication framework used in current ARQ dev
versions.

It's also worth nothing that the dev code now does all HTTP through Apache
HTTP client so if you configure logging for the org.apache.http package to
the DEBUG level you can see detailed HTTP traces of the communication
between ARQ and the server.

---

Rob


On 8/30/13 7:16 AM, "Arthur Vaïsse-Lesteven" <ar...@yahoo.fr> wrote:

>Hi,
>
>It seem that an error occurs when a proxy/server send a 403 HTTP status
>code in response to a SPARQL query.
>
>Stack trace begins by :
>
>org.apache.jena.atlas.web.HttpException: 403 - Forbidden
>    at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:961)
>    at org.apache.jena.riot.web.HttpOp.execHttpPostForm(HttpOp.java:711)
>    at 
>com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteForm.execute(UpdateProces
>sRemoteForm.java:88)
>    ...
>
>The code call done before this error is :
>
>[...]
>
>                UpdateRequest update = UpdateFactory.create(query);
>                UpdateProcessRemoteForm updateExecution =
>(UpdateProcessRemoteForm) UpdateExecutionFactory.createRemoteForm(update,
>update_endpoint_ip);
>                updateExecution.setAuthentication(user_id,
>user_pwd.toCharArray());
>                updateExecution.execute();
>[...]
>A possible fix may be the throw of a new ARQ exception in case of
>HTTPError reception.
>
>VAÏSSE-LESTEVEN Arthur.