Home > IT Architecture, Programming > resolved – Artifactory: Return code is: 502, ReasonPhrase:cannot connect

resolved – Artifactory: Return code is: 502, ReasonPhrase:cannot connect

August 22nd, 2016

Today when I tried to visit Maven Artifactory, below error prompted in browser:

Return code is: 502, ReasonPhrase:cannot connect.

And here's the log in

2016-08-19 22:48:19,942 [art-init] [ERROR] (o.a.w.s.ArtifactoryContextConfigListener:91) - Application could not be initialized: Connection refused
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_51]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_51
]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:
1.7.0_51]

......

Firstly, I thought it was caused by JDBC issue, here's the config in JDBC config file storage.properties:

# cat /u01/oracle/artifactory_home/etc/storage.properties
type=oracle
driver=oracle.jdbc.OracleDriver
url=jdbc:oracle:thin:@localhost:1521:ORCL
username=artifactory
password=password1

I tried connect to DB using sqlplus to have a test, it's OK:

[root@testvm ~]# su - oracle
[oracle@testvm ~]$ export ORACLE_HOME=/u01/oracle/db12c/product/12.1.0/dbhome_1
[oracle@testvm ~]$ ORACLE_SID=orcl
[oracle@testvm ~]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@testvm ~]$ sqlplus artifactory/password1

SQL*Plus: Release 12.1.0.1.0 Production on Mon Aug 22 03:28:20 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Last Successful login time: Mon Aug 22 2016 03:21:26 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

After some debugging, I found the issue was caused by proxy setting. We should disable it like below:

[oracle@testvm ~]# grep proxy /etc/profile
#export http_proxy=http://myproxy.example.com:80/

Then log out and log on the host again, and ran below commands to shutdown/startup Artifactory:

[oracle@testvm ~]$ export ORACLE_HOME=/u01/oracle/db12c/product/12.1.0/dbhome_1/
[oracle@testvm ~]$ export ORACLE_SID=orcl
[oracle@testvm ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@testvm ~]$ /u01/oracle/apache-tomcat-7.0.52/bin/shutdown.sh
[oracle@testvm ~]$ /u01/oracle/apache-tomcat-7.0.52/bin/startup.sh

After this, Artifactory started working again.

Good Luck!


Categories: IT Architecture, Programming Tags:
Comments are closed.