Closed chandrantwins closed 4 years ago
Hey @chandrantwins can you just help me a bit...
I would like to exclude setup issues...
$options = [ 'servlet_address' => 'http://localhost:8080/MyJavaBridge/servlet.phpjavabridge' ];
try {
$ba = new BridgeAdapter($options);
$d = $ba->getDriver();
$hashMap = $ba->java('java.util.HashMap', [
'message' => 'Hello world',
'value' => $ba->java('java.math.BigInteger', PHP_INT_MAX)
]);
$hashMap->put('message', '你好,世界');
echo $hashMap->get('message');
} catch (BridgeException\ConnectionException $e) {
}
In your case com.google.api.external.RestConnection
You can check by pointing on the bridge address on http://localhost:8080/MyJavaBridge/
From there I can provide more support
Nice day !
Hi Belgattitude, Thanks for your quick answer. I have to add some more information to you.. This error not happens always, every time first loading i have this problem, after that its working normally. so i can say this error is not stable at all.
and one more additional info is, this symfony application is loaded inside iframe.. is that make difference?
shortly speaking its working as expected except first time
I guess not related to iframe...
What gives this ?
$ba = new BridgeAdapter($options);
$restConn = $ba->java('com.google.api.external.RestConnection');
echo $ba->getDriver()->inspect($restConn);
die();
The doc about inspect is here: https://belgattitude.github.io/soluble-japha/language_useful_functions/#inspect-a-javaobject
Hi, This is the response from above code [class com.google.api.external.RestConnection: Constructors: public com.google.api.external.RestConnection()
Fields:
Methods: public java.lang.String com.google.api.external.RestConnection.getChannels(java.lang.String) public java.lang.String com.google.api.external.RestConnection.getAkeneoStatus(java.lang.String) public org.json.JSONObject com.google.api.external.RestConnection.getAkeneoInfo() public org.json.JSONObject com.google.api.external.RestConnection.categorySync(java.lang.String) public org.json.JSONObject com.google.api.external.RestConnection.syncData(java.lang.String) public java.lang.String com.google.api.external.RestConnection.getVersion() public org.json.JSONObject com.google.api.external.RestConnection.getInfo() public java.lang.String com.google.api.external.RestConnection.getAttributes(java.lang.String) public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException public final void java.lang.Object.wait() throws java.lang.InterruptedException public boolean java.lang.Object.equals(java.lang.Object) public java.lang.String java.lang.Object.toString() public native int java.lang.Object.hashCode() public final native java.lang.Class java.lang.Object.getClass() public final native void java.lang.Object.notify() public final native void java.lang.Object.notifyAll()
Classes: ]
Hi, For your information this method call one external api and return that response as array. is that possible? if api call not yet finished but returns this method called? $attributeString = $javaObject->getAttributes($storehash);
any idea? this is just my guess
NullPointerException is always tricky :D
With the little context I have, I just feel there's something to look into:
For your information this method call one external api and return that response as array
but
public java.lang.String com.google.api.external.RestConnection.getAttributes(java.lang.String)
(Just to be sure, the nullpointer is not actually real and sent from there)
Second path I would investigate... because "this problem seems to occur from time to time". Be sure the initialization of the bridge is done only once (during the life of you php request)
Does it help ?
PS:
BTW, I'm not using the bridge anymore... It was more a playground for me although there's still few heavy production workloads based on it... But IMO I don't really see big future as rest api's are so easy to write now. Just for you to know, but of course there's a bit of fun doing it :) Choose with care.
Hi belgattitude,
Thanks for your reply, i found reason for null pointer ,finally. its jdbc connection problem in hibernate access, i solved that.. now i dont see that error.
Thanks Chandran
Dear developer,
Thanks for awesome solution for connecting php and java. Please help me to resolve this following issue
I hope you can solve this issue ASAP..
Let me know how to resolve this solution.. i hope this is caused by invoke failed.. i dont know how to handle this.. is that already handled in this connector? this is my code used with bridge.