GATE java.lang.NullPointerException? - machine-learning

I am new in GATE and I am using it to conduct the machine learning. The configure file for Batching Learning PR is the following:
<?xml version="1.0"?>
-<ML-CONFIG>
<VERBOSITY level="1"/>
<SURROUND value="false"/>
<PARAMETER value="0.5" name="thresholdProbabilityClassification"/>
<multiClassification2Binary method="one-vs-others"/>
<EVALUATION method="kfold" ratio="0.66" runs="5"/>
<ENGINE options=" -p 50 -n 5 -optB 0.0 " implementationName="PAUM" nickname="PAUM"/>
-<DATASET>
<INSTANCE-TYPE>attitude</INSTANCE-TYPE>
-<NGRAM>
<NAME>ngram</NAME>
<NUMBER>1</NUMBER>
<CONSNUM>1</CONSNUM>
-<CONS-1>
<TYPE>Token</TYPE>
<FEATURE>root</FEATURE>
</CONS-1>
<!-- <CONS-2> <TYPE>Token</TYPE> <FEATURE>orth</FEATURE> </CONS-2> -->
</NGRAM>
-<ATTRIBUTE>
<NAME>Class</NAME>
<SEMTYPE>NOMINAL</SEMTYPE>
<TYPE>attitude</TYPE>
<FEATURE>feature</FEATURE>
<POSITION>0</POSITION>
<CLASS/>
</ATTRIBUTE>
</DATASET>
</ML-CONFIG>
The annotation I want the program to learn is called 'attitude', with feature called 'feature'. The value of the feature is just positive and negative.
However, every time I run the Batch Learning PR(Trainning mode), there will be an error like this:
java.lang.NullPointerException
at gate.learning.NLPFeaturesOfDoc.writeNLPFeaturesToFile(NLPFeaturesOfDoc.java:818)
at gate.learning.LightWeightLearningApi.annotations2NLPFeatures(LightWeightLearningApi.java:198)
at gate.learning.LearningAPIMain.execute(LearningAPIMain.java:594)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.creole.SerialController.runComponent(SerialController.java:225)
at gate.creole.SerialController.executeImpl(SerialController.java:157)
at gate.creole.SerialAnalyserController.executeImpl(SerialAnalyserController.java:223)
at gate.creole.SerialAnalyserController.execute(SerialAnalyserController.java:126)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.gui.SerialControllerEditor$RunAction$1.run(SerialControllerEditor.java:1728)
at java.lang.Thread.run(Unknown Source)
Since I can't debug during the midway within GATE, I don't understand what's wrong with the code.
Could anyone help?
Thanks!

I would suggest you to check file on which training process failed. It may happen that no features were produced by GATE (for example document content is empty and etc).

Related

How can use an ORACLS EBS xmlreport parameters from a package-body?

I have recently created a report using Oracle E-business suite, a XML publisher report. In that report I have added 4 parameters and I need to use those parameters from a package body which is a custom request
these are the parameters in my xml report data definition.
<parameters>
<parameter name="P_org_id" datatype="number"/>
<parameter name="P_Account_Number" dataType="number"/>
<parameter name="P_Start_week" dataType="date"/>
<parameter name="P_End_week" dataType="date"/>
</parameters>
Is it possible to access the org_id and p_start_week parameter from the xml report and use it in a package body? I am not sure if I have put the question properly, because I have very limited idea about this. If you need more information to answer this question, please let me know.
this is how the code my package looks like:
Select so_header_id from XXONT_M545_CUST_COVG_DATA
where revision_week = &p_current_week – to_char(nvl(<Date_provided_as_parameter>,sysdate),’YYYYMM’)
and cust_org = &p_org_id
and hold_yn = ‘Y’;
In my opinion, you should create PL/SQL concurrent program
http://www.askhareesh.com/2015/08/plsql-stored-procedure-registration-with-parameters.html
And return data in XML.

Jenkins pipeline job's config.xml resetting to cloned tasks default parameter values on build

I have 1 pipeline job in Jenkins that was used as a template to create 7 more jobs using the "Copy From" option. Each job has is "This project is parameterized" with the same parameters, BUT different "Default Values".
The Build Description is also different across those 7 new jobs, but this never changes. The problem is, when any of the 7 jobs are run, the "Default Values" change back to their original values from when they were created. So after all 7 run, they ALL have the same default values as the first job they were cloned from. I actually see the config.xml file change right after they are scheduled. I don't see any links in the XML that would indicate it would copy the default values either, what mechanism is changing this? How does it know what to change it to? Any help greatly appreciated.
<?xml version='1.1' encoding='UTF-8'?>
<flow-definition plugin="workflow-job#2.19">
<actions>
<org.jenkinsci.plugins.workflow.multibranch.JobPropertyTrackerAction plugin="workflow-multibranch#2.17">
<jobPropertyDescriptors>
<string>hudson.model.ParametersDefinitionProperty</string>
<string>com.sonyericsson.rebuild.RebuildSettings</string>
</jobPropertyDescriptors>
</org.jenkinsci.plugins.workflow.multibranch.JobPropertyTrackerAction>
</actions>
<description>RSYS2_Regression
Runs on RSYS2 machines (201.4 - 201.5 - 201.6)
</description>
<keepDependencies>false</keepDependencies>
<properties>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>31</daysToKeep>
<numToKeep>-1</numToKeep>
<artifactDaysToKeep>30</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</strategy>
</jenkins.model.BuildDiscarderProperty>
<org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty/>
<org.jenkinsci.plugins.workflow.job.properties.DurabilityHintJobProperty>
<hint>MAX_SURVIVABILITY</hint>
</org.jenkinsci.plugins.workflow.job.properties.DurabilityHintJobProperty>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers>
<hudson.triggers.TimerTrigger>
<spec>30 20 * * 1-5
30 5 * * 1-5
</spec>
</hudson.triggers.TimerTrigger>
</triggers>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild#1.28">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>Tag</name>
<description>BDD Cucumber Tag</description>
<defaultValue>all</defaultValue>
<trim>true</trim>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>Branch</name>
<description>Github Branch</description>
<defaultValue>master</defaultValue>
<trim>true</trim>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>LogLevel</name>
<description>Level of logging</description>
<defaultValue>Trace</defaultValue>
<trim>true</trim>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
In this example, Parameter definitions for "tag, branch and trace levels" all get reset. Build description and timer trigger stay as they were saved.

Launch node if not already running

When doing roslaunch <pkg> <file>.launch I want all nodes that are launched inside that file to only start if they're not running yet.
How do I do this?
If it's not possible, is it at least possible to do this for each node separately?
If someone has an idea it would be great if you added that code to my example .launch snippet below.
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<node pkg="rviz" type="rviz" name="rviz" />
</launch>
Unfortunately, this is not possible as discussed here.
roslaunch and rosrun will always run the node with the desired name which results in the fact, that the roscore will kill living nodes with the same name.
You can use the anon tag to run multiple instances with always varying names as explained here.
The only exception to this behavior is the roscore.xml and its nodes as explained here.
The only current workaround, from my point of view, is writing a script which checks via rosnode list if the desired node is already running and depending on the outcome, run your node or not.
Using <arg> tag in launch files that are connected through <include> tag, you can set up variables in top launch file and send to other included launch files. Then, using <if> and <unless>, you can start a node or leave it. You can find it's documentation in ROS_Wiki.
In multiple independent launch files, things are a little different since you don't have link between launch files. You can use environment variables to replicate the results .
you can check with the if tag and an eval statement:
if="$(eval not [s for s in eval('_' + '_import_' + '_(\'rosnode\')').get_node_names() if 'NODE_NAME' in s])"
i.e.:
<launch>
<node pkg="rviz" type="rviz" name="rviz"
if="$(eval not [s for s in eval('_' + '_import_' + '_(\'rosnode\')').get_node_names() if 'rviz' in s])"/>
</launch>

How to override 'org.apache.cxf.stax.maxChildElements' property value inside a TomEE container?

I've got a JAX-WS web service endpoint configured purely via annotations running in TomEE 7 environment. Basically, the method being called has to return a List<String> of all node names contained in a graph data structure. The response of such a request can contain more thank 50k elements.
With CXF 2.6.x this worked fine. However, when I call the WS-method under CXF 3.x (bundled in TomEE 7.x), the following exception is thrown on the server side:
org.apache.cxf.interceptor.Fault: Unmarshalling Error: Maximum Number of Child Elements limit (50000) Exceeded
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:906)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:712)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:179)
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1680)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1559)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:653)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
at com.sun.proxy.$Proxy51.getAllNodeNames(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.stream.XMLStreamException: Maximum Number of Child Elements limit (50000) Exceeded]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:485)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:417)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:394)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:855)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:102)
at org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(JAXBEncoderDecoder.java:894)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:892)
... 21 more
Caused by: javax.xml.stream.XMLStreamException: Maximum Number of Child Elements limit (50000) Exceeded
at com.ctc.wstx.sr.InputElementStack.push(InputElementStack.java:340)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2951)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2839)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1073)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:196)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:415)
... 27 more
Error: Maximum Number of Child Elements limit (50000) Exceeded
So far, I've read the official CXF documentation on this issue, checked a HowTo at the TomEE website and read many related, yet older posts in forums.
I tried to set the properties - as advised by the TomEE documentation - via openejb-jar.xml in the webservice's WEB-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar>
<ejb-deployment ejb-name="MyWebService">
<properties>
org.apache.cxf.stax.maxChildElements = 100000
</properties>
</ejb-deployment>
</openejb-jar>
I also tried with the shorter property cxf.stax.maxChildElements to check whether this would be accepted, yet without success.
For testing/debugging, I start the TomEE instance via the tomee-maven-plugin, Therefore, I tried the set the maxChildElement property as an environment property like so:
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>${tomee.plugin.version}</version>
<configuration>
<tomeeVersion>${tomee.version}</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<debug>false</debug>
<tomeeHttpPort>8181</tomeeHttpPort>
<debugPort>5005</debugPort>
<args>-Dfoo=bar</args>
<skipCurrentProject>true</skipCurrentProject>
<webapps>
<webapp>my.ws:${webservice.artifact.name}:${webservice.artifact.version}?name=ws-endpoint</webapp>
</webapps>
<libs>
<!-- Third party libraries needed in the global lib folder of TomEE -->
<lib>log4j:log4j:${log4j.version}</lib>
</libs>
<systemVariables>
<!--
special property needed to allow for more childElements in StAX Parser
-->
<org.apache.cxf.stax.maxChildElement>100000</org.apache.cxf.stax.maxChildElement>
</systemVariables>
</configuration>
</plugin>
Sadly, it has no effect on the runtime configuration of CXF/StAX (Woodstox).
Question
How can we override the maxChildElements property via a configuration in openejb-jar.xml or as an external property at TomEE startup.
Finally, I got it working with the help of Romain Manni-Bucau (credits to him for pointing me into the right direction). Yet, his original answer is not the final solution. Therefore, I give the working configuration here.
1.) Put the following openejb-jar.xml to the WEB-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar>
<ejb-deployment ejb-name="MyWebService">
<properties>
cxf.jaxws.properties = cxfConfig
</properties>
</ejb-deployment>
</openejb-jar>
2.) Provide a new (or add to an existing) resources.xml file, again via WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<Service id="cxfConfig" class-name="org.apache.openejb.config.sys.MapFactory" factory-name="create">
org.apache.cxf.stax.maxChildElements = 100000
</Service>
</resources>
Note well the configuration link via the MapFactory object with the id cxfConfig.
3.) Configure JAX-WS clients to set corresponding property as well. For instance, given a Spring client, this can be configured like so:
<bean id="wsClientProxy" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.acme.ws.jaxb.MyWebservice"/>
<property name="address" value="${ws.endpoint.url}"/>
<property name="properties">
<map>
<entry key="org.apache.cxf.stax.maxChildElements" value="100000" />
</map>
</property>
</bean>
In general, this might also be useful for people trying to set other CXF-related properties as listed in the XML section of the CXF security guideline, in particular to increase or decrease conservative default values.
I tested the above configuration steps successfully under a TomEE 7.0.3 and 8.0.9 environment, yet this should also reliably work with all 7.0.x and 8.0.x releases.
For other use cases, this blog post by Romain might also be worth reading, as it covers basic configuration concepts quite well.
Hope this helps others.
You can try
-Dorg.apache.cxf.stax.maxChildElements=100000
It should also work
I think you need to define a resources.xml with a Service of type (class-name) java.util.Properties and the properties inside:
openejb-jar.xml would get this property:
cxf.jaxws.properties = cxfConfig
resources.xml would get
org.apache.cxf.stax.maxChildElements = 1
This test does it programmatically: https://github.com/apache/tomee/blob/master/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/MaxChildTest.java

JobDataMap for trigger in Quatz jobs xml

I am running into an issue setting the job data map for the trigger in Quartz. I know it's possible pro grammatically, but I need to do it in the xml jobs file. However, every time I try to add it to the trigger, it says that job-data-map is invalid. Looking at the XSD (http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd) for the jobs file, it looks like it should be a valid child of the cron tag because it inherits abstractTriggerType, but my app won't accept it.
Here is my code. I am using Quartz.Net 2.0
<job>
<name>StagingJob</name>
<job-type>MyAssembly.StagingJob, MyAssembly</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>StagingTrigger</name>
<job-name>StagingJob</job-name>
<misfire-instruction>SmartPolicy</misfire-instruction>
<job-data-map>
<entry>
<key>end-time-cron</key>
<value>0 59 * * * ?</value>
</entry>
<entry>
<key>thread-count</key>
<value>3</value>
</entry>
</job-data-map>
<cron-expression>0 1 * * * ?</cron-expression>
</cron>
</trigger>
What is the correct way to add job data to the trigger via xml?
Try removing the element misfire-instruction, smart policy is the default anyway. If you'd like to keep the element, it should come after the job-data-map element. Quartz is quite strict about ordering of XML elements.
Visual Studio should also give you intellisense with this document if you set Schemas in VS property window point to XSD file included in the distribution.

Resources