cancel
Showing results for 
Search instead for 
Did you mean: 

Test new model definition : where is the 'TestModel&quo

anweber
Champ in-the-making
Champ in-the-making
Hello,

     I have written a model definition and I should like to test if it is valid.  The "Data Dictionary Guide" tells me "execute the org.alfresco.repo.dictionary.TestModel".  My problem is that I do not know where this class is.  I loaded the executable version 1.2.0 bundled with Tomcat (I have not the source code).

   Thanks for your help,

               Andr
6 REPLIES 6

davidc
Star Contributor
Star Contributor
The TestModel class is available in the source bundle.  You'll also find it in the repository.jar inside of the .war file of the Tomcat bundle.

anweber
Champ in-the-making
Champ in-the-making
OK.  Thank you.  I found this class.  To execute the "TestModel" command, I had to add some paths in the CLASSPATH.  The resulting command to test "customModel.xml" is (if executed from the c:\Alfresco\tomcat\shared\classes directory) :


java -cp ".;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\commons-logging.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\core.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\repository.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jibx-bind.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jibx-run.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes" org.alfresco.repo.dictionary.TestModel alfresco/extension/customModel.xml

alexr
Champ in-the-making
Champ in-the-making
I am trying to add a custom model to my repository conform the Data_dictionary_guide (WiKi pages):

From the folder

C:\Alfresco\tomcat\shared\classes

I run the following TestModel check:

C:\Alfresco\tomcat\shared\classes>java -cp ".;C:\Alfresco\tomcat\webapps\alfresc
o\WEB-INF\lib\commons-logging.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\li
b\core.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\repository.jar;C:\Alf
resco\tomcat\webapps\alfresco\WEB-INF\lib\jibx-bind.jar;C:\Alfresco\tomcat\webap
ps\alfresco\WEB-INF\lib\jibx-run.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF
\classes" org.alfresco.repo.dictionary.TestModel alfresco/extension/blablaModel
.xml

And get this exception:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/alfresco/
repo/dictionary/TestModel (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(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.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 java.lang.ClassLoader.loadClassInternal(Unknown Source)

I am using the Alfresco 1.4 Community Preview edition based on tomcat and installed on Windows XP.


Two documents where prepared conform the developers guide (wiki pages):

blablaModel.xml and related example-model-context.xml

example-model-context.xml contains the following addition inside the Bootstrap bean:

            <list>
                <value>alfresco/extension/exampleModel.xml</value>
                <value>alfresco/extension/blablaModel.xml</value>
            </list>


are placed in the following folderpath:

C:\Alfresco\tomcat\shared\classes\alfresco\extension

The exception "Unsupported major.minor version 49.0 leads me to believe that there is some
configuration problem.

I setup Alfresco in C:\Alfresco with the install wizard.

=> Do I need to install the SDK as well in order to be able to run the TestModel class or in fact do any configuration/development?


Please help


Kind regards,

Alex :wink:

dschmalz
Champ in-the-making
Champ in-the-making
Are you possibly using jdk 1.4 to execute the test?

This is a typical error that occurs when a class has been compiled with a more recent version of the JDK (in this case 1.5) and ones tries to execute it with a former version.

Check the output of

java -version

If you're using JDK 1.4, install the latest Sun JDK and configure your path to point to the right java binary.

David

alexr
Champ in-the-making
Champ in-the-making
Hi David,

Thanks I checked the java -version,

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

java_home is pointing to the jre within the alfresco installation (c:\alfresco\java\bin), which is the above jre (for alfresco 1.4 community preview edition that is). Same entry in the classpath.

Still getting:
<<
C:\Alfresco\tomcat\shared\classes>java -cp ".;C:\Alfresco\tomcat\webapps\alfresc
o\WEB-INF\lib\commons-logging.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\li
b\core.jar;C:\alfsdk\lib\server\repository.jar;C:\Alfresco\tomcat\webapps\alfres
co\WEB-INF\lib\jibx-bind.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jib
x-run.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes" org.alfresco.repo
.dictionary.TestModel alfresco/extension/blablaModel.xml
Testing dictionary model definitions…
alfresco/model/dictionaryModel.xml
alfresco/model/systemModel.xml
alfresco/model/contentModel.xml
alfresco/model/applicationModel.xml
alfresco/extension/blablaModel.xml
20-sep-2006 9:25:14 org.alfresco.repo.dictionary.DictionaryBootstrap bootstrap
INFO: Loading model from alfresco/model/dictionaryModel.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPul
lParserException
        at org.alfresco.repo.dictionary.JiBX_repository_source_java_org_alfresco
_repo_dictionary_m2bindingFactory.createUnmarshallingContext()
        at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:85)
        at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(Dictionary
Bootstrap.java:98 )
        at org.alfresco.repo.dictionary.TestModel.main(TestModel.java:68 )
>> 

:cry:

No other JRE or JDK is installed on my test server.

Regards,

Alex

dschmalz
Champ in-the-making
Champ in-the-making
Hi Alex,


Still getting:
<<
C:\Alfresco\tomcat\shared\classes>java -cp ".;C:\Alfresco\tomcat\webapps\alfresc
o\WEB-INF\lib\commons-logging.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\li
b\core.jar;C:\alfsdk\lib\server\repository.jar;C:\Alfresco\tomcat\webapps\alfres
co\WEB-INF\lib\jibx-bind.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib\jib
x-run.jar;C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes" org.alfresco.repo
.dictionary.TestModel alfresco/extension/blablaModel.xml
Testing dictionary model definitions…
alfresco/model/dictionaryModel.xml
alfresco/model/systemModel.xml
alfresco/model/contentModel.xml
alfresco/model/applicationModel.xml
alfresco/extension/blablaModel.xml
20-sep-2006 9:25:14 org.alfresco.repo.dictionary.DictionaryBootstrap bootstrap
INFO: Loading model from alfresco/model/dictionaryModel.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPul
lParserException
        at org.alfresco.repo.dictionary.JiBX_repository_source_java_org_alfresco
_repo_dictionary_m2bindingFactory.createUnmarshallingContext()
        at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:85)
        at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(Dictionary
Bootstrap.java:98 )
        at org.alfresco.repo.dictionary.TestModel.main(TestModel.java:68 )
>> 

This is another error this time. It seems you're missing a few classes in your classpath. From the above error you're at least missing a jar containing the XML pull parser that reads XML files. The jar is named 'xpp3-1.1.3_8.jar'. Try to add it and see if it fixes your issues. Frankly speaking, if your model is not too complex, I would only check its well-formedness with a standard viewer (Firefox ?) and the try to start Alfresco. You might save some time  Smiley Very Happy

David