DoorsOauthSample & Lyo 2.4 & DOORS 9.7 & Java 11


  1. Used Java 11,

  2. Replaced wink with jersey
    RuntimeDelegate.setInstance(new org.glassfish.jersey.server.internal.RuntimeDelegateImpl());

  3. get a org.eclipse.lyo.client.oslc.OAuthRedirectException on step 3:

     		//STEP 3: Try to access the context URL to trigger the OAuth dance and login
     		try {
     		} catch (OAuthRedirectException oauthE) {
     			validateTokens(client,	oauthE.getRedirectURL() + "?oauth_token=" + oauthE.getAccessor().requestToken, user, passwd, webContextUrl + "/j_acegi_security_check" );
     			// Try to access again
     			***ClientResponse response = client.getResource(webContextUrl,OSLCConstants.CT_RDF);***
  4. Console output:
    DEBUG [main] ( - Attempt 1 to execute request
    DEBUG [main] ( - Sending request: GET /dwa/oauth-request-token?oauth_consumer_key=mykey&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1580955369&oauth_nonce=194445792445900&oauth_version=1.0&oauth_signature=3NwKSQ4u%2BRYapf4pARTu%2BsBZnf8%3D HTTP/1.1
    DEBUG [main] ( - >> GET /dwa/oauth-request-token?oauth_consumer_key=mykey&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1580955369&oauth_nonce=194445792445900&oauth_version=1.0&oauth_signature=3NwKSQ4u%2BRYapf4pARTu%2BsBZnf8%3D HTTP/1.1
    DEBUG [main] ( - >> Host: myhostname:8080
    DEBUG [main] ( - >> Connection: Keep-Alive
    DEBUG [main] ( - >> User-Agent: Apache-HttpClient/4.5 (Java/11.0.5)
    DEBUG [main] ( - >> Cookie: JSESSIONID=146242D83C718BFD0D14E5B46B6F8DBE
    DEBUG [main] ( - Receiving response: HTTP/1.1 200
    DEBUG [main] ( - << HTTP/1.1 200
    DEBUG [main] ( - << Content-Type: application/x-www-form-urlencoded;charset=ISO-8859-1
    DEBUG [main] ( - << Transfer-Encoding: chunked
    DEBUG [main] ( - << Date: Thu, 06 Feb 2020 02:16:09 GMT
    DEBUG [main] ( - Connection can be kept alive indefinitely
    DEBUG [main] ( - Released connection is reusable.
    DEBUG [main] ( - Releasing connection [{}->WebURL//myhostname:8080][null]
    DEBUG [main] ( - Pooling connection [{}->WebURL//myhostname:8080][null]; keep alive indefinitely
    DEBUG [main] ( - Notifying no-one, there are no waiting threads
    Enter this URL in a browser and run again: WebURL//myhostname:8080/dwa/oauth-authorize-token?oauth_token=6d934153-d152-4942-a378-32c9f1549305
    Feb 05, 2020 7:16:09 PM org.eclipse.lyo.client.oslc.samples.DoorsOauthSample main
    SEVERE: null
    at org.eclipse.lyo.client.oslc.OslcOAuthClient.getResourceInternal(
    at org.eclipse.lyo.client.oslc.OslcOAuthClient.getResourceInternal(
    at org.eclipse.lyo.client.oslc.OslcOAuthClient.getAuthorizationHeader(
    at org.eclipse.lyo.client.oslc.OslcOAuthClient.getResource(
    at org.eclipse.lyo.client.oslc.OslcClient.getResource(
    at org.eclipse.lyo.client.oslc.samples.DoorsOauthSample.main(

Hello and welcome to the OSLC forum!

@jamsden has experience with that sample. Before we start debugging, did you read In other words, do you go to the URL in the myhostname:8080/dwa/oauth-authorize-token?oauth_token=6d934153-d152-4942-a378-32c9f1549305 and still get the exception after re-running?

If you wish to have an app that does not require restart during the OAuth “dance”, please see from @jad.

still get the exception after re-running? Yes.

Looked at “” and its a Web Application. So, I would replace how we create a OslcOAuthClient (using helper) with using the factory?

OslcOAuthClientBuilder oAuthClientBuilder = OslcClientFactory.oslcOAuthClientBuilder();
oAuthClientBuilder.setOAuthConsumer("", consumerKey, consumerSecret);
oAuthClientBuilder.setUnderlyingHttpClient(new UnderlyingHttpClient() {
public HttpClient get(Client client) {
return ApacheConnectorProvider.getHttpClient(client);
client = (OslcOAuthClient);
bindClientToSession(httpServletRequest, client, consumerKey);

Additionally, DOORS classic 9.7 with DOORS Web Access DWA only supports Oauth 1.0 & 1.0a. Does your client code support these versions?

PS thanks for the help :smiley:


So, I would replace how we create a OslcOAuthClient (using helper ) with using the factory?

Yes! But please note that the OslcClientFactory is the new OSLC client (Lyo 4.0) for Jersey. I believe the DoorsOauthSample code you were looking at is based on Lyo 2.4 (and hence Wink)

Additionally, DOORS classic 9.7 with DOORS Web Access DWA only supports Oauth 1.0 & 1.0a. Does your client code support these versions?

The sample code does support Oauth 1.0 (But I am not exactly sure if it support both 1.0 and 1.0a, but at least one of them for sure.)

I tried to build/run and got:

Blockquote Could not find artifact org.eclipse.lyo.clients:oslc4j-client:jar:2.4.0

The pom sets:

Blockquote <version.lyo>4.0.0-SNAPSHOT</version.lyo>

So, not sure why the project is looking for 2.4.0?