Null pointer inside stub? - axis

I am getting this really strange message from my stub (and it doesn't happen often but sometimes, few times a day):
SEVERE: Servlet.service() for servlet [default] in context with path [/EWC] threw exception
java.lang.NullPointerException
at com.company.rewsapi.REWSStub.isUserValid(REWSStub.java:28915)
at com.company.rews.webclient.beans.ClientBeanBase.isUserConnectedToREWS(ClientBeanBase.java:152)
The line 28915 inside the stub is:
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
I never get null pointers from within stub. How can this happen?
What do I need to do to trace the error or to reproduce it so I can debug?

separate this _messageContext.getTransportOut().getSender().cleanup(_messageContext); line into
TransportOut to = _messageContext.getTransportOut();
Sender sender = to.getSender();
sender.cleanup(_messageContext);
Compile and run. During execution if any NullPointerException occures, you will clearly get what is null then identify why that is null.

looks like the apache fix was
} finally {
if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}
}
fixed in 1.6.0 or 1.5.5 streams via
https://issues.apache.org/jira/browse/AXIS2-3788

Related

JBoss 7.1.0: executor.submit() how to debug (no exception but task not started)

I have an issue with JBoss EAP 7.1.0 GA. On one server (my DEV) this works like a charm while on the other (TEST environment) the Callable executed using executor.submit() does not seem to be started (I do not see that "This is call" message in log), but no exception or any other clue is given.
The question is - where should I look like / how should I debug this issue?
The calling code:
#Resource(name = "DefaultManagedExecutorService")
ManagedExecutorService executor;
try {
DownloadPlayers dp = new DownloadPlayers();
Future<Queue<PlayerForDownload>> f = executor.submit(dp);
Queue<PlayerForDownload> q = f.get();
L.info(q.size());
} catch (Exception e) {
L.error("EXCEPTION" + e.getMessage());
}
The class it calls:
public class DownloadPlayers implements Callable<Queue<PlayerForDownload>> {
// the constructor gets called, I'm sure as it writes to log
// the call is as simple as this
#Override
public Queue<PlayerForDownload> call() {
L.info("This is call()");
try {
return this.getPlayersForDownload();
} catch (WorkerException e) {
L.error(e);
return null;
}
}
}
As stated above, the code itself seems to be OK as it works in one server but does not work on the other. Both are
7.1.0GA standalone.
Any advice how to debug the ManagedExecutorService?
Thanks.
In this particular case the problem was that on the TEST environment it was only allowed to run two threads which we already running (by some completely different part of application I didn't realize). So the problem is solved now by setting the "Core threads" parameter in ManagerExecutorService to higher value, the tasks are running.
However the tricky part was that there was no obvious visible difference between the JBoss servers (I compared the standalone.xml configs...) just because the ManagerExecutorService in JBoss has some default (blank) values that actually depend on the system config (v-CPU cores in my case). So despite the config being the same, the "Core threads" seem to default to 2 on TEST and some higher (unknown to me) value on my DEV.
So never depend on default settings in ManagerExecutorService if comparing two environments.
I have also rewritten the logic, instead of using blocking Future.get() or checking for Future.isDone() in a loop a do Future.get() with timeout and in the exception handler I decide whether to keep waiting or fail.

Unity WebGL - Locating code that triggers Reflection.emit

I've run into the dreaded Reflection.emit issue in my webplayer build and am unable to locate what is triggering it. I'm currently commenting out code method by method and rebuilding to locate the cause and have narrowed it down to the below.
I'm not using JSON so the various JSON libraries aren't the cause, nor any of the other result suggestions returned by google.
How can i more easily go about locating the cause of this error. I have full stack trace on and well as full debugging, but all i get is the following console output.
NotSupportedException: C:\Program Files\Unity 2018.2.0b2\Editor\Data\il2cpp\libil2cpp\icalls\mscorlib\System.Reflection.Emit\AssemblyBuilder.cpp(20) : Unsupported internal call for IL2CPP:AssemblyBuilder::basic_init - System.Reflection.Emit is not supported.
Rethrow as TypeInitializationException: The type initializer for 'System.Reflection.Emit.DynamicMethod.AnonHostModuleHolder' threw an exception.
//NOTE: appM.procM is a C# .Net 4.x dynamic variable EG:
//public dynamic procM = GetProcClass(strProcName)
public void ShowProcList() {
/* Rest of method commented out*/
if(appM.procM == null){
procList.Initialize(appM.procM.lstNames, this);
}
/* Rest of method commented out*/
}
public void Initialize(List<string> lstNames, UIM um, string currProc=null) {
uiM = um;
//cleanup of the list before populating
foreach(Transform fld in Panel.transform) {
Destroy(fld.gameObject);
}
/* Rest of method commented out*/
}
Update: I narrowed down the problem line of code, but haven't closed the question as there's got to be an easier way than commenting out line by line and rebuilding.
For future searchers, the issue is the if(appM.procM == null) check. As procM is a dynamic variable reflection is used which kills AOT in webGL builds. No compiler warnings were generated to save myself from myself.
Nevermind, i am an idiot, The option Enable Exceptions under Player Settings was set to Full Without Stacktrace and not Full with Stacktrace.
The value Full With Stacktrace contains the pertinent data. Easily locatable in the browsers console. Warning that full debugging does increase build times and slow down the application.

Getting the stack trace of the error origin in swift

Consider this code:
func doSomething() throws {
try callThrowingFunction1()
try callThrowingFunction2()
}
func userAction() {
do {
try doSomething()
} catch {
// display and log error
}
}
Say those inner functions can throw the same kind of errors and I would like to know if an error occurred in callThrowingFunction1() or in callThrowingFunction2().
As long as I'm in the debugger I can set a breakpoint for Swift errors on swift_willThrow, but if I would like to log the call stack on a user device, is there a way to do that?
Swift errors have no such thing as stack-trace yet (if will ever), and even Xcode can show stack-trace only if the error is un-handled by our code (and gets caught by Xcode directly instead).
Alternativly, your custom Error's constructor can store the stack-trace for later use, but in most cases errors are not custom, where you can't alter error's constructor (like errors of 3rd-party library).
But we can at least print stack-trace of where error(s) get catched, like:
do {
try ... // something that throws goes here
} catch let error as NSError {
print("Error: \(error)")
println(NSThread.callStackSymbols())
}
Exception breakpoint
If you just want to debug, without need to upload stack-trace to server, then Xcode's "Exception breakpoint" feature can help, like:
First place a normal-breakpoint near the failing logic.
Wait until Xcode pauses App on that line, enable Xcode's feature:
Finally, resume App, and wait untill exception is thrown.
Images are old, nowadays you see "Add Swift Error Breakpoint" or something like that as well (beside "Add Exception Breakpoint" option).

GWT Error Popup

The error popup with the following error message comes on the screen repeatedly when application is in idle state (no user activity is performed).
Error occurred on client: (TypeError): Unable to get property 'iterator_0' of undefined or null reference.
number: -2146823281
at handleEvent_206....EF34544...cache.html
at dispatchEvent_0..EF34544...cache.html
at sucess_184 ..
..
Can anyone give some pointers to navigate to the problamatic area in the code?
The fact that you're getting it repeatedly is probably due to the fact that you're performing an action on a timer (i.e. perform repeatedly an action).
From the small snippet you've shown, I don't think there's anything we can deduce. Do you have a larger stacktrace? It is still possible the error is in your own code (trying to invoke iterator() on a null object).

Debugging an Execution Exception Error Based on a Function Within Playframework

Today I did couple of updates on the front-end side of things, and then I did get the execution exception error, while running the app, that points to the written code within the target folder.
Error:
Execution exception
[IllegalStateException: java.lang.reflect.InvocationTargetException]
Pinter to the error on line 31 (/target/scala2.11/routes/main/controllers/ReverseRoutes.scala:31):
28 // #LINE:65
29 def versioned(file:Asset): Call = {
30 implicit val _rrc = new ReverseRouteContext(Map(("path", "/public")))
31 Call("GET", _prefix + { _defaultPrefix } + "vassets/" + implicitly[PathBindable[Asset]].unbind("file", file))
32 }
Where should I look for this error, as obviously I did not wrote the code within the target folder.
Note 1: Commented whatever I did after I did get the error, and I do still get the error.
Note 2: I did clean compile with no error, however when I try to run it through the browser I do get the error.
this error is strictly connected with template and using controllers call (your methods from controllers)
you have to localize on your template which controller method calls this error
for instance I had a problem with nullpointerexception and I found a problem. I had below controller:
#controllers.MyController.myMethod(object.getValue)
and it turns out that in db getValue had null and play reported it as a problem. he somehow detect that this value is null
Strange for me but maybe it will help