<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Alfresco class loader can't load classes shared in tomcat in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-class-loader-can-t-load-classes-shared-in-tomcat/m-p/272111#M225241</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a customized alfresco.war deployed in tomcat and I declared some command processor classes that I created. Instead of putting this classes in the alfresco.war, I want to put them in a tomcat repository and let the tomcat "shared class loader" load these classes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I configured the catalina.properties in tomcat by adding this line &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;, and I added the myCommandProcessors.jar in the ${catalina.base}/shared/lib/ repository. There are other jar files in this shared repository as well, like the Oracle jdbc driver, which are loaded well by the tomcat shared class loader. But myCommandProcessors.jar cannot be loaded, why? However, when I put the myCommandProcessors.jar in the ${catalina.base}/webapps/alfresco/WEB-INF/lib/, the myCommandProcessors.jar will be loading good, but that's not where I&amp;nbsp; want to put the the custom jar files to…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I traced the alfresco class load and I found this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;Classloader of command proccessor class:WebappClassLoader&lt;BR /&gt;&amp;nbsp; context: /alfresco&lt;BR /&gt;&amp;nbsp; delegate: false&lt;BR /&gt;&amp;nbsp; repositories:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /WEB-INF/classes/&lt;BR /&gt;———-&amp;gt; Parent Classloader:&lt;BR /&gt;org.apache.catalina.loader.StandardClassLoader@11568fb5&lt;BR /&gt;&lt;BR /&gt;This is the urls of the classloader:&lt;BR /&gt;[file:/home/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/, file:/home/alfresco/tomcat/webapps/alfresco/WEB-INF/lib/FastInfoset-1.2.2.jar, …&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Parent Classloader of command proccessor class:org.apache.catalina.loader.StandardClassLoader@11568fb5&lt;BR /&gt;&lt;BR /&gt;This is the urls of the parent classloader:&lt;BR /&gt;[file:/home/alfresco/tomcat/shared/classes/, file:/home/alfresco/tomcat/shared/lib/ojdbc6.jar]&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Does the line &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;delegate: false&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt; mean that this class loader does not search classes from it's parent class loader (which is the tomcat shared class loader)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Aug 2012 09:57:32 GMT</pubDate>
    <dc:creator>keweishang</dc:creator>
    <dc:date>2012-08-01T09:57:32Z</dc:date>
    <item>
      <title>Alfresco class loader can't load classes shared in tomcat</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-class-loader-can-t-load-classes-shared-in-tomcat/m-p/272111#M225241</link>
      <description>Hello,I have a customized alfresco.war deployed in tomcat and I declared some command processor classes that I created. Instead of putting this classes in the alfresco.war, I want to put them in a tomcat repository and let the tomcat "shared class loader" load these classes. So I configured the cata</description>
      <pubDate>Wed, 01 Aug 2012 09:57:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfresco-class-loader-can-t-load-classes-shared-in-tomcat/m-p/272111#M225241</guid>
      <dc:creator>keweishang</dc:creator>
      <dc:date>2012-08-01T09:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco class loader can't load classes shared in tomcat</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-class-loader-can-t-load-classes-shared-in-tomcat/m-p/272112#M225242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I understand the problem now. The custom classes that I put in the shared repository of tomcat reference the classes in the alfresco.war. While a child class loader can delegate his parent class loader to load class, a parent class loader cannot delegate class loading to his child class loader. That is to say, when tomcat shared loader is loading my custom classes, it cannot get the alfresco classes referenced by my custom classes loaded. So the tomcat shared loader cannot load my custom classes at all. That is the explanation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A workaround is to produce a amp file which contains the customized classes. Then integrated the alfresco.war + amp file by using an alfresco tool to produce a new alfresco.war who contains the customization.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This post has helped me to find the explanation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://forums.alfresco.com/en/viewtopic.php?f=10&amp;amp;t=39109" rel="nofollow noopener noreferrer"&gt;https://forums.alfresco.com/en/viewtopic.php?f=10&amp;amp;t=39109&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 14:19:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfresco-class-loader-can-t-load-classes-shared-in-tomcat/m-p/272112#M225242</guid>
      <dc:creator>keweishang</dc:creator>
      <dc:date>2012-08-01T14:19:38Z</dc:date>
    </item>
  </channel>
</rss>

