I am trying to get a set of the distinct values of an object's field stored in a Hazelcast map.
This line of java code:
instructions.aggregate(Supplier.all(value -> value.getWorkArea()), Aggregations.distinctValues());
has the following stacktrace :
java.util.concurrent.ExecutionException: com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: com.example.instruction.repository.HazelcastInstructionRepository$GeneratedEvaluationClass
com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: com.example.instruction.repository.HazelcastInstructionRepository$GeneratedEvaluationClass
java.lang.ClassNotFoundException: com.example.instruction.repository.HazelcastInstructionRepository$GeneratedEvaluationClass
If I were to try this line :
instructions.aggregate(Supplier.all()), Aggregations.distinctValues());
or:
instructions.aggregate(Supplier.fromPredicate(Predicates.and(Predicates.equal("type", "someType"), equal("groupId", null),
Predicates.equal("workArea", "someWorkArea"))), Aggregations.distinctValues());
It just works ... It seems to be something wrong when I am making a reference to the object's field. (I also tried it with other fields of the object and the same error gets returned)
This is running on my local environment and I am sure that the objects are being placed correctly in the Hazelcast map since the other aggregations/predicates are working.
Do you have any ideas about what am I doing wrong?
Many Thanks!
EDITED: So the problem is the closure. It's not available on all nodes. Only on the calling node.
Also. This feature is deprecated. Plz use the fast-aggregations instead.
http://docs.hazelcast.org/docs/latest/manual/html-single/#fast-aggregations
Related
I have set a page custom field called CustomLogo in Liferay 7.1. I would like to access its value in Free marker template. After reading documentation & some posts related to it, i used following code to access custom field
<#assign page_custom_field_logo_url = layout.getGroup().getExpandoBridge().getAttribute("CustomLogo") />
<h1>${page_custom_field_logo_url }</h1>
I have set View Permission for the custom field (to all User roles). I have also checked if the column names and values are set properly in the liferay database (expando tables).
However i am getting following error:
FreeMarker template error: Java method "com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(String)" threw an exception when invoked on com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl object "com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl#f2864c8"; see cause exception in the Java stack trace. FTL stack trace ("~" means nesting-related):
- Failed at: #assign page_custom_field_logo_url... [in template "/templates/portal_normal.ftl" at line 75, column 37]
Upon observing the stack trace , I saw there is a null pointer exception which states:
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(ExpandoBridgeImpl.java:219)
at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(ExpandoBridgeImpl.java:199)
Caused by: java.lang.NullPointerException
at com.liferay.portlet.expando.service.permission.ExpandoColumnPermissionImpl.contains(ExpandoColumnPermissionImpl.java:73)
at com.liferay.expando.kernel.service.permission.ExpandoColumnPermissionUtil.contains(ExpandoColumnPermissionUtil.java:58)
at com.liferay.portlet.expando.service.impl.ExpandoValueServiceImpl.getData(ExpandoValueServiceImpl.java:121)
at sun.reflect.GeneratedMethodAccessor1066.invoke(Unknown Source)
As i stated above, i already set view permission for the custom field. I also double checked the key, typos and possible mistakes but no success.
Please let me know if you have any suggestions or things i missed out. Thanks
Try to get the expando bridge from the layout instead of the group, so
layout.getExpandoBridge().getAttribute("CustomLogo")
should work.
We have a central logging component which I am now trying to use in a WebJob that I am developing. I am basically following this example. My Activator is identical, I have the bindingModule that has my Bind statements in it. One thing I have done differently here is to use the method versions:
Kernel.Bind(typeof(IExternalSystemLogger)).To(typeof(ExternalSystemLogger));
instead of the generic versions in the example. I currently have constructor injection implemented but I have also set up the parameter injection as per the example. Which ever way I try to do this I end up with the error:
Error indexing method 'Functions.ProcessQueueMessage' ---> System.InvalidOperationException: Cannot bind parameter
or
a null reference exception (with parameter injection). Further into the error I am told that
Make sure the parameter Type is supported by the binding
which is the part that I am finding it difficult to resolve. I have looked at the available method calls on the config object available in WebJob.program but none seems to work. What is it I need to call so that I am correctly resolving my type when I am using a QueueTrigger or BlobTrigger?
I have a webservice in adf that treats requests, I use methods from a jar that run through view object iterators and so on.
In treating a request I call a method from the said jar that initializes a separate thread that manipulates and compares rows from view objects in that separate thread,
I am getting random exceptions like the following:
## Detail 0 ##
java.lang.NullPointerException
at oracle.jbo.server.ViewRowSetIteratorImpl.initViewRowSetIteratorImpl(ViewRowSetIteratorImpl.java:227)
at oracle.jbo.server.ViewRowSetIteratorImpl.(ViewRowSetIteratorImpl.java:176)
at oracle.jbo.server.ViewRowSetImpl.createNewRowSetIterator(ViewRowSetImpl.java:1434)
at oracle.jbo.server.ViewRowSetImpl.createViewRowSetIterator(ViewRowSetImpl.java:1485)
at oracle.jbo.server.ViewRowSetImpl.getDefaultRowSetIterator(ViewRowSetImpl.java:1704)
at oracle.jbo.server.ViewRowSetImpl.setRangeSize(ViewRowSetImpl.java:2936)
at oracle.jbo.server.ViewObjectImpl.doCreateViewLinkAccessorRS(ViewObjectImpl.java:16080)
at oracle.jbo.server.ViewObjectImpl.createViewLinkAccessorRS(ViewObjectImpl.java:16171)
at oracle.jbo.server.AssociationDefImpl.get(AssociationDefImpl.java:472)
at oracle.jbo.server.ViewAttributeDefImpl.get(ViewAttributeDefImpl.java:949)
at oracle.jbo.server.ViewRowStorage.getViewLinkAccessorResult(ViewRowStorage.java:1528)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1827)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1923)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:866)
and
## Detail 0 ##
java.lang.NullPointerException
at oracle.jbo.server.ViewRowImpl.getUseViewLogicGroupDef(ViewRowImpl.java:6078)
at oracle.jbo.server.ViewRowStorage.getViewAttributeDef(ViewRowStorage.java:1432)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1778)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1923)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:866)
and
Caused by: java.lang.NullPointerException
at oracle.jbo.server.ViewRowSetIteratorImpl.initViewRowSetIteratorImpl(ViewRowSetIteratorImpl.java:227)
at oracle.jbo.server.ViewRowSetIteratorImpl.(ViewRowSetIteratorImpl.java:176)
at oracle.jbo.server.ViewRowSetImpl.createNewRowSetIterator(ViewRowSetImpl.java:1434)
at oracle.jbo.server.ViewRowSetImpl.createViewRowSetIterator(ViewRowSetImpl.java:1485)
at oracle.jbo.server.ViewRowSetImpl.getDefaultRowSetIterator(ViewRowSetImpl.java:1704)
at oracle.jbo.server.ViewRowSetImpl.setRangeSize(ViewRowSetImpl.java:2936)
at oracle.jbo.server.ViewObjectImpl.doCreateViewLinkAccessorRS(ViewObjectImpl.java:16080)
at oracle.jbo.server.ViewObjectImpl.createViewLinkAccessorRS(ViewObjectImpl.java:16171)
at oracle.jbo.server.AssociationDefImpl.get(AssociationDefImpl.java:472)
at oracle.jbo.server.ViewAttributeDefImpl.get(ViewAttributeDefImpl.java:949)
at oracle.jbo.server.ViewRowStorage.getViewLinkAccessorResult(ViewRowStorage.java:1528)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1827)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1923)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:866)
The same method when it runs without the jar ( same code like in the jar but as a part of the same project ), it executes perfectly fine.
Could you please tell me why a NullPointerException is raised?
Thanks
You can not use the Business Components(ViewObject,Entities... etc) inside a thread.
There is no context (FacesContext cannot be initialized ).So you have to pass the ApplicationModule as a paramter to your method. But it will take a lot of time for processing
So the best way to access your data is to use CallableStatments PreparedStatments with Java Data Source connection.
can any body tell me the actual reason causing the below error:
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.NullPointerException, msg=null
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:7349)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1257)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1449)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1355)
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1340)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:7236)
at oracle.adf.model.bc4j.DCJboDataControl.executeIteratorBindingWithParams(DCJboDataControl.java:2987)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1541)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)
...
...
..
.
Caused by: java.lang.NullPointerException
at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:15884)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:911)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper.setObjectAtName(Unknown Source)
at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:4669)
at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3687)
at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:22684)
From the stacktrace, it seems some bind variable that is required by your view object query is not being set correctly.
If it works intermittently, it could be that the bind variable is lost at some point. To debug/test, try it with a hard-coded value for your bind variable and see if that works first (if you have a ViewCriteria, try removing that first) - then run the task flow and see if it works consistently.
I would suggest running the application in JDeveloper with -Djbo.debugoutput=console argument. It gives you a lot if information of what your business components are doing and you could catch the error cause in console logs.
i have created a map reduce job to fetch the number of employees of a location.
I am using hazelcast 3.6.3. Each employee has name and address.
I have added my code to following git repository.
https://github.com/adasari/hazelcast-demo
Exception :
java.util.concurrent.ExecutionException: java.lang.ClassCastException: com.hazelcast.mapreduce.aggregation.impl.DistinctValuesAggregation$SimpleEntry cannot be cast to com.hazelcast.query.impl.Extractable
at com.hazelcast.mapreduce.impl.task.TrackableJobFuture.setResult(TrackableJobFuture.java:68)
at com.hazelcast.mapreduce.impl.task.JobSupervisor.notifyRemoteException(JobSupervisor.java:156)
at com.hazelcast.mapreduce.impl.operation.NotifyRemoteExceptionOperation.run(NotifyRemoteExceptionOperation.java:54)
at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:172)
at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:393)
at com.hazelcast.spi.impl.operationexecutor.classic.OperationThread.processPacket(OperationThread.java:184)
at com.hazelcast.spi.impl.operationexecutor.classic.OperationThread.process(OperationThread.java:137)
at com.hazelcast.spi.impl.operationexecutor.classic.OperationThread.doRun(OperationThread.java:124)
at com.hazelcast.spi.impl.operationexecutor.classic.OperationThread.run(OperationThread.java:99)
Caused by: java.lang.ClassCastException: com.hazelcast.mapreduce.aggregation.impl.DistinctValuesAggregation$SimpleEntry cannot be cast to com.hazelcast.query.impl.Extractable
at com.hazelcast.query.impl.predicates.AbstractPredicate.readAttributeValue(AbstractPredicate.java:129)
at com.hazelcast.query.impl.predicates.AbstractPredicate.apply(AbstractPredicate.java:55)
can you point me the issue ?
Thanks.
Not exactly sure what you're looking for or what you're trying to do (looking at the code) but your problem is here:
Caused by: java.lang.ClassCastException: com.hazelcast.mapreduce.aggregation.impl.DistinctValuesAggregation$SimpleEntry cannot be cast to com.hazelcast.query.impl.Extractable
So you have to implement the Extractable interface with your SimpleEntry class.
I haven't worked on MapReduce but below are my observation while looking/executing the code.
The place it is failing is a different SimpleEntry class, an inner class of DistinctValuesAggregation which doesn't implement Extractable.
There is already a defect in Hazelcast(#7398) but it says closed in 3.6.1 so might as well follow up with them in Git hub.
I found that the code works well when you run the Cluster with just single node. So I suspect the above defect would be impacting the aggregation over multiple nodes.
HazelcastInstance hazelcastInstance = buildCluster(1);
Following actions resolved the issue -
1. DistinctMapper implements DataSerializable
2. SimpleEntry extends QueryableEntry