Query freezes with continously ClassNotFoundException("int")

46 views
Skip to first unread message

bala...@gmail.com

unread,
Aug 10, 2012, 4:24:44 AM8/10/12
to incquer...@googlegroups.com
Hi!

I'm creating a query, where I need to check a count of a query against a number stored in an other attribute value:

M == count find ...
find lowerMultiplicity(element, lower);
check((M as Integer) > (lower as Integer));

But when I try to execute the query, the whole workbench freezes and throws ClassNotFoundException("int") continously. Is this a bug, or I'm using the integer attributes wrong?

EMF-IncQuery version: 0.6.0.201208070407

Stack trace:
Thread [main] (Suspended (breakpoint at line 513 in BundleLoader))   
    BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 513   
    BundleLoader.findClass(String, boolean) line: 429   
    BundleLoader.findClass(String) line: 417   
    DefaultClassLoader.loadClass(String, boolean) line: 107   
    DefaultClassLoader(ClassLoader).loadClass(String) line: 248   
    Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method]   
    Class<T>.forName(String, boolean, ClassLoader) line: 247   
    ClassFinder.forName(String) line: 25   
    JavaReflectAccess.getRawType(JvmType) line: 132   
    JavaReflectAccess.getRawType(JvmTypeReference) line: 150   
    JavaReflectAccess.getParamTypes(JvmExecutable) line: 144   
    JavaReflectAccess.getMethod(JvmOperation) line: 76   
    XbaseInterpreter.invokeOperation(JvmOperation, Object, List<Object>) line: 717   
    XbaseInterpreter._featureCallOperation(JvmOperation, XAbstractFeatureCall, Object, IEvaluationContext, CancelIndicator) line: 713   
    GeneratedMethodAccessor21.invoke(Object, Object[]) line: not available   
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25   
    Method.invoke(Object, Object...) line: 597   
    PolymorphicDispatcher<RT>.invoke(Object...) line: 291   
    XbaseInterpreter.internalFeatureCallDispatch(XAbstractFeatureCall, Object, IEvaluationContext, CancelIndicator) line: 663   
    XbaseInterpreter._evaluateAbstractFeatureCall(XAbstractFeatureCall, IEvaluationContext, CancelIndicator) line: 658   
    GeneratedMethodAccessor20.invoke(Object, Object[]) line: not available   
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25   
    Method.invoke(Object, Object...) line: 597   
    PolymorphicDispatcher<RT>.invoke(Object...) line: 291   
    XbaseInterpreter.internalEvaluate(XExpression, IEvaluationContext, CancelIndicator) line: 218   
    XbaseInterpreter.evaluate(XExpression, IEvaluationContext, CancelIndicator) line: 204   
    XBaseEvaluator.doEvaluate(Tuple) line: 72   
    XBaseEvaluator(AbstractEvaluator).evaluate(Tuple) line: 36   
    PredicateEvaluatorNode.evaluateTerm(Tuple) line: 224   
    PredicateEvaluatorNode.evaluateExpression(Tuple) line: 210   
    PredicateEvaluatorNode.check(Tuple) line: 197   
    PredicateEvaluatorNode.update(Direction, Tuple) line: 143   
    ReteContainer.messageConsumptionSingleThreaded() line: 489   
    Network.waitForReteTermination() line: 333   
    ReteBoundary<PatternDescription>.updateBinaryEdge(Direction, Object, Object, Object) line: 623   
    BaseIndexListener.featureInserted(EObject, EStructuralFeature, Object) line: 132   
    NavigationHelperContentAdapter.notifyFeatureListeners(EObject, EStructuralFeature, Object, boolean) line: 516   
    NavigationHelperContentAdapter.insertFeatureTuple(EStructuralFeature, Object, EObject) line: 389   
    NavigationHelperVisitor$TraversingVisitor(NavigationHelperVisitor).visitReference(EObject, EReference, EObject) line: 218   
    NavigationHelperVisitor$TraversingVisitor(NavigationHelperVisitor).visitInternalContainment(EObject, EReference, EObject) line: 206   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 199   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 136   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitFeatureInternal(EMFVisitor, EObject, EStructuralFeature, Object, boolean) line: 200   
    EMFModelComprehension.visitObject(EMFVisitor, EObject) line: 132   
    EMFModelComprehension.visitResource(EMFVisitor, Resource) line: 111   
    EMFModelComprehension.visitResourceSet(EMFVisitor, ResourceSet) line: 101   
    EMFModelComprehension.visitModel(EMFVisitor, Notifier) line: 93   
    NavigationHelperImpl.traverse(NavigationHelperVisitor) line: 683   
    NavigationHelperImpl.coalesceTraversals(Callable<V>) line: 670   
    EMFPatternMatcherRuntimeContext.coalesceTraversals(Callable<V>) line: 200   
    ReteEngine<PatternDescription>.accessMatcher(PatternDescription) line: 174   
    BaseGeneratedMatcher<Signature>.accessMatcher(IncQueryEngine, Pattern) line: 44   
    SubContainerCountLowerMismatchMatcher(BaseGeneratedMatcher<Signature>).<init>(IncQueryEngine, IMatcherFactory<BaseGeneratedMatcher<Signature>>) line: 37   
    SubContainerCountLowerMismatchMatcher.<init>(IncQueryEngine) line: 74   
    SubContainerCountLowerMismatchMatcherFactory.instantiate(IncQueryEngine) line: 34   
    SubContainerCountLowerMismatchMatcherFactory.instantiate(IncQueryEngine) line: 1   
    SubContainerCountLowerMismatchMatcherFactory(BaseMatcherFactory<Matcher>).getMatcher(Notifier) line: 40   
   ...

berg...@mit.bme.hu

unread,
Aug 10, 2012, 9:17:18 AM8/10/12
to incquer...@googlegroups.com
Hi,

I could not reproduce the problem, so I think there may be some issues with your configuration.
- Which version of Eclipse are you using?
- What are the loaded plugins (with version)? I'm specifically interested in xtext, xtend, etc. technologies.
- Which method did you use to install EMF-IncQuery (source or update site)?
- How do you try to execute the query, via the Query Explorer, or programmatically?

About my reproduction attempt: I tried to recreate your pattern as faithfully as possible using the example school metamodel and instance model ( see https://viatra.inf.mit.bme.hu/incquery/new/examples/school ).

They look like this, and work for me fine in the Query Explorer:

pattern compare(Y,Date) = {
find startDate(Y,Date);
M == count find sch(_S);
check((Date as Integer) > (M as Integer));
}
pattern startDate(Y,Date) = { Year.startingDate(Y,Date); }
pattern sch(S) = { School(S); }

If they work for you as well, we would like to have some more details on your patterns to get an idea what goes wrong. Could you please send me your project and dependencies, or a subset that is sufficient to produce the problem?

Gábor

-----EMF-IncQuery Users <incquer...@googlegroups.com> ezt írta: -----

>Címzett: incquer...@googlegroups.com
>Feladó: "EMF-IncQuery Users on behalf of [email address]"
>Küldte: EMF-IncQuery Users
>Dátum: 2012/08/10 01:18du.
>Tárgy: [incquery-users] Query freezes with continously
>ClassNotFoundException("int")
> --
> You received this message because you are subscribed to the Google
>Groups "EMF-IncQuery Users" group.
> To post to this group, send email to
>incquer...@googlegroups.com.
> To unsubscribe from this group, send email to
>incquery-user...@googlegroups.com.
> To view this discussion on the web visit
>https://groups.google.com/d/msg/incquery-users/-/Fmc_oF-MmrQJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>

bala...@gmail.com

unread,
Aug 13, 2012, 4:17:44 AM8/13/12
to incquer...@googlegroups.com
I've installed EMF-IncQuery from the CI update site, on an 3.7.2 eclipse (Xtext, Xtend: 2.3.0.v201206120633), and running the query programatically.

However, the ClassNotFoundExceptions seems to be normal, and handled. (org.eclipse.xtext.common.types.access.impl.ClassFinder):

public Class<?> forName(String name) throws ClassNotFoundException {
       
try {
           
return Class.forName(classNameUtil.normalizeClassName(name), false, classLoader);
       
} catch(ClassNotFoundException e) {
           
Class<?> result = Primitives.forName(name);
           
if (result == null)
               
throw e;
           
return result;
       
}
   
}

Xtext tries to load the class first before trying to use it a primitive type.

 Further researching the problem, I've found that it only occures if I cast a String attribute value to integer with "(.. as Integer)". As the model stores the multiplicity of another item in a string attribute, I have to convert it to integer before comparing it. If there is a cast in the query, it looks like the query gets into an infinite loop. (or the several minutes I've waited wasn't enough for it?)

Is there an other way to parse a string as integer (like calling Integer.parseInt(..))?

Ujhelyi Zoltán

unread,
Aug 13, 2012, 5:39:41 AM8/13/12
to EMF-IncQuery Users
Thanks for the details.

The error message is indeed misleading; however, for a workaround I can suggest to rewrite your check expression like follows (not checked in our editor, but you might finish it):

check(val i1 = Integer::parseInt(M);
val i2 = Integer::parseInt(Lower);
i1 < i2);

I hope that helps,
Zoltán
-- Zoltán Ujhelyi
https://www.inf.mit.bme.hu/en/members/ujhelyiz

Fault Tolerant Systems Research Group
Budapest University of Technology and Economics
>> -----EMF-IncQuery Users <incquer...@googlegroups.com <javascript:>> ezt
>> írta: -----
>>
>>> Címzett: incquer...@googlegroups.com <javascript:>
>>> incquer...@googlegroups.com <javascript:>.
>>> To unsubscribe from this group, send email to
>>> incquery-user...@googlegroups.com <javascript:>.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/incquery-users/-/Fmc_oF-MmrQJ.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>
> --
> You received this message because you are subscribed to the Google Groups "EMF-IncQuery Users" group.
> To post to this group, send email to incquer...@googlegroups.com.
> To unsubscribe from this group, send email to incquery-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msg/incquery-users/-/_qdqySrcwLMJ.

bala...@gmail.com

unread,
Aug 13, 2012, 6:37:03 AM8/13/12
to incquer...@googlegroups.com
It works this way. I had only add a cast before adding the string to the parse method: (Integer::parseInt(lower as String))

Thanks for the help!

Reply all
Reply to author
Forward
0 new messages