I made a plugin and throughout development I have had some troubles with scoreboard. This time I really hit a wall whereas I don't know how I'm going to solve this on my own. I need some help.
I can steer you in the right direction though. After looking at the Error message and changing my code a little I figured out that the problem lies in the way that I reset score (in method SetScoreBoard() Line 726).
My code: https://pastebin.com/M5kFr2Lr (Read the pastebin)
public void SetScoreBoard(Player p) {
scoreboard = boardMap.get(p.getUniqueId());
scoreboard.resetScores(score15.get(p.getUniqueId()));
scoreboard.resetScores(score14.get(p.getUniqueId()));
scoreboard.resetScores(score13.get(p.getUniqueId()));
scoreboard.resetScores(score12.get(p.getUniqueId()));
scoreboard.resetScores(score11.get(p.getUniqueId()));
scoreboard.resetScores(score10.get(p.getUniqueId()));
scoreboard.resetScores(score9.get(p.getUniqueId()));
scoreboard.resetScores(score8.get(p.getUniqueId()));
scoreboard.resetScores(score7.get(p.getUniqueId()));
scoreboard.resetScores(score6.get(p.getUniqueId()));
scoreboard.resetScores(score5.get(p.getUniqueId()));
scoreboard.resetScores(score4.get(p.getUniqueId()));
scoreboard.resetScores(score3.get(p.getUniqueId()));
scoreboard.resetScores(score2.get(p.getUniqueId()));
scoreboard.resetScores(score1.get(p.getUniqueId()));
boardMap.put(p.getUniqueId(), scoreboard);
updateScoreBoard(p);
}
The error:
Caused by: java.lang.NullPointerException
at pillars.EssemCSH.main.Main.SetScoreBoard(Main.java:729) ~[?:?]
at pillars.EssemCSH.main.Main.onPlayerLeave(Main.java:1046) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 12 more
Related
A couple days ago, I got a support ticket for this NullPointerException:
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.redacted.SalesResponsePagination com.redacted.StatisticsService.findSalesData(com.redacted.ConfStats) throws com.redacted.AsyncException' threw an unexpected exception: java.lang.NullPointerException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at ... (typical GWT + Tomcat stacktrace)
Caused by: java.lang.NullPointerException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.util.concurrent.ForkJoinTask.getThrowableException(Unknown Source)
at java.util.concurrent.ForkJoinTask.reportException(Unknown Source)
at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at com.redacted.StatisticsControllerImpl.replacePrices(StatisticsControllerImpl.java:310)
at com.redacted.StatisticsControllerImpl.findSalesData(StatisticsControllerImpl.java:288)
at com.redacted.StatisticsServiceImpl.findSalesData(StatisticsServiceImpl.java:83)
at sun.reflect.GeneratedMethodAccessor752.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
... 33 more
Caused by: java.lang.NullPointerException
at com.redacted.StatisticsControllerImpl.lambda$replacePrices$27(StatisticsControllerImpl.java:317)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at ... (typical stream.forEach stacktrace)
Now, this was an easy one because the exact line number for the NPE was in plain sight; all I had to do was go to StatisticsControllerImpl.java:317:
salesResponsePagination.getSalesResponses().parallelStream()
.peek(sr -> /*...*/)
.filter(sr -> /*...*/)
/*310*/ .forEach(sr -> {
final List<CartElement> sentCEs = DaoService.getCartElementDAO().getSentCEs(/*...*/);
if (sentCEs != null && !sentCEs.isEmpty() && sentCEs.get(0) != null) {
final CartElement ce = sentCEs.get(0);
// some more non-NPE lines...
/*317*/ if (sr.getCurrency().equals(ce.getPurchaseCurrency()) && sr.getPrice().equals(ce.getPurchasePrice().intValue()) && !ce.getCurrency().equals(ce.getPurchaseCurrency())) {
// Some currency exchanging
}
// Etcetera (about 12 lines more)
});
And replace the .equals() calls with Object.equals() to avoid the NPE (investigating the reasons why some sales were registered with a NULL price or currency came later). Test, commit, push, send ticket to QA.
However, the next day QA returned the ticket saying that the NPE persisted, and they included a new, almost similar stack trace:
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.redacted.SalesResponsePagination com.redacted.StatisticsService.findSalesData(com.redacted.ConfStats) throws com.redacted.AsyncException' threw an unexpected exception: java.lang.NullPointerException
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at ... (typical GWT + Tomcat stacktrace)
Caused by: java.lang.NullPointerException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.util.concurrent.ForkJoinTask.getThrowableException(Unknown Source)
at java.util.concurrent.ForkJoinTask.reportException(Unknown Source)
at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.forEach(Unknown Source)
at com.redacted.StatisticsControllerImpl.replacePrices(StatisticsControllerImpl.java:310)
at com.redacted.StatisticsControllerImpl.findSalesData(StatisticsControllerImpl.java:288)
at com.redacted.StatisticsServiceImpl.findSalesData(StatisticsServiceImpl.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
... 33 more
Caused by: java.lang.NullPointerException
This stack trace was exactly the same as the previous one, except for two things:
This call was using NativeMethodAccessorImpl instead of GeneratedMethodAccessor752. Compare:
at com.redacted.StatisticsServiceImpl.findSalesData(StatisticsServiceImpl.java:83)
at sun.reflect.GeneratedMethodAccessor752.invoke(Unknown Source)
vs
at com.redacted.StatisticsServiceImpl.findSalesData(StatisticsServiceImpl.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
This one was missing the stack trace for the lambda. The line where the NPE happened was missing.
This threw me off initially. Why was the last part of the stack trace missing? I asked QA to re-test and re-attach the stack trace a couple times, until I got a complete one; however, the complete one I got in the end was based on GeneratedMethodAccesor once again.
Now, if I understand correctly, sun.reflect.NativeMethodAccessorImpl is used for the first invocations of a method, until JIT has enough info to generate an optimized accesor for that method in the form of sun.reflect.GeneratedMethodAccessorNNN.
What I don't understand is: if Native is using my code and Generated is using JIT's generated code, shouldn't Native show more info about my code, not less?
So my question is:
Why do lambda runtime exceptions thrown inside sun.reflect.NativeMethodAccessorImpl seem to be missing the lambda's stack trace?
Can this be a bug in JDK's source code? Especially when the very same exception thrown inside sun.reflect.GeneratedMethodAccessor includes the lambda stack trace without problem.
The following code manages to get a stack trace similar to the first one. I can force the use of NativeMethodAccessor or GeneratedMethodAccesor by running it with a sufficiently low or high first parameter, respectively (i.e. java test.Main 1 or java test.Main 30).
However, the lambda part of it is always present, whether using Native or Generated.
package test;
import java.lang.reflect.Method;
import java.util.stream.IntStream;
class MyOtherClass {
public void methodWithLambda(boolean fail) {
IntStream.range(0, 1000).parallel().forEach(k -> {
if (fail && k % 500 == 0)
throw new NullPointerException();
});
}
public String methodProxy(boolean fail) {
methodWithLambda(fail);
return "OK";
}
}
class MyClass {
public String methodReflected(Boolean fail) {
return new MyOtherClass().methodProxy(fail);
}
}
class Main {
public static void main(String[] args) throws Exception {
Class<MyClass> clazz = MyClass.class;
Object instance = clazz.newInstance();
Method method = clazz.getMethod("methodReflected", Boolean.class);
int reps = args.length >= 1 ? Integer.valueOf(args[0]) : 20;
for (; reps --> 0;) {
// Several non-failing calls to force creation of GeneratedMethodAccesor
System.out.println((String) method.invoke(instance, false));
}
// Failing call
System.out.println((String) method.invoke(instance, true));
}
}
Stack trace for the above code when using NativeMethodAccesor:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at test.Main.main(Main.java:36)
Caused by: java.lang.NullPointerException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.util.concurrent.ForkJoinTask.getThrowableException(Unknown Source)
at java.util.concurrent.ForkJoinTask.reportException(Unknown Source)
at java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source)
at java.util.stream.ForEachOps$ForEachOp$OfInt.evaluateParallel(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.IntPipeline.forEach(Unknown Source)
at java.util.stream.IntPipeline$Head.forEach(Unknown Source)
at test.MyOtherClass.methodWithLambda(Main.java:8)
at test.MyOtherClass.methodProxy(Main.java:14)
at test.MyClass.methodReflected(Main.java:21)
... 5 more
Caused by: java.lang.NullPointerException
at test.MyOtherClass.lambda$methodWithLambda$0(Main.java:10)
at java.util.stream.ForEachOps$ForEachOp$OfInt.accept(Unknown Source)
at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Unknown Source)
at java.util.Spliterator$OfInt.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
at java.util.concurrent.CountedCompleter.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.execLocalTasks(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
EDIT: Just to be clear: I am not looking for ways to fix this NPE, nor ways to force the lambda's stack trace to print. What I want to know is the reason why the above happens: different implementations? A bug? Something to do with forEach()?
This might be an issue of JDK-6678999, “Stacktrace missing after null string comparisons”:
After comparing a string to null and catching the exception and repeating the operation, JVM starts throwing "stackless" NullPointerException (it occurs after 9000 loops but this is variable)
The evaluation of the issue is
When the server compiler compiles a method, the stack trace in an exception thrown
by that method may be omitted for performance purposes.
[…] If the user always wants stack traces, use the -XX:-OmitStackTraceInFastThrow option to the VM.
So, the option -XX:-OmitStackTraceInFastThrow may solve the issue.
Note that the bug report was against Java 6, but since it has been closed as “Won't Fix”, it may still be relevant, though you would have to replace “server compiler” with “c2 compiler” in the explanation now.
The use of NativeMethodAccessorImpl or GeneratedMethodAccessor… is not relevant to this issue, except that both have a common cause; a higher number of executions may trigger the optimizations.
Please, before pointing that this is duplicate of What is a NullPointerException, and how do I fix it?, read the post to the end, as this is prepared as adviced on the mentioned site!
I moved my app from Wildfly 8 to Wildfly 10 and to my suprise I've got NullPointerException in place of where in my opinion it shouldn't be.
Piece of code of AdmUserCrud.java - update() method:
119: inst.setRoles(roles);
120: if (inst.getAllowIp()!=null && inst.getAllowIp().equals(""))
121: inst.setAllowIp(null);
Error:
Caused by: java.lang.NullPointerException
at com.i4u.qla.action.setting.AdmUserCrud.update(AdmUserCrud.java:120)
at com.i4u.qla.action.setting.AdmUserCrud$Proxy$_$$_WeldSubclass.update$$super(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:49)
at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:77)
at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:117)
at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:53)
at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:76)
at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:47)
at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:74)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72)
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56)
at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79)
at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68)
at com.i4u.qla.action.setting.AdmUserCrud$Proxy$_$$_WeldSubclass.update(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.el.ELUtil.invokeMethod(ELUtil.java:300)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:415)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
... 59 more
Line 119 (and not visible lines above) assures that inst object is not null. So why line 120 raises the NullPointer error?
I'm really confused.
It might be the case that the inst.getAllowIp() returns different results on subsequent calls. So when it does first part of the if:
(inst.getAllowIp()!=null && ...
it might result some value, and a while later...
.. && inst.getAllowIp().equals("") )
might already be a null.
One way to prevent that (although it might not be exactly what you need) is to get the value only once, e.g. something along the lines of
inst.setRoles(roles);
String currentIp = inst.getAllowIp();
if (currentIp!=null && currentIp.equals(""))
...
In general I don't think it has any direct connection to Wildfly version changing.
I am getting a NullPointerException as shown below.
However, the debugger is not able to bring it up when enabled in this method, the code is getting invoked with reflections. Can you please provide me ideas\techniques to be able to debug this code?
[10/18/16 18:20:47:933 EST] 00000051 DWLExceptionU E java.lang.NullPointerException
at com.dwl.base.notification.NotificationManager$NotificationChannel.notify(NotificationManager.java:662)
at com.dwl.base.notification.NotificationManager$NotificationType.notify(NotificationManager.java:402)
at com.dwl.base.notification.NotificationManager.notify(NotificationManager.java:1454)
at com.dwl.base.notification.bean.impl.NotificationBean.notify(NotificationBean.java:142)
at com.dwl.base.notification.EJSLocalCSLNotification_e2801c59.notify(EJSLocalCSLNotification_e2801c59.java)
at com.dwl.base.notification.EJSProxy$$NotificationLocal.notify(Unknown Source)
at au.com.xxxxx.mdm.notification.NotificationHelper.sendNotification(NotificationHelper.java:75)
at au.com.xxxxxx.mdm.behaviour.SingleCustomerViewId.triggerNotification(SingleCustomerViewId.java:159)
at au.com.xxxxxxx.mdm.behaviour.SingleCustomerViewId.execute(SingleCustomerViewId.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.dwl.base.extensionFramework.JavaExtensionSet.invoke(JavaExtensionSet.java:159)
at com.dwl.base.extensionFramework.ExtensionHandler.executeExtension(ExtensionHandler.java:251)
at com.dwl.base.DWLCommonComponent.handleExtensions(DWLCommonComponent.java:1380)
at com.dwl.base.DWLCommonComponent.postExecute(DWLCommonComponent.java:509)
at com.dwl.tcrm.common.TCRMCommonComponent.postExecute(TCRMCommonComponent.java:263)
at com.dwl.tcrm.coreParty.component.TCRMPersonComponent.addPerson(TCRMPersonComponent.java:1641)
at com.dwl.tcrm.coreParty.component.TCRMPartyComponent.addPerson(TCRMPartyComponent.java:3079)
at com.dwl.tcrm.coreParty.component.TCRMPartyComponent.addPartySimple(TCRMPartyComponent.java:2813)
at com.dwl.tcrm.coreParty.component.TCRMPartyComponent.addParty(TCRMPartyComponent.java:2471)
at com.dwl.tcrm.coreParty.controller.TCRMCorePartyTxnBean.addPerson(TCRMCorePartyTxnBean.java:1764)
at Proxy5aa32899_c04f_46c5_9706_69af241cd3c4.addPerson(Unknown Source)
at Proxy5aa32899_c04f_46c5_9706_69af241cd3c4.addPerson(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.dwl.base.requestHandler.DWLTxnBP.processPersistentObject(DWLTxnBP.java:262)
at com.dwl.base.requestHandler.DWLTxnBP.execute(DWLTxnBP.java:115)
at com.dwl.base.requestHandler.DWLTxnProcessor.processTx(DWLTxnProcessor.java:98)
at com.dwl.unifi.tx.manager.CTxRxFacade.processTxNormal(CTxRxFacade.java:681)
at com.dwl.unifi.tx.manager.CTxRxFacade.processTx(CTxRxFacade.java:544)
at com.dwl.base.requestHandler.DWLRequestHandler.processTransaction(DWLRequestHandler.java:1187)
at com.dwl.base.requestHandler.DWLRequestHandler.processTx(DWLRequestHandler.java:591)
at com.dwl.base.requestHandler.DWLServiceControllerBase.processRequest(DWLServiceControllerBase.java:253)
at com.dwl.base.requestHandler.beans.EJSRemoteCSLDWLServiceController_2c54996d.processRequest(EJSRemoteCSLDWLServiceController_2c54996d.java)
at com.dwl.base.requestHandler.beans._EJSRemoteCSLDWLServiceController_2c54996d_Tie.processRequest(_EJSRemoteCSLDWLServiceController_2c54996d_Tie.java:1)
at com.dwl.base.requestHandler.beans._EJSRemoteCSLDWLServiceController_2c54996d_Tie._invoke(_EJSRemoteCSLDWLServiceController_2c54996d_Tie.java)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:523)
at com.ibm.rmi.iiop.ORB.process(ORB.java:523)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1575)
at com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Can you please provide me ideas\techniques to be able to debug this code?
Since you said the method is called from reflection, you can see that in the stacktrace.
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
So, keep reading up from that.
I'm guessing you intentionally edited the xxxx values, so these are your libraries that are being dynamically called.
at au.com.xxxxx.mdm.notification.NotificationHelper.sendNotification(NotificationHelper.java:75)
at au.com.xxxxxx.mdm.behaviour.SingleCustomerViewId.triggerNotification(SingleCustomerViewId.java:159)
at au.com.xxxxxxx.mdm.behaviour.SingleCustomerViewId.execute(SingleCustomerViewId.java:129)
Then, the rest of the call stack just goes through some other code library within the same package.
at com.dwl.base.notification.NotificationManager$NotificationChannel.notify(NotificationManager.java:662)
at com.dwl.base.notification.NotificationManager$NotificationType.notify(NotificationManager.java:402)
at com.dwl.base.notification.NotificationManager.notify(NotificationManager.java:1454)
at com.dwl.base.notification.bean.impl.NotificationBean.notify(NotificationBean.java:142)
at com.dwl.base.notification.EJSLocalCSLNotification_e2801c59.notify(EJSLocalCSLNotification_e2801c59.java)
at com.dwl.base.notification.EJSProxy$$NotificationLocal.notify(Unknown Source)
So, the problem definitely starts at NotificationHelper.sendNotification(NotificationHelper.java:75), but it cannot easily be determined the path that the code took in order to reach its eventual destination or what exactly caused the exception without inspecting the source of (NotificationManager.java:662)
I'm using in a Java project RMI + Hibernate and I'm experiencing problems related to NotUniqueException with the error "Different objects with the same identifier".
I've got several doubts:
I'm pretty surre that I don't copy nor create new objects with the same ide
ntifiers. Is it possible that RMI creates a new object from another one when I use it?
Which method is using Hibernate to know that two objects are the same? equals?
I know that Serializable is related to Hibernate but I don't know in what way?
How can I solve the "Differents objects error" using RMI at the same time?
Is it correct every time I use delete or save over an object use merge before?
The stack traces is:
org.orm.PersistentException: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [dcl.Administrador#10]
at org.orm.PersistentSession.saveOrUpdate(PersistentSession.java:648)
at org.orm.PersistentManager.saveObject(PersistentManager.java:274)
at dcl.AdministradorDAO.save(AdministradorDAO.java:240)
at dcl.BdAdministrador.guardarAdministrador(BdAdministrador.java:62)
at dcl.BdAdministrador.actualizarAdministrador(BdAdministrador.java:109)
at dcl.BdPrincipal.actualizarAdministrador(BdPrincipal.java:555)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thanks in advance.
If you're doing something like returning a hibernate object from an RMI method, then passing it back into another one, then you'll potentially need to reattach the object to the session. (see What is the proper way to re-attach detached objects in Hibernate?).
Perhaps give some more info on what you're attempting if this doesn't help.
I'm trying to replicate the java guestbook example on Quercus on AppEngine and I'm getting an error having to do with preparing the query:
$greetings = $datastore->prepare($query)->asIterable();
I'm not a java developer so I can't make sense of the error trace. How can I get the greeting items without triggering this error?
Here is the entire error page:
HTTP ERROR 500
Problem accessing /index.php. Reason:
INTERNAL_SERVER_ERROR
Caused by:
java.lang.NullPointerException at
com.google.appengine.api.datastore.dev.LocalDatastoreService.next(LocalDatastoreService.java:1089)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:498)
at
com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:452)
at
com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:430)
at java.util.concurrent.Executors$PrivilegedCallable$1.run(Unknown
Source) at java.security.AccessController.doPrivileged(Native Method)
at java.util.concurrent.Executors$PrivilegedCallable.call(Unknown
Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source) at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
If it's a null pointer exception then you are trying to access a method or property of a null object
First you need to check if $datastore is null, then if the return of the query is not null. Also you need to check if that error is on that particular line of code (maybe it fails somewhere else)
You can access the database at this link /_ah/admin. Maybe there is a corrupt entity in there