Rserve connection fails - java

I am using WPS4R provided by 52north
Up to 3 days ago everything was fine and WPS could connect to R by use of Rserve properly but now this connection can not be made. I uninstalled everything, including Apache Tomcat,R and Java JDK, and then installed everything again. the problem still exists. This is the error that I get when I send the request. I am sure the code I used is correct, because it used to work and I did not chang any thing .
This is the error:
An R Connection Error occoured:
class org.rosuda.REngine.Rserve.RserveException - eval failed,
request status: error code: 127 null

The 127 is a parse error that is coming from R, this is not a workspace issue. If you want to get the error message back. Wrap the call to execute your script/r command with the following to get the error message. I have used this in the past and it works well. See the FAQ for more information.
http://www.rforge.net/Rserve/faq.html
c.assign(".tmp.", myCode);
REXP r = c.parseAndEval("try(eval(parse(text=.tmp.)),silent=TRUE)");
if (r.inherits("try-error")) System.err.println("Error: "+r.toString())
else { // success .. }

Related

Azure Function timeout when accessing Blob

I have encountered a strange problem when accessing an Azure Storage Blob from an Azure Function. I have a Function written in Java which is supposed to download some data from a Blob and then execute a PowerShell command. The PowerShell command can launch another Java application, which accesses the same Blob. I have this process working except for where the Function first downloads the Blob, which always gives a timeout while trying to get the size.
The weird thing is that the Java application launched by the PowerShell command uses the same code to download the Blob and can do so without any trouble at all.
Here is the relevant code snippet:
try {
blob = new BlobClientBuilder().endpoint(connStr).buildClient();
int dataSize = (int) blob.getProperties().getBlobSize(); // <- timeout occurs here
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(dataSize);
blob.download(outputStream);
outputStream.close();
String result = new String(outputStream.toByteArray(), "UTF-8");
return JsonParser.parseString(result).getAsJsonObject();
}
catch(Exception e) {
System.out.println("ERROR: "+e.getMessage());
e.printStackTrace();
return null;
}
Some relevant info:
The Blob is very small - only a few KB.
The same connection string is used in both cases.
The Blob is not the trigger for the function, but rather stores data for it.
EDIT
After getting better logs with a Log Analytics workspace, I found the timeout is being caused by a NoSuchMethodError.
java.lang.NoSuchMethodError: io.netty.handler.ssl.SslProvider.isAlpnSupported(Lio/netty/handler/ssl/SslProvider;)Z
I've seen this error before when I had the wrong version of netty-all-x.x.xFINAL.jar. Having already fixed this in the jars I upload with my code, I am now wondering where the Function gets libraries from other than what I include.
Following the exception mentioned in the edit led me to this thread:
https://github.com/Azure/azure-functions-java-worker/issues/381.
The issue was that the dependencies for the Function App itself were loading before my dependencies for my code and there is a conflict between them as mentioned here: https://github.com/Azure/azure-functions-java-worker/issues/365.
The solution was to set FUNCTIONS_WORKER_JAVA_LOAD_APP_LIBS = 1 in the Configuration settings of the Function App.
One more solution is to find out the exact error by running azure in local environment. most of the time following error is misleading.
FailureException: ClassCastException: java.lang.NoSuchMethodError cannot be cast to java.lang.RuntimeExceptionStack: java.lang.reflect.InvocationTargetExceptionat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at
following link will help you to run and debug azure function in local.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-maven-eclipse
most of the time the issues is also due to dependency jars conflicts as explained in previous post.

Braintree + Google Pay got DEVELOPER_ERROR (statusCode=10)

We developing app for food ordering. In this case we implemented Braintree payment. All is well. The next step is to implement Google Pay (I pay your attention, NOT Android Pay).
I used this documentation:
Braintree Docs:
https://developers.braintreepayments.com/guides/pay-with-google/configuration/android/v2
Google PwG Docs:
https://developers.google.com/payments/setup
This how do we implemented Google Pay:
private GooglePaymentRequest getGooglePaymentRequest(String total) {
return new GooglePaymentRequest()
.transactionInfo(TransactionInfo.newBuilder()
.setTotalPrice(total)
.setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
.setCurrencyCode("AUD")
.build())
.emailRequired(false)
.shippingAddressRequired(false)
.phoneNumberRequired(false)
.allowPrepaidCards(true)
.billingAddressRequired(false);
}
And use:
String total = String.format(Locale.getDefault(), "%1$.2f", basket.total);
DropInRequest dropInRequest = new DropInRequest()
.clientToken(clientToken)
.amount(total)
.googlePaymentRequest(getGooglePaymentRequest(total))
.collectDeviceData(true);
getMvpView().showBraintreePaymentScreen(dropInRequest);
In this case we got two situations:
On my colleague's device all is working well (video: https://drive.google.com/open?id=1wEXbv8qzGXzuXWDUy7-bhIdud_4H_s2V)
On my side I got crash (video: https://drive.google.com/open?id=15gvtkNGZ9w6v1ym7cDkwWCnqHh5JUvL7)
After this I started debug and observed next situation:
As you see in Braintree's BaseActivity I got exception with statusCode=10 that means DEVELOPER_ERROR.
So is anyone have thoughs how it can be fixed?
I ran into the same error implementing Google Pay and I found the answer to my problem here:
https://developers.google.com/pay/api/android/support/troubleshooting
Quote:
The most common error message is ERROR_CODE_DEVELOPER_ERROR. This error message also appears in the UI as a dialog with the following text:
Request Failed
An unexpected error has occurred. Please try again later.
To learn more about this error, follow these steps:
Make sure ADB is installed on your computer.
Make sure USB debugging is enabled on your device.
Connect your phone to the computer using a USB cable.
Run the following command in a terminal or command prompt on your computer:
adb -d logcat -s WalletMerchantError
The response indicates the underlying reason for the error. For example, you may see:
02-26 17:41:28.133 14593 14593 W WalletMerchantError: Error in
loadPaymentData: This merchant profile does not have access to this
feature.
Note: The error only becomes visible in logcat after you've pressed OK to close the alert.
The action you need to take to resolve the issue depends on the error message.

trouble getting link to user-defined java class from php using php-javaBridge

We need to call a user defined java function within php code,so javaBridge connection is needed.
we have done the php-javabridge-configuration and it is working fine.
http://phprambabu.blogspot.in/2016/04/php-javabridge-configuration.html
To connect php with java class, we are running the java class from eclipse on tomcat server, HTTP port:8086 and mentioning the same port number in java.inc file, and its path is added in php file as "required_once(Java.inc)".
-> this shows error in Java.inc file
but changes made in Java.inc seems correct according to other resources found on internet and stackoverflow.
changes in Java.inc
define ("JAVA_HOSTS", "localhost:8086");
...
if(!defined("JAVA_HOSTS")) {
if(!java_defineHostFromInitialQuery(java_get_base())) {
if ($java_ini=get_cfg_var("java.hosts")) define("JAVA_HOSTS",$java_ini);
else define("JAVA_HOSTS","127.0.0.1:8086");
}
}
php file content snippet
function createBridge() {
$demo = new java("main.bridge");
echo 'New Bridge instance created';
$demo->fn();
return $demo;
}
Here,
running java src folder contains -> "main" folder contains -> "bridge.java" -> fn() function
if mentioned changes are done in java.inc, Fatal error occurs:
Fatal error: HTTP status 403, Access to the specified resource has been forbidden.
Apache Tomcat/7.0.72
in C:\xampp\htdocs\JavaBridge\java\Java.inc on line 869
Line 869 refers to 3rd line of below snippet:
function dieWithBrokenConnection($msg) {
unset($this->protocol->client->protocol);
trigger_error ($msg?$msg:"unknown error: please see back end log for details",E_USER_ERROR);
}
And we are using Xampp for local server.
Please let us know if I'm doing something wrong in between or any other useful stuff that can help us out.

logstash unexpectedly stopped

I have set up a logstash with redis architecture to handle my logs. The way I have organized it is:
logstash ---> redis ---> logstash ---> elasticsearch
but the problem that occurred is that after parsing nearly 1.25 million logs a java exception is thrown.
In my logstash.err log file, the exception appears as
Exception in thread "<file" java.lang.UnsupportedOperationException
at java.lang.Thread.stop(Thread.java:869)
at org.jruby.RubyThread.exceptionRaised(RubyThread.java:1221)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:112)
at java.lang.Thread.run(Thread.java:745)
I think that this exception might be thrown because of logstash unable to open/close a file. So what can I do to rectify this error? The way that my input configuration is set for my first logstash server to send the logs is:
input {
file {
start_position => "beginning"
path => [
"/var/logstash_logs/child1/nginx/*log*",
"/var/logstash_logs/child2/nginx/*log*",
"/var/logstash_logs/child3/nginx/*log*"
]
}
}
And the way output is sent is like this:
output {
redis {
host => "X.X.X.X"
key => "logstash"
data_type => "list"
}
}
There are no errors in the logs of logstash server with redis installed.
Well, one problem here is with JRuby, which is trying to call Thread.stop(Throwable obj);, a deprecated method that throws UnsupportedOperationException and totally messes up the actual source of the error (the Throwable parameter).
So currently you can only guess what the actual problem is, and guessing is never good.
One idea is to set a breakpoint on RubyThread.exceptionRaised(); and run it through a debugger. That should allow you to find out what the original Throwable is, and then you can get to the source of the problem.
You should also check if there exists a bug ticket for JRuby about this, and possibly update your JRuby.

Randomly Channel.Connect.Failed error when calling to a Java server from Flex application using AMF protocol

I have a project published in the Internet that is used by thousands of users every day. Basically, I'm using a server in AmazonAWS with the server part compiled in Java 6 running in a Tomcat. I'm using AMF to publish the services and my client is built in Flex 4.6 using Flash Builder to generate the classes to connect to the AMF services. The code I'm using to connect to the services is this:
public var cpcService:RemotingServicesImpl;
private function callService():void
{
FlexGlobals.topLevelApplication.callingService=true;
encryptedSession=ResourcesUtil.buildSessionId(globalSettings.sessionId, globalSettings);
var responder:Responder=new Responder(gameStateLoaded, gameStateFailed);
var token:AsyncToken=cpcService.getGameState(encryptedSession, taskKey);
token.addResponder(responder);
}
private function gameStateFailed(ev:FaultEvent=null):void
{
DisplayUtil.trackErrorInfoEvent("FATAL - FatalError", "getGameState-" + FlexGlobals.topLevelApplication.mainView.currentState, ev, encryptedSession);
}
private function gameStateLoaded(ev:Object):void
{
// my fantastic code when everything is ok
}
Normally, everything is ok and my application is working, but some calls (like 1 every 500) are not working, I know it because in the trackErrorInfoEvent function I'm registering an event in the Google Analytics, so I know this is randomly happening. This is the error:
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'https://appcog.cognifit.com/messagebroker/amf'"
faultString = "Send failed"
rootCause = (null)
Of course the URL is correct and is working all times.
I have seen in some blogs that adding this line:
<add-no-cache-headers>false</add-no-cache-headers>
the problem is fixed, but I have that line in my config file and is still happening.
I have checked my server logs and I have no records for service interruptions at any time.
I really apreciate any help, thanks in advance!

Categories