

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
7 messages in com.googlegroups.google-finance-apisInternal Server Error -- indeterminis...| From | Sent On | Attachments |
|---|---|---|
| theBeacon | Jul 6, 2008 8:40 pm | |
| Dion Loy (Google) | Jul 7, 2008 3:27 pm | |
| theBeacon | Jul 9, 2008 11:40 am | |
| theBeacon | Jul 21, 2008 4:25 pm | |
| Dion Loy (Google) | Jul 23, 2008 9:56 am | |
| theBeacon | Jul 24, 2008 2:38 pm | |
| theBeacon | Jul 24, 2008 2:42 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Internal Server Error -- indeterministic occurrence when creating transactions | Actions... |
|---|---|---|
| From: | theBeacon (theB...@googlemail.com) | |
| Date: | Jul 6, 2008 8:40:55 pm | |
| List: | com.googlegroups.google-finance-apis | |
Hi,
I get indeterministically the same Internal Server Error when creating new transactions that I get from my database. Sometimes the code below creates 1, 2, 5 or so transactions before throwing the error below. I have adapted the sample code.
The error occurs here: TransactionEntry insertedEntry = service.insert(new URL(feedUrl), entry);
I have tried putting a sleep command to delay transaction creation a bit. .
Any ideas?
/** * @param args server, user email, and user password in that order. */ public static void main(String[] args) throws Exception {
BasicConfigurator.configure(); // should use log.properties instead! TODO log.info("Starting StrategyEvaluator...");
// Create ratings db connection: Class.forName("org.sqlite.JDBC"); dbConnection = DriverManager.getConnection("jdbc:sqlite:var/....dbev");
// Google Finance GData service. FinanceService service = new FinanceService("Google- PortfoliosDemo-1.0"); Scanner sc = new Scanner(System.in); System.out.println("Sample Google Finance Portfolios Client"); if (args.length != 1 && args.length != 3) { printUsage(); System.exit(0); } // Set username and password from command-line arguments if they were passed // in. Otherwise prompt the user to login. if (args.length == 3) { userEmail = args[1]; userPassword = args[2]; } else { System.out.print("Enter user ID: "); userEmail = sc.nextLine(); System.out.print("Enter user password: "); userPassword = sc.nextLine(); } if (!loginUser(service, userEmail, userPassword)) { printUsage(); System.exit(0); } server = args[0]; baseUrl = server + basePath + "default";
portfolioIdProperty = "2";
Statement stat = dbConnection.createStatement();
ResultSet allTradesRs = stat.executeQuery("select * from _trades_5starSimpleFew where symbol=='JOBS';"); while (allTradesRs.next()) { tickerProperty = "NASDAQ:" + allTradesRs.getString(StockrConstants.DB_TRADES_SYMBOL); // TODO remove hardcoded exchange String requestUrl = baseUrl + PORTFOLIO_FEED_URL_SUFFIX + "/"; //System.out.println("requestUrl before: " + requestUrl); requestUrl += portfolioIdProperty + POSITION_FEED_URL_SUFFIX + "/" + tickerProperty + TRANSACTION_FEED_URL_SUFFIX; //System.out.println("requestUrl after: " + requestUrl); String type = allTradesRs.getString(StockrConstants.DB_TRADES_ACTION); String date = allTradesRs.getString(StockrConstants.DB_TRADES_DATE); String shares = allTradesRs.getString(StockrConstants.DB_TRADES_AMOUNT); String price = allTradesRs.getString(StockrConstants.DB_TRADES_PRICE); String commission = "0.0"; String currency = ""; // exchange determines the currency String notes = ""; TransactionEntry entry = FinanceUtilities.makeTransactionEntry( type, date, shares, price, commission, currency, notes); insertTransactionEntry(service, requestUrl, entry); Thread.sleep(5000); // causes indeterministic errors, perhaps a sleep might help? }
//_______________________ // Shut down ratings db connection dbConnection.close();
}
the log:
... Sample Google Finance Portfolios Client Inserting Entry at location: http://finance.google.com/finance/feeds/default/portfolios/2/positions/NASDAQ:JOBS/transactions Exception in thread "main" com.google.gdata.util.ServiceException: Internal Server Error An error occurred while processing the request
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(Unknown Source) at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(Unknown Source) at com.google.gdata.client.http.HttpGDataRequest.checkResponse(Unknown Source) at com.google.gdata.client.http.HttpGDataRequest.execute(Unknown Source) at com.google.gdata.client.http.GoogleGDataRequest.execute(Unknown Source) at com.google.gdata.client.Service.insert(Unknown Source) at com.google.gdata.client.GoogleService.insert(Unknown Source) at portfolioevaluation.GFinanceUploader.insertTransactionEntry(GFinanceUploader.java: 1002) at portfolioevaluation.GFinanceUploader.main(GFinanceUploader.java: 1132)







