Andre Zege
2013-Feb-05 05:33 UTC
[R] failure to connect to Bloomber using Rbbg from batch script on Windows
I am having a puzzling problem with bloomberg connection. When i run from R prompt some code that has .... library(Rbbg) conn <- blpConnect(throw.ticker.errors = FALSE) print("connected") ... I establish connection every time and then proceed to get data when i run this code from R prompt. However, when i run this from a batch script, i get the following error output from Rbbg: ====================R version 2.15.2 (2012-10-26) rJava Version 0.9-4 Rbbg Version 0.4-155 Java environment initialized successfully. Adding C:\blp\API\APIv3\JavaAPI\v3.5.1.1\lib\blpapi3.jar to Java classpath <simpleError in ls(envir = envir, all.names = private): invalid 'envir' argument> ====================== I looked in Rbbg and Bloomberg log files and they have the following: blpjavaapi0.log.0 ==============2013/02/04 19:46:50.635 blpapi.Session.3 <init> [INFO] UserAgent=Library:Java;Version:3.5.1.1;&OS=Name:Windows 7;Version:6.1;VMVersion:1.6.0_23;VMVendor:Sun Microsystems Inc.; 2013/02/04 19:46:50.635 blpapi.Session.3 <init> [INFO] SessionParameters: [ defaultServices = [//blp/mktdata, //blp/refdata], defaultSubscriptionService = //blp/mktdata, defaultTopicPrefix = ticker/, allowMultiCorrelatorsPerMsg = false, connectTimeout = 5000, clientMode = AUTO, maxPendingRequests = 1024, autoRestartOnDisconnection = false, authenticationOptions = , numStartAttempts = -1, reconnectionInterval = 3000, compat33x = false, serverAddress = [localhost:8194], keepAliveRequestInterval= 20000, keepAliveResponseTimeout= 5000, maxEventQueueSize= 10000, slowConsumerWarningHiWaterMark= 0.75, slowConsumerWarningLoWaterMark= 0.5] 2013/02/04 19:46:50.720 blpapi.PlatformConnection.3.Platform.0 b [INFO] Session established with: localhost/127.0.0.1:8194 2013/02/04 19:46:50.721 blpapi.Session.AuthorizationManager.3 b [INFO] AuthorizationManager connectionUp ([0/3]) 2013/02/04 19:46:50.722 blpapi.Session.AuthorizationManager.3 b [INFO] Nothing to authorize. No pre-loaded authorization requests. ================== org.findata.blpwrapper.0.log-1.1 ===============Feb 4, 2013 7:40:17 PM org.findata.blpwrapper.Connection processSessionStatusEvent WARNING: SessionStartupFailure = { reason = { source = "Session" errorCode = 1001 category = "UNCLASSIFIED" description = "CONNECTION_FAILURE" subcategory = } } =========================== None of these error messages gives me a clue of what could be wrong. The only vague thought i have is that something about Java or rJava might not be initializing correctly. I must admit i am not used to running things on Windows, so maybe i am missing something simple. Just in case i did something stupid I simply have the following in my batch file R CMD BATCH --no-restore --no-save "C:/Users/.../tmp.R" "C:/Users/.../tmp.out" and tmp.R has a call to function that connects to Bloomberg. Batch is invoked by scheduler I am running R version 2.15.2 (2012-10-26) rJava Version 0.9-4 Rbbg Version 0.4-155 64 bit Win 7 Ultimate Would greatly appreciate any hints Andre [[alternative HTML version deleted]]
John Laing
2013-Feb-05 12:22 UTC
[R] failure to connect to Bloomber using Rbbg from batch script on Windows
Andre, Does the batch script always fail, or is it sometimes successful? You've probably tried running in batch and interactively one after the other, but if not please do that to make sure it isn't a timing issue with the Bloomberg connection. Also, you can turn up the logging in Rbbg: conn <- blpConnect(throw.ticker.errors = FALSE, log.level = "finest") Maybe that will shed some light on the problem. -John On Tue, Feb 5, 2013 at 12:33 AM, Andre Zege <azege@yahoo.com> wrote:> I am having a puzzling problem with bloomberg connection. When i run from > R prompt some code that has > .... > > library(Rbbg) > > conn <- blpConnect(throw.ticker.errors = FALSE) > print("connected") > > ... > I establish connection every time and then proceed to get data when i run > this code from R prompt. However, when i run this from a batch script, i > get the following error output from Rbbg: > > > ====================> R version 2.15.2 (2012-10-26) > rJava Version 0.9-4 > Rbbg Version 0.4-155 > Java environment initialized successfully. > Adding C:\blp\API\APIv3\JavaAPI\v3.5.1.1\lib\blpapi3.jar to Java classpath > <simpleError in ls(envir = envir, all.names = private): invalid 'envir' > argument> > ======================> > I looked in Rbbg and Bloomberg log files and they have the following: > > blpjavaapi0.log.0 > ==============> 2013/02/04 19:46:50.635 blpapi.Session.3 <init> [INFO] > UserAgent=Library:Java;Version:3.5.1.1;&OS=Name:Windows > 7;Version:6.1;VMVersion:1.6.0_23;VMVendor:Sun Microsystems Inc.; > 2013/02/04 19:46:50.635 blpapi.Session.3 <init> [INFO] SessionParameters: > [ defaultServices = [//blp/mktdata, //blp/refdata], > defaultSubscriptionService = //blp/mktdata, defaultTopicPrefix = ticker/, > allowMultiCorrelatorsPerMsg = false, connectTimeout = 5000, clientMode > AUTO, maxPendingRequests = 1024, autoRestartOnDisconnection = false, > authenticationOptions = , numStartAttempts = -1, reconnectionInterval > 3000, compat33x = false, serverAddress = [localhost:8194], > keepAliveRequestInterval= 20000, keepAliveResponseTimeout= 5000, > maxEventQueueSize= 10000, slowConsumerWarningHiWaterMark= 0.75, > slowConsumerWarningLoWaterMark= 0.5] > 2013/02/04 19:46:50.720 blpapi.PlatformConnection.3.Platform.0 b [INFO] > Session established with: localhost/127.0.0.1:8194 > 2013/02/04 19:46:50.721 blpapi.Session.AuthorizationManager.3 b [INFO] > AuthorizationManager connectionUp ([0/3]) > 2013/02/04 19:46:50.722 blpapi.Session.AuthorizationManager.3 b [INFO] > Nothing to authorize. No pre-loaded authorization requests. > ==================> > > org.findata.blpwrapper.0.log-1.1 > ===============> Feb 4, 2013 7:40:17 PM org.findata.blpwrapper.Connection > processSessionStatusEvent > WARNING: SessionStartupFailure = { > reason = { > source = "Session" > errorCode = 1001 > category = "UNCLASSIFIED" > description = "CONNECTION_FAILURE" > subcategory > } > } > ===========================> > None of these error messages gives me a clue of what could be wrong. The > only vague thought i have is that something about Java or rJava might not > be initializing correctly. I must admit i am not used to running things on > Windows, so maybe i am missing something simple. Just in case i did > something stupid I simply have the following in my batch file > > R CMD BATCH --no-restore --no-save "C:/Users/.../tmp.R" > "C:/Users/.../tmp.out" > and tmp.R has a call to function that connects to Bloomberg. Batch is > invoked by scheduler > > I am running > R version 2.15.2 (2012-10-26) > rJava Version 0.9-4 > Rbbg Version 0.4-155 > 64 bit Win 7 Ultimate > > Would greatly appreciate any hints > > Andre > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >[[alternative HTML version deleted]]