Index: modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/DatasourceIndexClient.java
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/DatasourceIndexClient.java	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/DatasourceIndexClient.java	(revision 46718)
@@ -46,16 +46,25 @@
 
 			long count = rsp.getResults().getNumFound();
 			final SolrDocument doc = Iterables.getFirst(rsp.getResults(), new SolrDocument());
+			if (log.isDebugEnabled()) {
+				log.debug(String.format("got document %s", doc.toString()));
+			}
+			if (doc.isEmpty()) {
+				throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("cannot find document matching query: %s", query));
+			}
 			final String date = getDate(doc);
 
 			return new IndexRecordsInfo(count, date);
 		} catch (final Throwable e) {
-			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying publications from: " + dsId);
+			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying publications from: " + dsId, e);
 		}
 	}
 
-	private String getDate(final SolrDocument doc) {
+	private String getDate(final SolrDocument doc) throws ApiException {
 		final List<Date> dsversion = (List<Date>) doc.get(DSVERSION);
+		if (dsversion == null || dsversion.isEmpty()) {
+			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("cannot find %s in matched solr document", DSVERSION));
+		}
 		final Date date = Iterables.getLast(dsversion);
 
 		return DateFormatUtils.format(date, DatasourceFunctions.DATE_FORMAT);
@@ -68,7 +77,7 @@
 			final String dsversion = doc.get("__dsversion").toString();
 			return StringUtils.substringBefore(dsversion, "T");
 		} catch (CloudIndexClientException e) {
-			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying index DS profile: " + info);
+			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying index DS profile: " + info, e);
 		}
 	}
 
Index: modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/JdbcDatasourceDao.java
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/JdbcDatasourceDao.java	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/JdbcDatasourceDao.java	(revision 46718)
@@ -47,7 +47,7 @@
 				}
 			}
 		} catch(SQLException e) {
-			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying datasource ids from database");
+			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying datasource ids from database", e);
 		}
 		return res;
 	}
@@ -64,7 +64,7 @@
 				}
 			}
 		} catch(SQLException | IOException e) {
-			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying datasource '%s' from database", id));
+			throw new ApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying datasource '%s' from database", id), e);
 		}
 	}
 
Index: modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/DatasourceInfoRetriever.java
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/DatasourceInfoRetriever.java	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/DatasourceInfoRetriever.java	(revision 46718)
@@ -17,6 +17,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 
 /**
  * Created by claudio on 20/10/2016.
@@ -41,6 +42,9 @@
 
 	private final static int WORKERS = 100;
 
+	@Value("${datasource.publisher.timeout}")
+	private int timeout = 10;
+
 	public DatasourceInfoRetriever() {
 		service = MoreExecutors.listeningDecorator(
 				new ScheduledThreadPoolExecutor(WORKERS,
@@ -98,7 +102,7 @@
 						innerLatch.countDown();
 					}
 				});
-				waitLatch(innerLatch, errors, 10);
+				waitLatch(innerLatch, errors, timeout);
 
 				outerLatch.countDown();
 			}
@@ -109,7 +113,7 @@
 			}
 		});
 
-		waitLatch(outerLatch, errors, 10);
+		waitLatch(outerLatch, errors, timeout);
 
 		if (!errors.isEmpty()) {
 			datasourceResponse.getResponseHeader().setError(Joiner.on("\n").skipNulls().join(Iterables.transform(errors, new Function<Throwable, String>() {
Index: modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/MongoLoggerClient.java
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/MongoLoggerClient.java	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/clients/MongoLoggerClient.java	(revision 46718)
@@ -11,11 +11,10 @@
 import com.mongodb.MongoClient;
 import com.mongodb.client.FindIterable;
 import com.mongodb.client.MongoCollection;
-import com.mongodb.client.model.Filters;
 import com.mongodb.client.model.Projections;
 import eu.dnetlib.datasource.publisher.ApiException;
+import eu.dnetlib.datasource.publisher.clients.utils.DatasourceFunctions;
 import eu.dnetlib.datasource.publisher.model.*;
-import eu.dnetlib.datasource.publisher.clients.utils.DatasourceFunctions;
 import eu.dnetlib.miscutils.datetime.DateUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateFormatUtils;
@@ -27,6 +26,10 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.Cacheable;
 
+import static com.mongodb.client.model.Filters.*;
+
+
+
 /**
  * Created by claudio on 20/10/2016.
  */
@@ -48,11 +51,15 @@
 	private static MongoCollection<Document> collection = null;
 
 	private Bson getQuery(final String dsId) {
-		return Filters.and(dbo("parentDatasourceId", dsId), dbo("system:profileFamily", "aggregator"), dbo("system:isCompletedSuccessfully", "true"));
+		return and(
+				eq("parentDatasourceId", dsId),
+				eq("system:profileFamily", "aggregator"),
+				eq("system:isCompletedSuccessfully", "true"));
 	}
 
 	private synchronized MongoCollection<Document> getCollection() {
 		if (collection == null) {
+			log.info("inizializing mongodb collection ...");
 			collection = datasourcePublisherMongoClient.getDatabase(dbName).getCollection(collectionName);
 		}
 		return collection;
@@ -128,13 +135,14 @@
 	}
 
 	private static Bson getFields() {
-		return Projections.fields(dbo("system:wfName", 1),
-				dbo("system:node:SELECT_MODE:selection", 1),
-				dbo("mainlog:sinkSize", 1),
-				dbo("mainlog:writeOps", 1),
-				dbo("mainlog:total", 1),
-				dbo("system:startHumanDate", 1),
-				dbo("system:profileName", 1));
+		return Projections.fields(
+				eq("system:wfName", 1),
+				eq("system:node:SELECT_MODE:selection", 1),
+				eq("mainlog:sinkSize", 1),
+				eq("mainlog:writeOps", 1),
+				eq("mainlog:total", 1),
+				eq("system:startHumanDate", 1),
+				eq("system:profileName", 1));
 	}
 
 	private static BasicDBObject dbo(final String key, final Object value) {
Index: modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/ApiException.java
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/ApiException.java	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/ApiException.java	(revision 46718)
@@ -8,4 +8,9 @@
 		super(msg);
 		this.code = code;
 	}
+
+	public ApiException (int code, String msg, Throwable e) {
+		super(msg, e);
+		this.code = code;
+	}
 }
Index: modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/DatasourcesApiController.java
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/DatasourcesApiController.java	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/java/eu/dnetlib/datasource/publisher/DatasourcesApiController.java	(revision 46718)
@@ -1,17 +1,12 @@
 package eu.dnetlib.datasource.publisher;
 
-import java.util.List;
-
-import com.google.common.collect.Lists;
 import eu.dnetlib.common.rmi.DNetRestDocumentation;
 import eu.dnetlib.datasource.publisher.clients.ClientResponse;
 import eu.dnetlib.datasource.publisher.clients.DatasourceInfoRetriever;
 import eu.dnetlib.datasource.publisher.model.DatasourceResponse;
-
 import eu.dnetlib.datasource.publisher.model.IdentifiersResponse;
 import eu.dnetlib.datasource.publisher.model.Response;
-import io.swagger.annotations.*;
-
+import io.swagger.annotations.ApiParam;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.BeanUtils;
Index: modules/dnet-datasource-rest-api/trunk/src/main/resources/eu/dnetlib/datasource/publisher/applicationContext-dnet-datasource-publisher.properties
===================================================================
--- modules/dnet-datasource-rest-api/trunk/src/main/resources/eu/dnetlib/datasource/publisher/applicationContext-dnet-datasource-publisher.properties	(revision 46717)
+++ modules/dnet-datasource-rest-api/trunk/src/main/resources/eu/dnetlib/datasource/publisher/applicationContext-dnet-datasource-publisher.properties	(revision 46718)
@@ -14,3 +14,4 @@
 datasource.publisher.jdbc.minIdle   =   1
 datasource.publisher.jdbc.maxIdle   =   20
 datasource.publisher.getsingle.sql  =   /eu/dnetlib/datasource/publisher/getDatasources.sql.st
+datasource.publisher.timeout        =   10
