Velocity - NullPointerException - java

During my searching, I would like to have some help about my problem :
So this is my error, the trace :
VelocityView : Error processing a template for path '/comptes/affilies.html.vtl'
Invocation of method 'getRemunerationVendeur' in class model.User threw exception java.lang.NullPointerException at /comptes/affilies.html.vtl[line 28, column 20]
java.lang.NullPointerException
at model.User.getListRemunerationVendeur(User.java:238)
at model.User.getRemunerationVendeur(User.java:268)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:127)
at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:523)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:271)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:561)
at org.apache.velocity.runtime.directive.VelocimacroProxy.handleArgValues(VelocimacroProxy.java:325)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:189)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:300)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.directive.Foreach.renderBlock(Foreach.java:281)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:258)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
at org.apache.velocity.Template.merge(Template.java:356)
at org.apache.velocity.Template.merge(Template.java:260)
at org.apache.velocity.tools.view.VelocityView.performMerge(VelocityView.java:942)
at org.apache.velocity.tools.view.VelocityView.merge(VelocityView.java:902)
at org.apache.velocity.tools.view.VelocityViewServlet.mergeTemplate(VelocityViewServlet.java:318)
at org.apache.velocity.tools.view.VelocityViewServlet.doRequest(VelocityViewServlet.java:220)
at org.apache.velocity.tools.view.VelocityViewServlet.doGet(VelocityViewServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:120)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
at filter.AuthFilter.doRedirect(AuthFilter.java:54)
at velosurf.web.auth.AuthenticationFilter.doFilter(AuthenticationFilter.java:392)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
at filter.DateFilter.doFilter(DateFilter.java:309)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1345)
at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1301)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1285)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1193)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:992)
at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)
at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
Normally the class User.java works.
This is a piece of my class java (User.java) that corresponds to my error :
Instance service = (Instance)db.get("service_by_code");
vendeur.put("ope_code", operateur.get("ope_code"));
vendeur.put("srv_code", service.get("srv_code"));
My variable service corresponds at a line of a result at my database.
I think my row is NULL in the database (because a nullPointerException is mainly that ... an object set at NULL !) but I don't know to solve the problem in my database : to change value in the row of my database.
I try it but It changes nothing.
Please if you've got a piece of advice.
Ale.

It looks, like your object of class Instance is NULL, because of your work with DB.
Anyway, should be nice, if you give a stacktrace of your exception, so nobody will try to guess.

Related

Getting version mismatch error while updating into DCTM using java

I am trying to update into DCTM through java code, below is the code snippet
IDfDocument communication = (IDfDocument) getDfSession().getObject(DfId.valueOf(communicationId));
communication.setString(ATTR_STATUS, status);
communication.save();
but I am getting the below error
Caused by: DfException:: THREAD: be.ing.ca.xpression.DCTM001P-1; MSG: [DM_OBJ_MGR_E_VERSION_MISMATCH]error: "save of object
090283e589bf689d of type xx_document failed because of version
mismatch: old version was 4"; ERRORCODE: 100; NEXT: null
I thinki am getting this error because there is another process which is trying to modify the object ,and when more than one process try to modify anyobject DCTM throws this exception,
But after lot of searching i dident found any solution which can solve this error
If anyone knows the solution please reply..
Link that i refer
http://www.javablog.fr/?s=version+mismatch
Try calling a fetch() on the object before doing updates.
communication.fetch()
There are some optional parameters AFAIK, but it's been a while since I've been fiddling with DCTM.
Best of luck!

How to fix repast simphony error : saf.v3d.scene.VComposite.addChild(VComposite.java:46)

I have a new error in my repast simphony model. When my agent give birth and I contextualize its childs in the context, the next step gives me an error like java.lang.NullPointerException (See source code).
Can you help me to fix it?
java.lang.NullPointerException
at saf.v3d.scene.VComposite.addChild(VComposite.java:46)
at repast.simphony.visualizationOGL2D.SpatialWrapper.setChild(SpatialWrapper.java:80)
at repast.simphony.visualizationOGL2D.SpatialWrapper.<init>(SpatialWrapper.java:34)
at repast.simphony.visualizationOGL2D.StyledDisplayLayerOGL2D.createSpatial(StyledDisplayLayerOGL2D.java:146)
at repast.simphony.visualizationOGL2D.StyledDisplayLayerOGL2D.processAdded(StyledDisplayLayerOGL2D.java:228)
at repast.simphony.visualizationOGL2D.StyledDisplayLayerOGL2D.update(StyledDisplayLayerOGL2D.java:250)
at repast.simphony.visualizationOGL2D.DisplayOGL2D.update(DisplayOGL2D.java:404)
at repast.simphony.visualization.engine.DisplayComponentControllerAction$DisplayUpdater.execute(DisplayComponentControllerAction.java:44)
at repast.simphony.engine.schedule.DefaultAction.execute(DefaultAction.java:38)
at repast.simphony.engine.schedule.ScheduleGroup.executeList(ScheduleGroup.java:205)
at repast.simphony.engine.schedule.ScheduleGroup.execute(ScheduleGroup.java:238)
at repast.simphony.engine.schedule.Schedule.execute(Schedule.java:352)
at repast.simphony.ui.GUIScheduleRunner$ScheduleLoopRunnable.run(GUIScheduleRunner.java:52)
at java.lang.Thread.run(Unknown Source)
This error can occur if the getVSpatial method in the style for child agent returns null.
JavaDoc for getVSpatial
When the child is created the second argument to getVSpatial is null, so you need to be sure to return a VSpatial implementation.

Drools gets NullPointerException on rule outside of Agenda Filter

I am working with Drools Engine and am getting an unexpected exception.
I keep receiving the exception:
Caused by: java.lang.NullPointerException
at com.validator.controllers.Rule_When_health_notification_received_determine_system_status$u46$1878980533.eval0(Rule_When_health_notification_received_determine_system_status$u46$1878980533.java:8)
at com.validator.controllers.Rule_When_health_notification_received_determine_system_status$u46$1878980533Eval0InvokerGenerated.evaluate(Unknown Source)
at com.validator.controllers.Rule_When_health_notification_received_determine_system_status$u46$1878980533Eval0Invoker.evaluate(Unknown Source)
at org.drools.core.rule.EvalCondition.isAllowed(EvalCondition.java:118) [drools-core-6.3.0.Final.jar:6.3.0.Final]
The problem is that this rule should not be in my AgendaFilter. The rules that should be running are:
FactHandle requestFact = kSession.insert(request);
kSession.fireAllRules(new GenericAgendaFilter(ObjectTypes.GROUP, Operations.ITEM_UPDATE));
Request Contains some basic information for the rule to use.
And the Tags my rule has are:
#Type("ITEM")
#Operation("CHANGE_HEALTH")
Any Idea what I am doing wrong?
The agenda-group is only used to group the rules that you want to be executed together. All of the rules in your Knowledge Base are still going to be evaluated when needed, no matter what agenda-group they belong to.
Hope it helps,

Dataimport in Solr 5.1.0 is not indexing few fields which are to be fetched through makepair function

Schema.xml has all fields mentioned to be indexed. it was working all this time and i am facing this issue all of a sudden. What is wrong. Please advise.
Error :
Line 2458: WARN - 2016-10-10 19:53:56.757; [ iccCore]
org.apache.solr.handler.dataimport.EntityProcessorWrapper; transformer
threw error Line 2459:
org.apache.solr.handler.dataimport.DataImportHandlerException: Error
invoking script for entity icMetadataProcessed Processing Document #
2594 Line 2472: Caused by: javax.script.ScriptException: TypeError:
null has no such function "split" in <eval> at line number 8 Line
2478: Caused by: <eval>:8 TypeError: null has no such function "split"
Looks like a Javascript error in your custom script. Possibly about the script expecting a string (to split) and getting null. I would fix the javascript to ignore that field or add debug to see which record is causing that problem, must likely by missing a value.

Java NullPointerException when using Evaluation.areaUnderROC from Weka

So I'm trying to evaluate the performance of a classifier on a test instance and when I try to get the area under the ROC, the following error is thrown:
Java.lang.NullPointerException
at weka.classifiers.evaluation.ThresholdCurve.getROCArea(ThresholdCurve.java:268)
at weka.classifiers.Evaluation.areaUnderROC(Evaluation.java:382)
at Classifier_Search.runAda(Classifier_Search.java:74)
at Classifier_Search.acrossTest(Classifier_Search.java:142)
at Classifier_Search.main(Classifier_Search.java:511)
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 edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:271)
The code that is throwing the error is this:
Evaluation eval = new Evaluation(train);
String[] options = {"-P 100", "-S 1", "-I " + it, "-W weka.classifiers.trees.DecisionStump"};
AdaBoostM1 cls = new AdaBoostM1();
cls.setOptions(options);
cls.buildClassifier(train);
eval.evaluateModel(cls, test);
int index = test.classIndex();
return eval.areaUnderROC(index);
When I look up the javadoc for Evaluation (javadoc for Evaluation), It says that areaUnderROC needs to be set by an evaluateClassifier method. No such method exists. Other similar methods (such as falsePositive) work just fine. Has anyone encountered this problem? I can't find anything on OldNabble (Weka's help site).
Thanks!
EDIT: to clarify, test and train are both Instances objects that were created with the following code:
private static Instances readFile(File filename) throws IOException
{
CSVLoader loader = new CSVLoader();
loader.setSource(filename);
Instances data = loader.getDataSet();
data.setClassIndex(data.numAttributes() - 1);
return data;
}
They are read from .csv files. Typically if there is something wrong with test or train, the error is thrown here.
Once again, I have the answer to my own question. If someone disagrees with this answer, please let me know. The weka documentation for areaUnderROC, which already has one typo (it references a method, evaluateClassifier, which does not exist), has led me in the wrong direction. I think there is another error in the form of a misleading explanation. areaUnderROC works (without throwing the exception) for two values: 0 and 1. So, rather than taking the class index (the index of the attribute I am using as the class in the Instances object), what it actually wants is which class (of the two classes) to consider as positive. Given the variable names in the documentation, I think it's reasonable to not understand this at first glance. I also think that since its explanation is in parallel with that of methods that do take the class index (rather than 0 or 1), it is also misleading.

Categories

Resources