Hi Dinuka,

1) Now I tried with 'docker-compose up' command to start the backend
components and then the API server started using main method in
APIServerStarter. After that server started without errors.
2) Yes.  Got the access and replaced that new setting file with my local
file and its works fine. Thanks.

However, I tried to connect my API server to Djngo portal by changing the
settings file. Following the changes, I have done,

AIRAVATA_API_HOST =  '127.0.0.1'
AIRAVATA_API_SECURE = False

Then I tried to use the portal and got the following exception.

[pool-25-thread-1] ERROR
org.apache.airavata.service.security.KeyCloakSecurityManager {} -
Error occurred while checking if user: jayancv is authorized for
action: /airavata/getAllApplicationInterfaces in gateway: default
java.io.IOException: Server returned HTTP response code: 401 for URL:
https://airavata.host:8443/auth/realms/default/protocol/openid-connect/userinfo
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1924)
~[?:?]
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
~[?:?]
        at 
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
~[?:?]
        at 
org.apache.airavata.service.security.KeyCloakSecurityManager.getFromUrl(KeyCloakSecurityManager.java:397)
~[classes/:?]
        at 
org.apache.airavata.service.security.KeyCloakSecurityManager.getUserInfo(KeyCloakSecurityManager.java:323)
~[classes/:?]
        at 
org.apache.airavata.service.security.KeyCloakSecurityManager.validateToken(KeyCloakSecurityManager.java:353)
~[classes/:?]
        at 
org.apache.airavata.service.security.KeyCloakSecurityManager.getGatewayGroupMembership(KeyCloakSecurityManager.java:334)
~[classes/:?]
        at 
org.apache.airavata.service.security.KeyCloakSecurityManager.isUserAuthorized(KeyCloakSecurityManager.java:256)
~[classes/:?]
        at 
org.apache.airavata.service.security.interceptor.SecurityInterceptor.authorize(SecurityInterceptor.java:71)
~[classes/:?]
        at 
org.apache.airavata.service.security.interceptor.SecurityInterceptor.invoke(SecurityInterceptor.java:56)
~[classes/:?]

Can you please explain how this local API server connects to the portal?

Thank you.


On Sat, Sep 24, 2022 at 1:49 AM Dinuka De Silva <[email protected]>
wrote:

> Hi Jayan,
>
> It's our pleasure to have your interest in Airavata and I'm honored to
> provide you with any guidance.
>
> 1) For me to help you better, could you please provide me with the command
> you run for the API server? I wonder if you have the docker-compose-up
> correctly.
>
> 2) I hope you have access to the testdrive since I'm seeing your
> account on the portal. For the Django portal, have you downloaded the
> settings file [1] from the testdrive and included it in your local
> repository?
>
> Dinuka
>
> [1] https://testdrive.airavata.org/admin/developers/
>
>
> On Tue, Sep 20, 2022 at 4:38 PM Jayan Vidanapathirana <
> [email protected]> wrote:
>
>> Hi All,
>> I'm Jayan and a new one to this Airavata community.
>> I was able to setup the Airavata API service and Django Portal referring
>> the README files in the Django project and the Airavata project. However, I
>> have faced the following errors.
>>
>> 1) *Airavata API server startup Exception*
>> Exception in thread "main" java.lang.RuntimeException: Failed to
>> post-initialize the expcatalog database
>> at
>> org.apache.airavata.registry.core.utils.ExpCatalogDBInitConfig.postInit(ExpCatalogDBInitConfig.java:81)
>> at
>> org.apache.airavata.common.utils.DBInitializer.initializeDB(DBInitializer.java:46)
>> at
>> org.apache.airavata.registry.api.service.RegistryAPIServer.StartRegistryServer(RegistryAPIServer.java:69)
>> at
>> org.apache.airavata.registry.api.service.RegistryAPIServer.start(RegistryAPIServer.java:151)
>> at
>> org.apache.airavata.ide.integration.APIServerStarter.main(APIServerStarter.java:23)
>> Caused by: java.lang.RuntimeException: Failed to get EntityManager
>> at
>> org.apache.airavata.registry.core.repositories.AbstractRepository.execute(AbstractRepository.java:137)
>> at
>> org.apache.airavata.registry.core.repositories.AbstractRepository.get(AbstractRepository.java:75)
>> at
>> org.apache.airavata.registry.core.repositories.AbstractRepository.isExists(AbstractRepository.java:113)
>> at
>> org.apache.airavata.registry.core.repositories.expcatalog.GatewayRepository.isGatewayExist(GatewayRepository.java:99)
>> at
>> org.apache.airavata.registry.core.utils.ExpCatalogDBInitConfig.postInit(ExpCatalogDBInitConfig.java:62)
>> ... 4 more
>>
>> 2) *Trying to login Local Django portal *
>> Traceback (most recent call last):
>>   File
>> "/home/jayan/Desktop/Airavata/airavata-django-portal/django_airavata/apps/auth/backends.py",
>> line 38, in authenticate
>>     token, userinfo = self._get_token_and_userinfo_password_flow(
>>   File
>> "/home/jayan/Desktop/Airavata/airavata-django-portal/django_airavata/apps/auth/backends.py",
>> line 111, in _get_token_and_userinfo_password_flow
>>     token = oauth2_session.fetch_token(token_url=token_url,
>>   File
>> "/home/jayan/Desktop/Airavata/airavata-django-portal/venv/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py",
>> line 183, in fetch_token
>>     raise InsecureTransportError()
>> oauthlib.oauth2.rfc6749.errors.InsecureTransportError:
>> (insecure_transport) OAuth 2 MUST utilize https.
>>
>>
>> *** I have already tried  'export OAUTHLIB_INSECURE_TRANSPORT=1' . But
>> it's not worked for me*
>>
>> I'm looking for some assistance to move forward by resolving these errors.
>>
>> Also, I have followed the Airawata tutorials[1],[2] and I would like to
>> play with a few jobs on testdrive[3] if it's possible to get
>> permission.(username : jayancv)
>>
>> Thanks.
>>
>> [1]
>> https://apache-airavata-django-portal.readthedocs.io/en/latest/tutorial/custom_ui_tutorial/
>> [2] https://www.youtube.com/watch?v=ES4LNC_j8a0
>> [3] https://testdrive.airavata.org/workspace/dashboard
>> --
>> Best Regards
>>
>> Jayan Vidanapathirana
>> [image: https://lk.linkedin.com/in/jayancv]
>> <https://lk.linkedin.com/in/jayancv>
>>
>

-- 
Best Regards

Jayan Vidanapathirana
[image: https://lk.linkedin.com/in/jayancv]
<https://lk.linkedin.com/in/jayancv>

Reply via email to