cancel
Showing results for 
Search instead for 
Did you mean: 

Running Jeff Potts' web scripts tutorial code on Alfresco 4.2.c with Maven

akoudrin
Champ in-the-making
Champ in-the-making
I have a non-SDK development environment of Alfresco 4.2.c set up in Eclipse using Alfresco Maven. My main goal is to familiarise myself with Share development, content models, and web scripts for the upcoming project.

The only Alfresco tutorials I've found are Jeff Potts' Alfresco Developer Series. So far I've done the Working with Custom Content Types, 2nd Edition and the simple part of Intro to the Web Script Framework.

The second part of the web script tutorial requires downloading and running the code created by the author. I downloaded the code and put everything from <em>src/</em> directory into my <em>src/main/resources/</em> directory. (I'm not sure where the <em>web/</em> directory should go, but I don't think it matters for getting <em>src/</em> to run).

There are several things about the sample code.

- It is meant to be built with ant. There are <em>build.properties</em> and <em>build.xml</em>.

- The tutorial is dated at 2007, nearly 6 years old now


When I restart Alfresco Tomcat, I get an error:
<em>
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.someco.scripts.PostRating] for bean with name 'webscript.com.someco.ratings.rating.post' defined in file [/home/alexk/workspace/cabnet-alfresco/alfresco/target/alfresco/WEB-INF/classes/alfresco/extension/someco-scripts-context.xml]; nested exception is java.lang.ClassNotFoundException: com.someco.scripts.PostRating
</em>

I've checked and the code is there in those files with those class names. Being both Alfresco and Maven nubie I thought that this code should just run. Evidently some more config needs to be included.

Does anyone know how to get this code running in Maven Alfresco 4.2.c?


P.S. If anyone knows other more current Alfresco (escpeically Share) tutorials I would be very interested.
2 REPLIES 2

abarisone
Star Contributor
Star Contributor
Hi,
your webscript class must be in the classpath and check if the Spring's configuration of your script is correct.
Moreover if the webscript is Java-backed, remember that if you put it in some package its Spring class definition must reflect that.

Regards,
Andrea

eric_soto
Champ in-the-making
Champ in-the-making
akoudrin,

I can recommend the following excellent books:
<ul><li>Professional Alfresco (Wrox, 2010)</li><li>Alfresco Share, (Packtpub, 2012)</li></ul>

I hope this helps. Cheers.