%ProcessError+6 ^%Net.Remote.Proxy.1 error occurs inconsistently
Hi
number - @''"
Set conn = ##class(%Net.Remote.Gateway).%
Set tSC = conn.%Connect("127.0.0.1", "55000", "NETTEST") // No error here
Set api = ##class(writetofile.WriteFile)
set strFile = "d:\temp\example.txt"
set strInput = "Hello world"
set ret = api.FilePut(strFile,strInput)
Set tSC = conn.%Disconnect()
{
Parameter IMPORTTIMESTAMP As STRING = "2013-07-17 16:40:43";
Method %OnNew(ByRef p0 As %
{
If '$D(p0) If ($IO["TCP") { Quit $$$OK } Else { Set x=$$
Quit ..%Constructor(p0,"
}
Method getuFileText() As %ObjectHandle
{
Quit ..%IR("get_FileText")
}
Method setuFileText(ByRef p0 A
{
Do ..%I("set_FileText",.p0)
}
Method getuFilePath() As %ObjectHandle
{
Quit ..%IR("get_FilePath")
}
Method setuFilePath(ByRef p0 A
{
Do ..%I("set_FilePath",.p0)
}
Method FilePut(ByRef p0 As %
{
Do ..%I("FilePut",.p0,.p1)
}
}
Comments
you miss a check in your code
Set tSC = conn.%Connect("127.0.0.1", "55000", "NETTEST") // No error here
set strFile = "d:\temp\example.txt"
set strInput = "Hello world"
set ret = api.FilePut(strFile,strInput)
Set tSC = conn.%Disconnect()
Your connection may have failed, so next call will fail too,
Thanks Robert for your help.
I used the below line to check tSC. Still the error persists inconsistently.
if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
Set api = ##class(writetofile.WriteFile)
Hi Robert,
Thanks for your patience.
Below is the %OnNew method I tried with try-catch block. And I added a global reference to store the exception but global is not been set. so I think it didnt enter catch block.
Method %OnNew(ByRef p0 As %ObjectHandle) As %Status
{
set Stat=""
If '$D(p0) If ($IO["TCP") { Quit $$$OK } Else { Set x=$$$ERROR($$$RemoteGatewayError,"Gateway instance must be supplied") Zt "JGTW" }
Try
{
set Stat= ..%Constructor(p0,"writetofile.WriteFile",0)
}
catch exc
{
set ^xKPS("exc")=exc
set Stat= exc.AsStatus()
}
quit Stat
}
Thanks Eduard. %objlasterror helped me to get the error. Below is the error I got.
"0 "_$lb($lb(5023,"Error caught by Gateway.executeInstanceMethod"_$c(13,10)_" at InterSystems.Data.CacheClient.Gateway.Gateway.executeInstanceMethod(MethodInfo method, String methodName, String oref)"_$c(13,10)_" at InterSystems.Data.CacheClient.Gateway.Gateway.executeMethod()"_$c(13,10)_"No more licenses are available."_$c(13,10)_" at Xerox.Statit.StatitClass.Init()"_$c(13,10),,,,,,,,$lb(,"TEST",$lb("e^%ProcessError+4^%Net.Remote.Proxy.1^1","d^%I+11^%Net.Remote.Proxy.1^1","d^zInit+1^Xerox.Statit.StatitClass.1^1","d^zInitEServer+29^DeepSee.Portlets.IndicatorPortlet.1^1","e^zOutputChart+47^DeepSee.Portlets.IndicatorPortlet.1^1","e^zInvokeInstanceMethod+133^%ZEN.Controller.1^1","x^zInvokeInstanceMethod+133^%ZEN.Controller.1^1","e^zInvokeInstanceMethod+2^%ZEN.Component.abstractPage.1^1","e^zCSPEvent+10^%CSP.Broker.1^1","x^zCSPEvent+10^%CSP.Broker.1^1","e^zOnPage+3^%CSP.Broker.1^1","e^zPage+9^%CSP.Broker.1^2","e^CSPDispatch+449^%SYS.cspServer^2","d^CSPDispatch+284^%SYS.cspServer^1","d^zProcessRequest+1^%CSP.Session.1^1","d^Request+620^%SYS.cspServer2^1","d^Request+25^%SYS.cspServer2^1","d^zProcessRequest+1^%CSP.Request.1^1","d^css+41^%SYS.cspServer2^1","d^SuperServer+48^%SYS.SERVER^3","d^^^0"))))/* ERROR #5023: Remote Gateway Error: Error caught by Gateway.executeInstanceMethod- at InterSystems.Data.CacheClient.Gateway.Gateway.executeInstanceMethod(MethodInfo method, String methodName, String oref)- at InterSystems.Data.CacheClient.Gateway.Gateway.executeMethod()- No more licenses are available.- at Xerox.Statit.StatitClass.Init()- */
I was unable to identify the class System.Object you inherit for your proxy object.
But the methods you call are all available in %Net.Remote.Proxy
so verify the definition of System.Object
or change your class to
I think you fail in %OnNew() in ..%Constructor(..)
I might be worth for testing to replace
by
set obj=..%Constructor(p0,"
}
Catch erroor {..... set obj=""}
Quit obj
method %ProcessError should output the real error but what you see is the result of ZT "JGTW"
fun As %String,
msgid As %Integer) [ Final ]
{
Use ..Gateway.GatewayDevice
If fun="Y9" Do ..%ReadObjects(..Gateway) Quit
Set error=$zobjexport(12)
Set x=$$$ERROR($$$RemoteGatewayError,error)
Use ..Gateway.CurrentDevice
Zt "JGTW"
}
Your error lands in the highlighted line. But as the method is FINAL you can't overload it.
Your original class System.Object might be a less restricted copy.
In addition, I see ZTRAP command this may explain why Try / Catch didn't react as expected.
I removed ZT from the end of the line still the catch didn't reached and getting the same error.
%ProcessError+6^%Net.Remote.Proxy.1
I think so, ![]()
Thanks Robert and Eduard for your kind help.
Oh dear, NO MORE LICENSES.
Then inconsistency is clear!
Do you catch exceptions?
If not try this:
Try {
Kill %objlasterror
Set conn = ##class(%Net.Remote.Gateway).%New() // No error here
Set tSC = conn.%Connect("127.0.0.1", "55000", "NETTEST") // No error here
Write:$$$ISERR(tSC) $System.Status.GetErrorText(tSC),!
ZWrite %objlasterror
Set api = ##class(writetofile.WriteFile).%New(conn) //Here comes the error
ZWrite %objlasterror
Set strFile = "d:\temp\example.txt"
Set strInput = "Hello world"
Set ret = api.FilePut(strFile,strInput)
Set tSC = conn.%Disconnect()
Write:$$$ISERR(tSC) $System.Status.GetErrorText(tSC)
} Catch ex {
ZWrite %objlasterror
Do ex.Log()
Write ex.DisplayString(),!
}%objlasterror can contain more error information. Also check application error log.
Are you on 32 or 64 bits? Check Cache with:
Write $system.Version.Is64Bits()
.Net library should be compiled with the same architecture.