cancel
Showing results for 
Search instead for 
Did you mean: 

org.alfresco.repo.dictionary.TestModel

cjimenez2581
Champ in-the-making
Champ in-the-making
Hello I want to use this Object ( TestModel) but I cannot make it work, I'd like someone to guide me  Smiley Surprisedops:
3 REPLIES 3

openpj
Elite Collaborator
Elite Collaborator
To execute a complete test of your custom models using the TestModel class you can execute the following bash script from the WEB-INF/lib path of your Alfresco extracted WAR installation:

java -cp "`find . -name \*.jar | tr "\n" ":"`:../../../../shared/classes/:../classes" org.alfresco.repo.dictionary.TestModel "alfresco/extension/models/yourCustomContentModelFile.xml"
Notice that you have to set the classpath resource of your custom model.

In the example above we are referring a new content model available in the alfresco/extension/model classpath.
You could try to use it adding a custom model in the tomcat/shared/classes/alfresco/extension/model to try to execute this example script.

Hope this helps  :wink:

sharifu
Confirmed Champ
Confirmed Champ
HI, can you explain a little more, because i have tried the following and get no luck


[root@alfrescotest bin]# pwd
/opt/alfresco-4.0.d/java/jre/bin
[root@alfrescotest bin]# ./java -cp "`find . -name \*.jar | tr "\n" ":"`:../../../../shared/classes/:../classes" org.alfresco.repo.dictionary.TestModel "alfresco/extension/models/SpectrumModel.xml"
Exception in thread "main" java.lang.NoClassDefFoundError: org/alfresco/repo/dictionary/TestModel
Caused by: java.lang.ClassNotFoundException: org.alfresco.repo.dictionary.TestModel
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.alfresco.repo.dictionary.TestModel.  Program will exit.
[root@alfrescotest bin]# ./java -cp ".;/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/lib/*;/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/" org.alfresco.repo.dictionary.TestModel alfresco/extension/exampleModel.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/alfresco/repo/dictionary/TestModel
Caused by: java.lang.ClassNotFoundException: org.alfresco.repo.dictionary.TestModel
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.alfresco.repo.dictionary.TestModel.  Program will exit.
[root@alfrescotest bin]#

sharifu
Confirmed Champ
Confirmed Champ
i have done the following now and the test started to run but it threw an error


[root@alfrescotest lib]# pwd
/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/lib
[root@alfrescotest lib]#
[root@alfrescotest lib]#
[root@alfrescotest lib]#
[root@alfrescotest lib]# ../../../../../java/jre/bin/java -cp "`find . -name \*.jar | tr "\n" ":"`:../../../../shared/classes/:../classes" org.alfresco.repo.dictionary.TestModel "alfresco/extension/models/SpectrumModel.xml"
Testing dictionary model definitions…
alfresco/model/dictionaryModel.xml
alfresco/model/systemModel.xml
org/alfresco/repo/security/authentication/userModel.xml
alfresco/model/contentModel.xml
alfresco/model/wcmModel.xml
alfresco/model/applicationModel.xml
alfresco/model/bpmModel.xml
alfresco/model/wcmAppModel.xml
alfresco/extension/models/SpectrumModel.xml
Found an invalid model…
04110000 Could not find bootstrap model alfresco/extension/models/SpectrumModel.xml

Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.