setContext doesn't find RuleAction [message #41873] |
Tue, 30 October 2007 12:49 |
|
Hi,
I'm pretty new to OCL, so I tried to set up a quick test. I created a
new EMF based model, generated model, edit, editor, and test plugins
and now I'm trying to add some OCL expressions.
This is my test code:
-------------------------------------------------
01 // using package org.eclipse.ocl.ecore
02 EcoreEnvironmentFactory envfac = new
EcoreEnvironmentFactory(resourceSet.getPackageRegistry());
03 OCL ocl = OCL.newInstance(envfac);
04 OCL.Helper helper = ocl.createOCLHelper();
05 EObject instanceContext = resource.getContents().get(0);
06 helper.setInstanceContext(instanceContext);
07 try {
08 OCLExpression query = helper.createQuery("self.vertices->size()");
09 Object result = ocl.createQuery(query).evaluate();
10 System.out.println(result);
11 } catch (ParserException ex) {
12 ex.printStackTrace();
13 }
-------------------------------------------------
In line 6, the following exception is thrown:
-------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError:
lpg/lpgjavaruntime/RuleAction
....
at
org.eclipse.ocl.AbstractEnvironment.lookupLocal(AbstractEnvi ronment.java:482)
at
org.eclipse.ocl.AbstractEnvironment.addElement(AbstractEnvir onment.java:249)
at
org.eclipse.ocl.AbstractEnvironmentFactory.createClassifierC ontext(AbstractEnvironmentFactory.java:132)
at
org.eclipse.ocl.AbstractEnvironmentFactory.createInstanceCon text(AbstractEnvironmentFactory.java:144)
at
org.eclipse.ocl.internal.helper.OCLHelperImpl.setInstanceCon text(OCLHelperImpl.java:131)
at
org.eclipse.ocl.ecore.OCLHelperImpl.setInstanceContext(OCLHe lperImpl.java:130)
= line 6
at
de.feu.SimpleModel.tests.SimpleModelExample.main(SimpleModel Example.java:114)
-------------------------------------------------
I
also modified the ocl.examples.interpreter to plugin into my model
editor instead of the library example, and this is working pretty well.
With the (modified) interpreter example, I can query the model.
What is wrong with my code? Do I have to add a dependency? Where do I
find lpg.lpgjavaruntime.RuleAction?
Jens
|
|
|
Re: setContext doesn't find RuleAction [message #41914 is a reply to message #41873] |
Tue, 30 October 2007 15:42 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Jens,
How did you install the OCL SDK? The SDK download and update-manager site
both include the plug-in that defines the RuleAction class:
- net.sourceforge.lpg.lpgjavaruntime (version 1.1.0)
If you're consuming the OCL source from CVS, then you can get the LPG Java
Runtime from the Orbit CVS repository. The easiest way to do that is to
load the ocl.psf file in the org.eclipse.ocl.releng project, or download it
from the Orbit downloads page:
http://download.eclipse.org/tools/orbit/downloads/
HTH,
Christian
Jens v.P. wrote:
> Hi,
>
> I'm pretty new to OCL, so I tried to set up a quick test. I created a
> new EMF based model, generated model, edit, editor, and test plugins
> and now I'm trying to add some OCL expressions.
>
> This is my test code:
> -------------------------------------------------
> 01 // using package org.eclipse.ocl.ecore
> 02 EcoreEnvironmentFactory envfac = new
> EcoreEnvironmentFactory(resourceSet.getPackageRegistry());
> 03 OCL ocl = OCL.newInstance(envfac);
> 04 OCL.Helper helper = ocl.createOCLHelper();
> 05 EObject instanceContext = resource.getContents().get(0);
> 06 helper.setInstanceContext(instanceContext);
> 07 try {
> 08 OCLExpression query = helper.createQuery("self.vertices->size()");
> 09 Object result = ocl.createQuery(query).evaluate();
> 10 System.out.println(result);
> 11 } catch (ParserException ex) {
> 12 ex.printStackTrace();
> 13 }
> -------------------------------------------------
>
> In line 6, the following exception is thrown:
>
> -------------------------------------------------
> Exception in thread "main" java.lang.NoClassDefFoundError:
> lpg/lpgjavaruntime/RuleAction
> ...
> at
>
org.eclipse.ocl.AbstractEnvironment.lookupLocal(AbstractEnvi ronment.java:482)
> at
>
>
org.eclipse.ocl.AbstractEnvironment.addElement(AbstractEnvir onment.java:249)
> at
>
org.eclipse.ocl.AbstractEnvironmentFactory.createClassifierC ontext(AbstractEnvironmentFactory.java:132)
> at
>
>
org.eclipse.ocl.AbstractEnvironmentFactory.createInstanceCon text(AbstractEnvironmentFactory.java:144)
> at
>
>
org.eclipse.ocl.internal.helper.OCLHelperImpl.setInstanceCon text(OCLHelperImpl.java:131)
> at
>
>
org.eclipse.ocl.ecore.OCLHelperImpl.setInstanceContext(OCLHe lperImpl.java:130)
> = line 6
> at
>
de.feu.SimpleModel.tests.SimpleModelExample.main(SimpleModel Example.java:114)
> -------------------------------------------------
>
> I
>
> also modified the ocl.examples.interpreter to plugin into my model
> editor instead of the library example, and this is working pretty well.
> With the (modified) interpreter example, I can query the model.
>
> What is wrong with my code? Do I have to add a dependency? Where do I
> find lpg.lpgjavaruntime.RuleAction?
>
> Jens
|
|
|
|
Powered by
FUDForum. Page generated in 0.03926 seconds