Exception in thread “main” java.lang.NoClassDefFoundError: org/openehr/rm/support/measurement/SimpleMeasurementService
at se.acode.openehr.parser.ADLParser.(ADLParser.java:49)
at se.acode.openehr.parser.ADLParser.(ADLParser.java:56)
at Parsertest.main(Parsertest.java:24)
When I checked the reference model jar there was no SimpleMeasurementService class
Am I doing something wrong, or do I have to download the source and compile it myself to get working jar-files to use?
The easiest way of getting started with the parser is to check out the source and build the jar with maven “mvn clean package”. Then you can find the jar called “adl-parser-1.0.5-SNAPSHOT-jar-with-dependencies.jar” in target sub directory. As the name implies, it includes all the dependencies required by the jar file and yon can actually start it from command line for some trivial parsing.
(As far as I can tell org.openehr.rm.support.measurement.SimpleMeasurementService is missing from
the pre-built jar-file openehr-rm-core-0.1-SNAPSHOT.jar. This is a bit confusing since it is required by the ADL-parser
that can be downloaded from the same site ( http://www.openehr.org/svn/ref_impl_java/TRUNK/docs/download.htm ))
After realising that maven was actually already installed, building on Mac OS X was no problem, before that I spent some time trying to make it easy installing maven-plugins for netbeans etc.
I’ve tested the parser on the archetypes that come with Ocean Informatics’ Archetype Editor.
95 out of 134 archetypes failed to parse. Is this due to some kind of incompatibility?
Basically there seems to be 2 kinds of errors, the first a parse error:
ParseException for openEHR-EHR-ITEM_TREE.referral.v1.adl
ParseException: Encountered “"en"” at line 15, column 37.
Was expecting:
<V_CODE_PHRASE> …
se.acode.openehr.parser.ParseException: Encountered “"en"” at line 15, column 37.
Was expecting:
<V_CODE_PHRASE> …
at se.acode.openehr.parser.ADLParser.generateParseException(ADLParser.java:7216)
at se.acode.openehr.parser.ADLParser.jj_consume_token(ADLParser.java:7078)
at se.acode.openehr.parser.ADLParser.code_phrase(ADLParser.java:297)
at se.acode.openehr.parser.ADLParser.arch_description_item(ADLParser.java:616)
at se.acode.openehr.parser.ADLParser.arch_description(ADLParser.java:517)
at se.acode.openehr.parser.ADLParser.archetype(ADLParser.java:272)
at se.acode.openehr.parser.ADLParser.parse(ADLParser.java:101)
at tsts2.testFile(tsts2.java:112)
at tsts2.testDirectory(tsts2.java:162)
at tsts2.testDirectory(tsts2.java:159)
at tsts2.main(tsts2.java:66)
and the second another kind which is not caught by the parser
Another exption for openEHR-EHR-ITEM_TREE.patient_information.v1.adl
Exception: null or empty purpose
java.lang.IllegalArgumentException: null or empty purpose
at org.openehr.rm.common.resource.ResourceDescriptionItem.(ResourceDescriptionItem.java:48)
at se.acode.openehr.parser.ADLParser.arch_description_item(ADLParser.java:698)
at se.acode.openehr.parser.ADLParser.arch_description(ADLParser.java:517)
at se.acode.openehr.parser.ADLParser.archetype(ADLParser.java:272)
at se.acode.openehr.parser.ADLParser.parse(ADLParser.java:101)
at tsts2.testFile(tsts2.java:112)
at tsts2.testDirectory(tsts2.java:162)
at tsts2.testDirectory(tsts2.java:159)
at tsts2.main(tsts2.java:66)
not sure what is included in the latest Archtype Editor - I would assume they are only test archetypes, which may indeed be a bit outdated - see comments inline.
You can get a recent set of archetypes via subversion…see at the very bottom of http://www.openehr.org/clinicalmodels/archetypes.html
Or you can download a zip file from the Beta openEHR Clinical Knowledge Manager at http://www.openehr.org/knowledge (Archetypes/Export Archetypes)
See more details on the errors inline
Best regards
Sebastian
Olof Torgersson wrote:
After realising that maven was actually already installed, building on Mac OS X was no problem, before that I spent some time trying to make it easy installing maven-plugins for netbeans etc.
I’ve tested the parser on the archetypes that come with Ocean Informatics’ Archetype Editor.
95 out of 134 archetypes failed to parse. Is this due to some kind of incompatibility?
Basically there seems to be 2 kinds of errors, the first a parse error:
ParseException for openEHR-EHR-ITEM_TREE.referral.v1.adl
ParseException: Encountered “"en"” at line 15, column 37.
Was expecting:
<V_CODE_PHRASE> …
se.acode.openehr.parser.ParseException: Encountered “"en"” at line 15, column 37.
Was expecting:
<V_CODE_PHRASE> …
at se.acode.openehr.parser.ADLParser.generateParseException(ADLParser.java:7216)
at se.acode.openehr.parser.ADLParser.jj_consume_token(ADLParser.java:7078)
at se.acode.openehr.parser.ADLParser.code_phrase(ADLParser.java:297)
at se.acode.openehr.parser.ADLParser.arch_description_item(ADLParser.java:616)
at se.acode.openehr.parser.ADLParser.arch_description(ADLParser.java:517)
at se.acode.openehr.parser.ADLParser.archetype(ADLParser.java:272)
at se.acode.openehr.parser.ADLParser.parse(ADLParser.java:101)
at tsts2.testFile(tsts2.java:112)
at tsts2.testDirectory(tsts2.java:162)
at tsts2.testDirectory(tsts2.java:159)
at tsts2.main(tsts2.java:66)
This is probably due to outdated specification of language in the archetype.
Opening the archetype and saving it, should update this to the “new” format and then should parse properly.
and the second another kind which is not caught by the parser
Another exption for openEHR-EHR-ITEM_TREE.patient_information.v1.adl
Exception: null or empty purpose
java.lang.IllegalArgumentException: null or empty purpose
at org.openehr.rm.common.resource.ResourceDescriptionItem.(ResourceDescriptionItem.java:48)
at se.acode.openehr.parser.ADLParser.arch_description_item(ADLParser.java:698)
at se.acode.openehr.parser.ADLParser.arch_description(ADLParser.java:517)
at se.acode.openehr.parser.ADLParser.archetype(ADLParser.java:272)
at se.acode.openehr.parser.ADLParser.parse(ADLParser.java:101)
at tsts2.testFile(tsts2.java:112)
at tsts2.testDirectory(tsts2.java:162)
at tsts2.testDirectory(tsts2.java:159)
at tsts2.main(tsts2.java:66)
This is because the ADL requires to have a purpose specified.
Most uptodate archetypes should have that now, but in case you REALLY need to parse an archetype that doesn’t have specified purpose, you could adapt the constructor of openehr-rm-core\src\main\java\org\openehr\rm\common\resource\ResourceDescriptionItem.java
if (StringUtils.isEmpty(purpose)) {
// throw new IllegalArgumentException(“null or empty purpose”);
System.out.println(“WARNING: Archetype parsed that has null or empty purpose…”);
}
Date: Tue, 30 Sep 2008 16:09:11 +0200
From: Olof Torgersson <oloft@chalmers.se>
Subject: {Disarmed} Re: Using adl-parser from jar-file
95 out of 134 archetypes failed to parse. Is this due to some kind of
incompatibility?
I don't know if it is helpful but when I was importing archetypes on
mass using the java ADL parser I read each ADL file and made a little
change to get past some parsing errors. Essentially I did this:
Date: Tue, 30 Sep 2008 16:09:11 +0200
From: Olof Torgersson <oloft@chalmers.se>
Subject: {Disarmed} Re: Using adl-parser from jar-file
95 out of 134 archetypes failed to parse. Is this due to some kind of
incompatibility?
I don’t know if it is helpful but when I was importing archetypes on
mass using the java ADL parser I read each ADL file and made a little
change to get past some parsing errors. Essentially I did this:
Message: 4
Date: Wed, 1 Oct 2008 09:45:38 +0200
From: Olof Torgersson <oloft@chalmers.se>
Subject: Re: Using adl-parser from jar-file
To: "List for the development team for the reference implementation of
openEHR in Java language and technologies."
<ref_impl_java@openehr.org>
Message-ID: <B44D82BE-6DD7-42FB-8FF5-28142403BE2B@chalmers.se>
Content-Type: text/plain; charset="iso-8859-1"
How do I check out the archetypes that can be viewed at