hygieia / hygieia

CapitalOne DevOps Dashboard
http://hygieia.github.io/hygieia
Apache License 2.0
3.79k stars 1.79k forks source link

unable to access API #255

Closed gitfan89 closed 8 years ago

gitfan89 commented 8 years ago

Hi ,

I'm unable to bringup the dashboard api using : http://localhost:8080/api/

Command : java -jar api.jar --spring.config.location=D:\Hygieia\api\dashboard.properties

dashboard.properties

Default server configuration values

dbname=admin
dbusername=db dbpassword=dbpass dbhost=127.0.0.1 dbport=27017 server.contextPath=/api server.port=8080

Used below command to create user for API section :

use admin db.createUser({user: "db", pwd: "dbpass", roles: [{role: "readWrite", db: "dashboard"}]})

Error Snippet while hitting http://localhost:8080/api/

2015-12-27 16:10:43,978 INFO o.s.j.e.a.AnnotationMBeanExporter - Registering beans for JMX exposure on startup 2015-12-27 16:10:44,018 INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"] 2015-12-27 16:10:44,044 INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"] 2015-12-27 16:10:44,060 INFO o.a.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read 2015-12-27 16:10:44,094 INFO o.s.b.c.e.t.TomcatEmbeddedServletContainer - Tomcat started on port(s): 8080 (http) 2015-12-27 16:10:44,096 INFO com.capitalone.dashboard.Application - Started Application in 7.205 seconds (JVM running for 8.055) 2015-12-27 16:10:58,129 INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring FrameworkServlet 'dispatcherServlet' 2015-12-27 16:10:58,129 INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization started 2015-12-27 16:10:58,182 INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization completed in 53 ms

2015-12-27 16:10:58,233 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'api'] with root cause java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'api'

92015-12-27 16:10:58,273 ERROR o.a.c.c.C.[Tomcat].[localhost] - Exception Processing ErrorPage[errorCode=0, location=/error] javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

meanwhile, I'm able to bring up the UI and collectors are starting fine.

Also, I'm able to logon to the mongodb from mongo shell fine using below command :

mongo 127.0.0.1:27017/admin -u db -pdbpass

I'm not able to make out whether there is a problem with api authentication with DB or its a purely an API issue(btw I don't have tomcat as well as docker installed @ my desktop)

gitfan89 commented 8 years ago

@tabladrum @amitmawkin : Could you pls help me here ? Thnks!

tabladrum commented 8 years ago

Can you try this for command line: java -jar api.jar --spring.config.name=api --spring.config.location=D:\Hygieia\api\dashboard.properties

gitfan89 commented 8 years ago

Hi @tabladrum , that worked like charm ;) Much appreciated 

I’m now able to bring up the dashboard , sign-up and create new widgets with one hiccup. GitHub collectors is working fine but with Jenkins collector , I’m unable to add new build widget for jenkins . Below is the screenshot of the issue.

image

localhost:8080/api/dashboard , gives below o/p json

and for localhost:3000/api/collectors/scm ; below is the o/p

jenkins_collector

Further details : I have 2 databases in Mongo : 1. ”dashboard” for collectors and “dashboarddb” database for the API and I’m able to log-on to both of the dbs from the mongo shell.

Not sure what is the issue here or I'm missing something silly.

tabladrum commented 8 years ago

Please run the jenkins collector and report any error found.

gitfan89 commented 8 years ago

@tabladrum : Thnks once again.. I'm able to run the jenkins collector fine and able to bring-up the jenkins widget on the dashboard but the data like, number of builds are not getting populated. Below is the snapshot :

image

I have 6 builds completed as a test run but builds per day in dashboard displays none .

image

Also, not sure suddenly the github collector is failing with the below error :

2015-12-30 00:37:11,793 INFO com.capitalone.dashboard.Application - Started Application in 4.414 seconds (JVM running for 5.226) 2015-12-30 00:37:15,001 INFO c.c.d.collector.CollectorTask - Running Collector: GitHub 2015-12-30 00:37:15,007 INFO c.c.d.collector.CollectorTask - ------------------------------ 2015-12-30 00:37:15,008 INFO c.c.d.collector.CollectorTask - Starting... 2015-12-30 00:37:15,008 INFO c.c.d.collector.CollectorTask - ------------------------------ 2015-12-30 00:37:15,057 ERROR c.c.d.collector.DefaultGitHubClient - no protocol: github.com 2015-12-30 00:37:15,086 ERROR o.s.s.s.TaskUtils$LoggingErrorHandler - Unexpected error occurred in scheduled task. java.lang.IllegalStateException: Could not create URI object: Expected scheme name at index 0: ://api/v3/repos/ub.com/commits?sha=master&since=2015-12-30T00:27Z at org.springframework.web.util.HierarchicalUriComponents.toUri(HierarchicalUriComponents.java:416) ~[spring-web-4.1.0.RELEASE.jar!/:4.1.0.RELEASE] at org.springframework.web.util.UriTemplate.expand(UriTemplate.java:121) ~[spring-web-4.1.0.RELEASE.jar!/:4.1.0.RELEASE] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:520) ~[spring-web-4.1.0.RELEASE.jar!/:4.1.0.RELEASE] at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:439) ~[spring-web-4.1.0.RELEASE.jar!/:4.1.0.RELEASE] at com.capitalone.dashboard.collector.DefaultGitHubClient.makeRestCall(DefaultGitHubClient.java:200) ~[github-scm-collector-1.5.0-SNAPSHOT.jar!/:1.5.0-SNAPSHOT] at com.capitalone.dashboard.collector.DefaultGitHubClient.getCommits(DefaultGitHubClient.java:129) ~[github-scm-collector-1.5.0-SNAPSHOT.jar!/:1.5.0-SNAPSHOT] at com.capitalone.dashboard.collector.GitHubCollectorTask.collect(GitHubCollectorTask.java:135) ~[github-scm-collector-1.5.0-SNAPSHOT.jar!/:1.5.0-SNAPSHOT] at com.capitalone.dashboard.collector.CollectorTask.run(CollectorTask.java:63) ~[core-1.5.0-SNAPSHOT.jar!/:1.5.0-SNAPSHOT] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.1.7.RELEASE.jar!/:4.1.7.RELEASE] at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.1.7.RELEASE.jar!/:4.1.7.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_45] at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [na:1.8.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_45] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_45] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_45] at java.lang.Thread.run(Unknown Source) [na:1.8.0_45] Caused by: java.net.URISyntaxException: Expected scheme name at index 0: ://api/v3/repos/ub.com/commits?sha=master&since=2015-12-30T00:27Z at java.net.URI$Parser.fail(Unknown Source) ~[na:1.8.0_45] at java.net.URI$Parser.failExpecting(Unknown Source) ~[na:1.8.0_45] at java.net.URI$Parser.parse(Unknown Source) ~[na:1.8.0_45] at java.net.URI.(Unknown Source) ~[na:1.8.0_45] at org.springframework.web.util.HierarchicalUriComponents.toUri(HierarchicalUriComponents.java:401) ~[spring-web-4.1.0.RELEASE.jar!/:4.1.0.RELEASE] ... 16 common frames omitted

github application.properties

Database Name

spring.data.mongodb.database=dashboard

Database HostName - default is localhost

spring.data.mongodb.host=127.0.0.1

Database Port - default is 27017

spring.data.mongodb.port=27017

Database Username - default is blank

spring.data.mongodb.username=dbtest

Database Password - default is blank

spring.data.mongodb.password=dbpass

Collector schedule (required)

github.cron= * * * * * *

github.host=github.com

Maximum number of days to go back in time when fetching commits

github.commitThresholdDays=15

amitmawkin commented 8 years ago

try putting https in your github url

gitfan89 commented 8 years ago

I tried that too but the issue persists with same error as stated above.

java -jar github-scm-collector-1.5.0-SNAPSHOT.jar --spring.config.name=github --spring.config.location=D:\Hygieia\github-scm-collector\application.properties

gitfan89 commented 8 years ago

@tabladrum @amitmawkin : When I had a look at the collectors collections , i can see online= false for github whereas for jenkins its true.. will it be causing any trouble.

image

gitfan89 commented 8 years ago

Resolved the issue , cleared the dashboard db contents and restarted it.. worked fine.. Closing the issue.. Thnks for the support.

aleitner commented 8 years ago

I am encountering this same error. I tried running as recommended java -jar api.jar --spring.config.name=api --spring.config.location=dashboard.properties

Jar was built using latest source code. Are there no releases for the .jars?

dashboard.properties dbname=dashboarddb dbusername=dashboarduser dbpassword=1qazxSw2 dbhost=127.0.0.1 dbport=27017 server.contextPath=/api server.port=8080

I'm successfully conntecting to mongo 2016-01-21T14:16:11.412+0000 I NETWORK [initandlisten] connection accepted from 127.0.0.1:57993 #37 (1 connection now open) 2016-01-21T14:16:11.941+0000 I ACCESS [conn37] Successfully authenticated as principal dashboarduser on dashboarddb 2016-01-21T14:16:11.949+0000 I NETWORK [initandlisten] connection accepted from 127.0.0.1:57994 #38 (2 connections now open) 2016-01-21T14:16:12.053+0000 I ACCESS [conn38] Successfully authenticated as principal dashboarduser on dashboarddb 2016-01-21T14:16:13.376+0000 I NETWORK [initandlisten] connection accepted from 127.0.0.1:57995 #39 (3 connections now open) 2016-01-21T14:16:13.462+0000 I ACCESS [conn39] Successfully authenticated as principal dashboarduser on dashboarddb 2016-01-21T14:16:13.516+0000 I NETWORK [initandlisten] connection accepted from 127.0.0.1:57996 #40 (4 connections now open) 2016-01-21T14:16:13.548+0000 I ACCESS [conn40] Successfully authenticated as principal dashboarduser on dashboarddb 2016-01-21T14:16:13.552+0000 I NETWORK [initandlisten] connection accepted from 127.0.0.1:57997 #41 (5 connections now open) 2016-01-21T14:16:13.587+0000 I ACCESS [conn41] Successfully authenticated as principal dashboarduser on dashboarddb

The error I receive when going to /api endpoint: 2016-01-21 14:17:55,185 INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization completed in 45 ms 2016-01-21 14:17:55,283 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/api] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'api'] with root cause java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'api'

@tabladrum @amitmawkin

tabladrum commented 8 years ago

Try this endpoint: http://:/api/dashboard and see if you get at least get empty json. Also, make sure that the properties file is in the right path, safer is to put the full path.

aleitner commented 8 years ago

I changed the path to be hardcoded, and I'm still getting the same thing.

/api/dashboard resource returns a []. I'm guessing this is empty json data

tabladrum commented 8 years ago

And looks like you are all set. For some reason, when you start the api for the first time you see that (specially when it is done from eclipse)... some thing is trying to hit /api as an endpoint is there is no such endpoint. All API end points will be api/something.

oshingc commented 8 years ago

Did you build a database called dashboardb locally?

aleitner commented 8 years ago

I didn't realize that. thanks for the clarification and quick responses!

And yes I built dashboarddb locally

Clement06 commented 7 years ago

Unable to connect with the API Layer in Hygieia Dashboard. Getting error as "WARN o.s.web.servlet.PageNotFound - Request method 'POST' not supported"

Command used and tried for API layer java -jar api.jar --spring.config.name=api --spring.config.location=G:\NewLearning\Hygieia-master\api\dashboard.properties

In the UI , API connectivity is showing as red crossed Please assit

vandz1 commented 7 years ago

@gitfan89 , How to clear the dashboardb contents? And, are you talking about restarting mongod?