Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL-java
OCL-java [message #870072] Sun, 06 May 2012 06:36 Go to next message
Lucy Chan is currently offline Lucy Chan
Messages: 29
Registered: March 2012
Junior Member
The following is my code to parse some xx.ocl file. But it just executes at the System.out.println("ok").
The error information puzzled me:
-------------------------------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: lpg/runtime/RuleAction
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at Main.main(Main.java:56)
Caused by: java.lang.ClassNotFoundException: lpg.runtime.RuleAction
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more
----------------------------------------------------------------------------
It seems that OCL class cannot be recognized.I have posted my code. I think I have imported enough packets. If some has met the same problems and can give me some guide?
Thanks.



import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.ocl.OCL;
import org.eclipse.ocl.OCLInput;
import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.Constraint;
import org.eclipse.ocl.ecore.EcoreEnvironmentFactory;
import org.eclipse.ocl.ecore.*;
import org.eclipse.ocl.expressions.OCLExpression;



public class Main{

public static void main(String[] args) throws IOException,ParserException {

System.out.println("ok");//test

try {
OCL<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);

("/Architecture/model/test.ocl");


String path = "../RoyalAndLoyal/oclsrc/RoyalAndLoyal/RoyalAndLoyal.ocl";
//String path = "model/instance.ocl";
File file = new File(path);
InputStream in = new FileInputStream( file );

Map<String, Constraint> constraintMap = new HashMap<String, Constraint>();

System.out.println("ok");
// parse the contents as an OCL document
InputStreamReader r = new InputStreamReader(new FileInputStream(file));
OCLInput document = new OCLInput(in, r.getEncoding());

List<Constraint> constraints = ocl.parse(document);
for (Constraint next : constraints) {
constraintMap.put(next.getName(), next);

OCLExpression<EClassifier> body = next.getSpecification().getBodyExpression();
System.out.printf("%s: %s%n", next.getName(), body);
}
in.close();
} catch (Exception err) {
throw err;
}

}

}
Re: OCL-java [message #870161 is a reply to message #870072] Mon, 07 May 2012 05:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4115
Registered: July 2009
Senior Member
Hi

I am afraid that the free Open Source power of the Eclipse framework and
its many added projects is not a Utopia. There are drawbacks; funding is
limited, development is not always perfect, synchronization between
projects and versions may go astray. Users are expected to solve some of
their own problems.

This particular problem is of course impossible, but suggests that you
have been mixing and matching your installations.

In general your attempts to use Complete OCL beyond the capabilities
released in Indigo require you to be sympathetic to the usage of
milestone releases and to show some initiative in discovering how to use
them.

I suggest that you restrict your usage to those in Indigo SR2 and wait
until Juno is released at the end of June. At that point there should be
documentation that helps you do what you want to do.

Regards

Ed Willink



On 06/05/2012 07:36, Lucy Chan wrote:
> The following is my code to parse some xx.ocl file. But it just
> executes at the System.out.println("ok").
> The error information puzzled me:
> -------------------------------------------------------------------------
> Exception in thread "main" java.lang.NoClassDefFoundError:
> lpg/runtime/RuleAction
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at java.security.SecureClassLoader.defineClass(Unknown Source)
> at java.net.URLClassLoader.defineClass(Unknown Source)
> at java.net.URLClassLoader.access$100(Unknown Source)
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at Main.main(Main.java:56)
> Caused by: java.lang.ClassNotFoundException: lpg.runtime.RuleAction
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> ... 13 more
> ----------------------------------------------------------------------------
>
> It seems that OCL class cannot be recognized.I have posted my code. I
> think I have imported enough packets. If some has met the same
> problems and can give me some guide?
> Thanks.
>
>
>
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.InputStreamReader;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
>
> import org.eclipse.emf.ecore.EClass;
> import org.eclipse.emf.ecore.EClassifier;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.ocl.OCL;
> import org.eclipse.ocl.OCLInput;
> import org.eclipse.ocl.ParserException;
> import org.eclipse.ocl.ecore.Constraint;
> import org.eclipse.ocl.ecore.EcoreEnvironmentFactory;
> import org.eclipse.ocl.ecore.*;
> import org.eclipse.ocl.expressions.OCLExpression;
>
>
>
> public class Main{
>
> public static void main(String[] args) throws
> IOException,ParserException {
>
> System.out.println("ok");//test
>
> try {
> OCL<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint,
> EClass, EObject> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
>
> ("/Architecture/model/test.ocl");
>
>
> String path =
> "../RoyalAndLoyal/oclsrc/RoyalAndLoyal/RoyalAndLoyal.ocl";
> //String path = "model/instance.ocl";
> File file = new File(path);
> InputStream in = new FileInputStream( file );
>
> Map<String, Constraint> constraintMap = new
> HashMap<String, Constraint>();
>
> System.out.println("ok");
> // parse the contents as an OCL document
> InputStreamReader r = new InputStreamReader(new
> FileInputStream(file));
> OCLInput document = new OCLInput(in, r.getEncoding());
>
> List<Constraint> constraints = ocl.parse(document);
> for (Constraint next : constraints) {
> constraintMap.put(next.getName(), next);
>
> OCLExpression<EClassifier> body =
> next.getSpecification().getBodyExpression();
> System.out.printf("%s: %s%n", next.getName(), body);
> }
> in.close();
> } catch (Exception err) {
> throw err;
> }
>
> }
>
> }
>
Re: OCL-java [message #870397 is a reply to message #870161] Tue, 08 May 2012 02:13 Go to previous message
Lucy Chan is currently offline Lucy Chan
Messages: 29
Registered: March 2012
Junior Member
Thanks for your help. I will keep on focusing the modeling tools about eclipse.
Best Regards,
Previous Topic:[Announce] Eclipse OCL Core 4.0.0 (Juno) M7 is now available
Next Topic:[Announce] Eclipse OCL 4.0.0 (Juno) M7 is now available
Goto Forum:
  


Current Time: Fri Oct 31 20:05:39 GMT 2014

Powered by FUDForum. Page generated in 0.02609 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software