cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying Java-backed class under extension classpath

kooroshv
Champ in-the-making
Champ in-the-making
I have installed Alfresco version 3.3G on Windows and in process of evaluating it. Presently, I am trying to make JavaDir Java-Backed example from chapter 11th in "Professional Alfresco Practical Solutions" book to work. I have gotten the example working where I have placed my Java class file under the default installation path:

<Tomcat_Home>\webapps\alfresco\WEB-INF\classes

However, I am having trouble getting it working when I deploy it under the extension classpath as suggested in the book:

<Tomcat_home>\shared\classes\alfresco\extension

Here is the error message I get when starting Alfresco:

10:45:30,748  ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'LuceneFullTextSearchIndexer' defined in class path resource [alfresco/co
re-services-context.xml]: Cannot resolve reference to bean 'luceneFullTextSearch
Indexer' while setting bean property 'target'; nested exception is org.springfra
mework.beans.factory.BeanCreationException: Error creating bean with name 'lucen
eFullTextSearchIndexer' defined in class path resource [alfresco/core-services-c
ontext.xml]: Initialization of bean failed; nested exception is org.springframew
ork.beans.factory.CannotLoadBeanClassException: Cannot find class [org.example.J
avaDir] for bean with name 'webscript.org.example.javadir.get' defined in file [
C:\apache-tomcat-6.0.26-alfresco\shared\classes\alfresco\extension\javadir-conte
xt.xml]; nested exception is java.lang.ClassNotFoundException: org.example.JavaD
ir
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:328)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:540)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:842)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:416)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:261)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:192)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:47)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(Context
LoaderListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
467)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:637)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:563)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'luceneFullTextSearchIndexer' defined in class path resource [
alfresco/core-services-context.xml]: Initialization of bean failed; nested excep
tion is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot f
ind class [org.example.JavaDir] for bean with name 'webscript.org.example.javadi
r.get' defined in file [C:\apache-tomcat-6.0.26-alfresco\shared\classes\alfresco
\extension\javadir-context.xml]; nested exception is java.lang.ClassNotFoundExce
ption: org.example.JavaDir
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:322)
        … 40 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Canno
t find class [org.example.JavaDir] for bean with name 'webscript.org.example.jav
adir.get' defined in file [C:\apache-tomcat-6.0.26-alfresco\shared\classes\alfre
sco\extension\javadir-context.xml]; nested exception is java.lang.ClassNotFoundE
xception: org.example.JavaDir
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolve
BeanClass(AbstractBeanFactory.java:1208)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.predictBeanType(AbstractAutowireCapableBeanFactory.java:568)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFacto
ryBean(AbstractBeanFactory.java:1277)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeanNamesForType(DefaultListableBeanFactory.java:302)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeansOfType(DefaultListableBeanFactory.java:381)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeansOfType(DefaultListableBeanFactory.java:375)
        at org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl.se
tBeanFactory(FullTextSearchIndexerImpl.java:247)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1422)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1389)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
        … 46 more
Caused by: java.lang.ClassNotFoundException: org.example.JavaDir
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1516)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1361)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
        at org.springframework.beans.factory.support.AbstractBeanDefinition.reso
lveBeanClass(AbstractBeanDefinition.java:408)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doResol
veBeanClass(AbstractBeanFactory.java:1229)
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolve
BeanClass(AbstractBeanFactory.java:1200)
        … 55 more

Since Alfresco error tells me it is having problem finding the class file, I experimented by deploying the class under <Tomcat_home>\shared\classes. By doing this Alfresco at start time sees my Java class, but then complains about undefined classes such as DeclarativeWebScript. By adding the corresponding Jar files under <Tomcat_home>\shared\lib I got over some of the undefined class errors, but finally I got stuck where it was complaining about 'no matching type' for 'repository'. This seems not to be the right approach.

Looking at the Wiki http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples#Writing_the_Web_Script_.28Java.29, it does not mention the 'extension' path. Also I could not find any reference to this topic on the forum.

Any suggestions is greatly appropriated here.

For reference here are the listing of the files and their locations:

Via Alfresco Explorer:  Company Home -> Data Dictionary -> Web Scripts Extensions -> org -> example -> javadir.get.desc.xml

<webscript>
  <shortname>Folder Listing Utility</shortname>
  <description>Java-backed implementation of listing folder contents</description>
  <url>/javadir/{folderpath}?verbose={verbose?}</url>
  <authentication>user</authentication>
</webscript>

Via Alfresco Explorer:  Company Home -> Data Dictionary -> Web Scripts Extensions -> org -> example -> javadir.get.html.ftl

<html>
  <head>
    <title>Folder ${folder.displayPath}/${folder.name}</title>
  </head>
  <body>
     Alfresco ${server.edition} Edition v${server.version} : dir
    <p>
    Contents of folder ${folder.displayPath}/${folder.name}
    <p>
    <table>
    <#list folder.children as child>
       <tr>
           <td><#if child.isContainer>d</#if></td>
           <#if verbose>
              <td>${child.properties.modifier}</td>
              <td><#if child.isDocument>
                 ${child.properties.content.size}</#if></td>
              <td>${child.properties.modified?date}</td>
           </#if>
           <td>${child.name}</td>
       </tr>
    </#list>
    </table>
  </body>
</html>

JavaDir class is listed bellow. Note, I changed import path for 'DeclarativeWebScript' and others from 'org.alfresco.web.scripts' to 'org.springframework.extensions.webscripts' because of changes from 3.2 to 3.3 release:

package org.example;

import java.util.HashMap;
import java.util.Map;

import org.alfresco.repo.model.Repository;
import org.alfresco.service.cmr.repository.NodeRef;
//This classes are defined in spring-webscripts-1.0.0.CI-SNAPSHOT.jar which is in 3rd Party project.
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;

public class JavaDir extends DeclarativeWebScript
{
    private Repository repository;
   
    public void setRepository(Repository repository)
    {
        this.repository = repository; 
    }
   
    protected Map<String, Object> executeImpl(WebScriptRequest req,
        Status status, Cache cache)
    {
        // extract folder listing arguments from URI
        String verboseArg = req.getParameter("verbose");
        Boolean verbose = Boolean.parseBoolean(verboseArg);
        Map<String, String> templateArgs = req.getServiceMatch().getTemplateVars();
        String folderPath = templateArgs.get("folderpath");
       
        // search for folder within Alfresco content repository
        String nodePath = "workspace/SpacesStore/" + folderPath;
        NodeRef folder = repository.findNodeRef("path", nodePath.split("/"));
       
        // validate that folder has been found
        if (folder == null)
        {
            throw new WebScriptException(Status.STATUS_NOT_FOUND,
              "Folder " + folderPath + " not found");
        }

        // construct model for response template to render
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("verbose", verbose);
        model.put("folder", folder);
        return model;
    }
}
5 REPLIES 5

mrogers
Star Contributor
Star Contributor
I think you just have the wrong package names.

Assuming that you have the following on your classpath
<Tomcat_home>\shared\classes\

Then
org.example.JavaDir

would need to be in folder
<Tomcat_home>\shared\classes\org\example

chandu7ee
Champ in-the-making
Champ in-the-making
Hi kooroshv,

  even i executed the same code perfectly.,only thing that you are wrong was., placing  the class file.

go to  <alfresco>\tomcat\shared\classes

create org folder and then  create example folder (in org folder)  copy the class file into this folder.(in example folder)

because your package name was package org.example;


Thankls

kooroshv
Champ in-the-making
Champ in-the-making
Hi guys,
  Thanks for replies and suggestions. I tried your suggestions, but still it is not working. Here is what I had done so far. I placed the JavaDir.class file under:

<Tomcat_Home>\shared\classes\org\example

Now when I start Alfresco server, it finds the class, but now I am getting the following error about not finding 'DeclarativeWebScript' class:


10:03:43,020  INFO  [acegisecurity.intercept.AbstractSecurityInterceptor] Valida
ted configuration attributes
10:03:43,645  ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'LuceneFullTextSearchIndexer' defined in class path resource [alfresco/co
re-services-context.xml]: Cannot resolve reference to bean 'luceneFullTextSearch
Indexer' while setting bean property 'target'; nested exception is org.springfra
mework.beans.factory.BeanCreationException: Error creating bean with name 'lucen
eFullTextSearchIndexer' defined in class path resource [alfresco/core-services-c
ontext.xml]: Initialization of bean failed; nested exception is org.springframew
ork.beans.factory.CannotLoadBeanClassException: Error loading class [org.example
.JavaDir] for bean with name 'webscript.org.example.javadir.get' defined in file
[C:\apache-tomcat-6.0.26-alfresco\shared\classes\alfresco\extension\javadir-con
text.xml]: problem with class file or dependent class; nested exception is java.
lang.NoClassDefFoundError: org/springframework/extensions/webscripts/Declarative
WebScript
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:328)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:540)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:842)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:416)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:261)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:192)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:47)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(Context
LoaderListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
467)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:637)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:563)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'luceneFullTextSearchIndexer' defined in class path resource [
alfresco/core-services-context.xml]: Initialization of bean failed; nested excep
tion is org.springframework.beans.factory.CannotLoadBeanClassException: Error lo
ading class [org.example.JavaDir] for bean with name 'webscript.org.example.java
dir.get' defined in file [C:\apache-tomcat-6.0.26-alfresco\shared\classes\alfres
co\extension\javadir-context.xml]: problem with class file or dependent class; n
ested exception is java.lang.NoClassDefFoundError: org/springframework/extension
s/webscripts/DeclarativeWebScript
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:322)
        … 40 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Error
loading class [org.example.JavaDir] for bean with name 'webscript.org.example.j
avadir.get' defined in file [C:\apache-tomcat-6.0.26-alfresco\shared\classes\alf
resco\extension\javadir-context.xml]: problem with class file or dependent class
; nested exception is java.lang.NoClassDefFoundError: org/springframework/extens
ions/webscripts/DeclarativeWebScript
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolve
BeanClass(AbstractBeanFactory.java:1211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.predictBeanType(AbstractAutowireCapableBeanFactory.java:568)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFacto
ryBean(AbstractBeanFactory.java:1277)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeanNamesForType(DefaultListableBeanFactory.java:302)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeansOfType(DefaultListableBeanFactory.java:381)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeansOfType(DefaultListableBeanFactory.java:375)
        at org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl.se
tBeanFactory(FullTextSearchIndexerImpl.java:247)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1422)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1389)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
        … 46 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/extensions/webscr
ipts/DeclarativeWebScript
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1503)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1361)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
        at org.springframework.beans.factory.support.AbstractBeanDefinition.reso
lveBeanClass(AbstractBeanDefinition.java:408)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doResol
veBeanClass(AbstractBeanFactory.java:1229)
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolve
BeanClass(AbstractBeanFactory.java:1200)
        … 55 more
Caused by: java.lang.ClassNotFoundException: org.springframework.extensions.webs
cripts.DeclarativeWebScript
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        … 71 more
Jul 15, 2010 10:03:43 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jul 15, 2010 10:03:43 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/alfresco] startup failed due to previous errors
Jul 15, 2010 10:03:44 AM org.apache.catalina.loader.WebappClassLoader clearRefer
encesJdbc
SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] but
failed to unregister it when the web application was stopped. To prevent a memo
ry leak, the JDBC Driver has been forcibly unregistered.
Jul 15, 2010 10:03:44 AM org.apache.catalina.loader.WebappClassLoader clearRefer
encesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [MySQL Sta
tement Cancellation Timer] via the java.util.Timer API but has failed to stop it
. To prevent a memory leak, the timer (and hence the associated thread) has been
forcibly cancelled.
Jul 15, 2010 10:03:44 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.Thre
adLocal] (value [java.lang.ThreadLocal@564290]) and a value of type [org.alfresc
o.util.CachingDateFormat] (value [yyyy-MM-dd]) but failed to remove it when the
web application was stopped. To prevent a memory leak, the ThreadLocal has been
forcibly removed.
Jul 15, 2010 10:03:44 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.Thre
adLocal] (value [java.lang.ThreadLocal@12c17ce]) and a value of type [org.apache
.cxf.bus.CXFBusImpl] (value [org.apache.cxf.bus.CXFBusImpl@1cf031e]) but failed
to remove it when the web application was stopped. To prevent a memory leak, the
ThreadLocal has been forcibly removed.
Jul 15, 2010 10:03:44 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [
com.sun.xml.bind.v2.runtime.Coordinator$1@1d5d6af]) and a value of type [com.sun
.xml.bind.v2.runtime.Coordinator[]] (value [[Lcom.sun.xml.bind.v2.runtime.Coordi
nator;@19ced]) but failed to remove it when the web application was stopped. To
prevent a memory leak, the ThreadLocal has been forcibly removed.
Jul 15, 2010 10:03:44 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [
com.sun.xml.bind.v2.ClassFactory$1@1e5ab68]) and a value of type [java.util.Weak
HashMap] (value [{class org.alfresco.repo.audit.model._3.GenerateValue=java.lang
.ref.WeakReference@650c3b, class org.alfresco.repo.audit.model._3.PathMap=java.l
ang.ref.WeakReference@6178a, class org.alfresco.repo.audit.model._3.Application=
java.lang.ref.WeakReference@1f3a295, class org.alfresco.repo.audit.model._3.Path
Mappings=java.lang.ref.WeakReference@37114f, class org.alfresco.repo.audit.model
._3.DataGenerator=java.lang.ref.WeakReference@151786b, class org.alfresco.repo.a
udit.model._3.AuditPath=java.lang.ref.WeakReference@1b8db54, class org.alfresco.
repo.audit.model._3.RecordValue=java.lang.ref.WeakReference@14774fd, class java.
util.ArrayList=java.lang.ref.WeakReference@51aa65, class org.alfresco.repo.audit
.model._3.DataExtractor=java.lang.ref.WeakReference@189e7b8, class org.alfresco.
repo.audit.model._3.DataGenerators=java.lang.ref.WeakReference@cc1102, class org
.alfresco.repo.audit.model._3.DataExtractors=java.lang.ref.WeakReference@1709ed1
, class org.alfresco.repo.audit.model._3.Audit=java.lang.ref.WeakReference@cab23
b}]) but failed to remove it when the web application was stopped. To prevent a
memory leak, the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class
reloading, using NOPLoggerRepository.
Jul 15, 2010 10:03:47 AM org.apache.catalina.startup.HostConfig deployDescriptor

INFO: Deploying configuration descriptor host-manager.xml
Jul 15, 2010 10:03:47 AM org.apache.catalina.startup.HostConfig deployDescriptor

INFO: Deploying configuration descriptor manager.xml
Jul 15, 2010 10:03:47 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive share.war
10:03:59,286  INFO  [extensions.webscripts.DeclarativeRegistry] Registered 231 W
eb Scripts (+0 failed), 239 URLs
10:04:03,770  INFO  [extensions.webscripts.DeclarativeRegistry] Registered 8 Pac
kage Description Documents (+0 failed)
10:04:03,786  INFO  [extensions.webscripts.DeclarativeRegistry] Registered 0 Sch
ema Description Documents (+0 failed)
10:04:03,989  INFO  [extensions.webscripts.AbstractRuntimeContainer] Initialised
Spring Surf Container Web Script Container (in 8239.097ms)
10:04:04,192  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered
template processor freemarker for extension ftl
10:04:04,380  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered s
cript processor javascript for extension js
10:04:04,583  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered
template processor freemarker for extension ftl
10:04:04,599  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered s
cript processor javascript for extension js
10:04:04,724  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered
template processor freemarker for extension ftl
10:04:04,739  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered s
cript processor javascript for extension js
Jul 15, 2010 10:04:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Jul 15, 2010 10:04:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Jul 15, 2010 10:04:07 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Jul 15, 2010 10:04:07 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 15, 2010 10:04:07 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 15, 2010 10:04:07 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16  config=null
Jul 15, 2010 10:04:07 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 73070 ms

So I copied the JAR file spring-webscripts-1.0.0.CI-SNAPSHOT.jar, under:

<Tomcat_Home>\shared\lib

I ended up copying bunch of other JAR files into the same folder. Here the ones I had to copy:

alfresco-repository-3.3G.jar
commons-logging-1.1.jar
freemarker-2.3.13.jar
spring-surf-core-1.0.0.CI-SNAPSHOT.jar

Still I am getting errors at Alfresco start time. Here is the error:

10:21:02,871  ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'webscript.org.example.javadir.get' defined in file [C:\apache-tomcat-6.0
.26-alfresco\shared\classes\alfresco\extension\javadir-context.xml]: Initializat
ion of bean failed; nested exception is org.springframework.beans.ConversionNotS
upportedException: Failed to convert property value of type 'org.alfresco.repo.m
odel.Repository' to required type 'org.alfresco.repo.model.Repository' for prope
rty 'repository'; nested exception is java.lang.IllegalStateException: Cannot co
nvert value of type [org.alfresco.repo.model.Repository] to required type [org.a
lfresco.repo.model.Repository] for property 'repository': no matching editors or
conversion strategy found
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:557)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:842)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:416)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:261)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:192)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:47)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(Context
LoaderListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
467)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:637)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:563)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to
convert property value of type 'org.alfresco.repo.model.Repository' to required
type 'org.alfresco.repo.model.Repository' for property 'repository'; nested exce
ption is java.lang.IllegalStateException: Cannot convert value of type [org.alfr
esco.repo.model.Repository] to required type [org.alfresco.repo.model.Repository
] for property 'repository': no matching editors or conversion strategy found
        at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrap
perImpl.java:462)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1351)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1310)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        … 36 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.al
fresco.repo.model.Repository] to required type [org.alfresco.repo.model.Reposito
ry] for property 'repository': no matching editors or conversion strategy found
        at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(Ty
peConverterDelegate.java:289)
        at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(Ty
peConverterDelegate.java:154)
        at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrap
perImpl.java:452)
        … 40 more
Jul 15, 2010 10:21:02 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jul 15, 2010 10:21:02 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/alfresco] startup failed due to previous errors
Jul 15, 2010 10:21:03 AM org.apache.catalina.loader.WebappClassLoader clearRefer
encesJdbc
SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] but
failed to unregister it when the web application was stopped. To prevent a memo
ry leak, the JDBC Driver has been forcibly unregistered.
Jul 15, 2010 10:21:03 AM org.apache.catalina.loader.WebappClassLoader clearRefer
encesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [MySQL Sta
tement Cancellation Timer] via the java.util.Timer API but has failed to stop it
. To prevent a memory leak, the timer (and hence the associated thread) has been
forcibly cancelled.
Jul 15, 2010 10:21:03 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.Thre
adLocal] (value [java.lang.ThreadLocal@185ded7]) and a value of type [org.alfres
co.util.CachingDateFormat] (value [yyyy-MM-dd]) but failed to remove it when the
web application was stopped. To prevent a memory leak, the ThreadLocal has been
forcibly removed.
Jul 15, 2010 10:21:03 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.Thre
adLocal] (value [java.lang.ThreadLocal@1e90ea7]) and a value of type [org.apache
.cxf.bus.CXFBusImpl] (value [org.apache.cxf.bus.CXFBusImpl@1c11ce0]) but failed
to remove it when the web application was stopped. To prevent a memory leak, the
ThreadLocal has been forcibly removed.
Jul 15, 2010 10:21:03 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [
com.sun.xml.bind.v2.runtime.Coordinator$1@14ecfa4]) and a value of type [com.sun
.xml.bind.v2.runtime.Coordinator[]] (value [[Lcom.sun.xml.bind.v2.runtime.Coordi
nator;@1225841]) but failed to remove it when the web application was stopped. T
o prevent a memory leak, the ThreadLocal has been forcibly removed.
Jul 15, 2010 10:21:03 AM org.apache.catalina.loader.WebappClassLoader clearThrea
dLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [
com.sun.xml.bind.v2.ClassFactory$1@1d034cf]) and a value of type [java.util.Weak
HashMap] (value [{class org.alfresco.repo.audit.model._3.PathMap=java.lang.ref.W
eakReference@1abd36b, class org.alfresco.repo.audit.model._3.DataGenerators=java
.lang.ref.WeakReference@1c54d06, class org.alfresco.repo.audit.model._3.DataExtr
actors=java.lang.ref.WeakReference@43f502, class org.alfresco.repo.audit.model._
3.DataExtractor=java.lang.ref.WeakReference@18a7951, class org.alfresco.repo.aud
it.model._3.Application=java.lang.ref.WeakReference@22da8f, class org.alfresco.r
epo.audit.model._3.Audit=java.lang.ref.WeakReference@3af3cb, class org.alfresco.
repo.audit.model._3.DataGenerator=java.lang.ref.WeakReference@5ba3ee, class org.
alfresco.repo.audit.model._3.AuditPath=java.lang.ref.WeakReference@67770f, class
org.alfresco.repo.audit.model._3.PathMappings=java.lang.ref.WeakReference@b9a30
6, class java.util.ArrayList=java.lang.ref.WeakReference@17dfc02, class org.alfr
esco.repo.audit.model._3.GenerateValue=java.lang.ref.WeakReference@2bf982, class
org.alfresco.repo.audit.model._3.RecordValue=java.lang.ref.WeakReference@109d85
b}]) but failed to remove it when the web application was stopped. To prevent a
memory leak, the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class
reloading, using NOPLoggerRepository.
Jul 15, 2010 10:21:05 AM org.apache.catalina.startup.HostConfig deployDescriptor

INFO: Deploying configuration descriptor host-manager.xml
Jul 15, 2010 10:21:05 AM org.apache.catalina.startup.HostConfig deployDescriptor

INFO: Deploying configuration descriptor manager.xml
Jul 15, 2010 10:21:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive share.war
10:21:14,371  INFO  [extensions.webscripts.DeclarativeRegistry] Registered 231 W
eb Scripts (+0 failed), 239 URLs
10:21:14,371  INFO  [extensions.webscripts.DeclarativeRegistry] Registered 8 Pac
kage Description Documents (+0 failed)
10:21:14,371  INFO  [extensions.webscripts.DeclarativeRegistry] Registered 0 Sch
ema Description Documents (+0 failed)
10:21:14,636  INFO  [extensions.webscripts.AbstractRuntimeContainer] Initialised
Spring Surf Container Web Script Container (in 3728.177ms)
10:21:14,824  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered
template processor freemarker for extension ftl
10:21:15,058  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered s
cript processor javascript for extension js
10:21:15,183  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered
template processor freemarker for extension ftl
10:21:15,199  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered s
cript processor javascript for extension js
10:21:15,340  INFO  [extensions.webscripts.TemplateProcessorRegistry] Registered
template processor freemarker for extension ftl
10:21:15,340  INFO  [extensions.webscripts.ScriptProcessorRegistry] Registered s
cript processor javascript for extension js
Jul 15, 2010 10:21:17 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Jul 15, 2010 10:21:17 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Jul 15, 2010 10:21:17 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Jul 15, 2010 10:21:17 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 15, 2010 10:21:17 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 15, 2010 10:21:17 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15  config=null
Jul 15, 2010 10:21:17 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 49940 ms

I have a feeling I should not be copying JAR files into 'shared\lib' folder, somehow Alfresco should be using all the needed JARs from:

<Tomcat_Home>\webapps\alfresco\WEB-INF\lib

Any ideas? Could this be a Tomcat configuration issue? I am using Tomcat 6.0.26 and here is  my <Tomcat_home>\conf\catalina.properties:

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageDefinition unless the
# corresponding RuntimePermission ("defineClassInPackage."+package) has
# been granted.
#
# by default, no packages are restricted for definition, and none of
# the class loaders supplied with the JDK call checkPackageDefinition.
#
package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.

#
#
# List of comma-separated paths defining the contents of the "common"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank,the JVM system loader will be used as Catalina's "common"
# loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

#
# List of comma-separated paths defining the contents of the "server"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank, the "common" loader will be used as Catalina's "server"
# loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository
server.loader=

#
# List of comma-separated paths defining the contents of the "shared"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
# the "common" loader will be used as Catalina's "shared" loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

#
# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
#tomcat.util.buf.StringCache.char.enabled=true
#tomcat.util.buf.StringCache.trainThreshold=500000
#tomcat.util.buf.StringCache.cacheSize=5000

I even tried to add /webapps/alfresco/WEB-INF/lib/*.jar to end of the 'shared.loader' path and got last error again. Any suggestions?

Thanks.

gyro_gearless
Champ in-the-making
Champ in-the-making
Hi !

Overall, i suppose putting extension classes in shared/classes is an err unfortunate idea! The reason becomes clear once Tomcats ClassLoader hierarchy and its implications are understood, see http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html for an good explanation.
In short terms: The classloader responsible for shared/classes is parent for the individual webapps classloaders, so all webapps will "see" the classes from shared/classes. But not the other way 'round: A class loaded from the "shared" classloader cannot see any class from a webapp, because these classes are loaded from their very own classloader, which the "shared" classloader has no knowledge of.

So, the preferred way of deploying extension is by usinh AMP modules (which are eventually merged into alfresco.war). However, during development this "Build AMP - Update alfresco.war - Deploy alfresco.war - Restart Tomcat - Wait till Tomcat has redeployed alfresco.war" is way to slow, so i use a much simpler approach:

  • Start Alfresco once

  • Delete all .war files from tomcat/webapps/ folder

  • Delete all unnecessary webapps from tomcat/webapps/ folder (usually i only leave alfreso/ folder)

  • Deploy your extensions right into to tomcat/webapps/alfresco/WEB-INF/classes/….
ANd when your development is done, you may still pack your extensions in an AMP file…  :roll:
Cheers
Gyro

chandu7ee
Champ in-the-making
Champ in-the-making
Hi kooroshv,

    Make sure  the Spring Framework configuration for registering your Web script Java class.using below code, if you directly copied the code (from e-book)it will give some syntax errors., make sure this file should be with out any errors by opening on any browser.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <bean id="webscript.org.example.javadir.get" class="org.example.JavaDir" parent="webscript">
      <property name="repository" ref="repositoryHelper"/>
      <property name="tenantAdminService">
         <ref bean="tenantAdminService" />
      </property>
   </bean>
</beans>

Thanks
Chandu