binance-exchange / binance-java-api

binance-java-api is a lightweight Java library for the Binance API, supporting synchronous and asynchronous requests, as well as event streaming using WebSockets.
MIT License
831 stars 628 forks source link

Guys/ Gals.. is this related to the MVC issue w/jackson ? but I can call binance from IDE fine.. but from a GCP deploy... it blows #268

Open johnda98 opened 4 years ago

johnda98 commented 4 years ago

The code works fine in Eclipse IDE from console... but server 500 in GCP ! pls help thanks

and yes the binance java api .jar is on my eclipse GCP build path sucked in.. so it should bundle that up when deploying to GCP

https://console.cloud.google.com/logs/viewer?project=assetsalecrobv41-282617&resource=gae_app%2Fmodule_id%2Fdefault%2Fversion_id%2F20200710t120500&minLogLevel=0&expandAll=false&timestamp=2020-07-10T17%3A14%3A26.554000000Z&customFacets&limitCustomFacetWidth=true&dateRangeStart=2020-07-10T16%3A14%3A26.806Z&dateRangeEnd=2020-07-10T17%3A14%3A26.806Z&interval=PT1H&logName=projects%2Fassetsalecrobv41-282617%2Flogs%2Fappengine.googleapis.com%252Frequest_log&scrollTimestamp=2020-07-10T17%3A14%3A16.804597000Z&advancedFilter=resource.type%3D%22gae_app%22%0Aresource.labels.project_id%3D%22assetsalecrobv41-282617%22%0Aresource.labels.version_id%3D%2220200710t120500%22%0Aresource.labels.zone%3D%22us12%22%0Aresource.labels.module_id%3D%22default%22%0Atimestamp%3D%222020-07-10T17%3A14%3A16.804597000Z%22%0AinsertId%3D%225f08a1e8000ea45482d9c68f%22

here is the code.. i think i handle ALL the exceptions in the servlet class call

package asalegroup;

import com.binance.api.client.BinanceApiClientFactory; import com.binance.api.client.BinanceApiRestClient; import com.binance.api.client.domain.market.TickerStatistics; import com.binance.api.client.exception.BinanceApiException;

public class Getcryptopair {

public static String getpair(String pair) throws BinanceApiException {

String pairprice;

BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance(); BinanceApiRestClient client = factory.newRestClient();

// Test connectivity
client.ping();

//long serverTime = client.getServerTime();
//out.println("<p> Time of ticker from Binance - its Servertime : " + serverTime + "</p>");

//TickerStatistics tickerStatistics = client.get24HrPriceStatistics("NEOETH");
//out.println("<p> NEO ETH : " + tickerStatistics.getLastPrice() + "</p>");

//String price = tickerStatistics.getLastPrice().toString();
//out.println("<p> as string .. " + price + "</p>");

TickerStatistics tickerStatistics = client.get24HrPriceStatistics(pair);
//out.println("<p> HBAR USDT : " + tickerStatistics2.getLastPrice() + "</p>");
 pairprice = tickerStatistics.getLastPrice();

return pairprice;

}

}

the servlet call... package asalegroup;

import java.io.IOException; import java.io.PrintWriter;

import java.util.logging.Logger;

import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

/**

Servlet implementation class GetBinancepairs / @WebServlet("/getusdhbar_rate/") public class GetBinancepairs extends HttpServlet { private static final long serialVersionUID = 1L;

/**

@see HttpServlet#HttpServlet() */ public GetBinancepairs() { super(); // TODO Auto-generated constructor stub } /**

@see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub //response.getWriter().append("Served at: ").append(request.getContextPath());

response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter();

out.println(""); out.println("");

out.println(""); out.println("CRob Smart Contract interaction. Hedera Hashgraph Testnet");

out.println(""); out.println("

Hedera Hashgraph & Smart Contract 'Direct Asset' Example. "); out.println("

Binance USD HBAR pricing ... "); out.println("

"); out.println(""); out.println("

"); out.println(" Current pricing at this time of call to market is : " + Getcryptopair.getpair("HBARUSDT") + "

"); And the binance java api JAR is on my GCP project build path

RafaelAdao commented 4 years ago

Do you have the spring-boot-devtools dependency on your pom.xml? I went through a case like this that, after removing the dependency from the project, started to work at GCP