Install Extension without a Compile - Plugin

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



InstallationPackaging
If you just want to try this extension out without compiling follow the instructions on this page.  Note that these instructions are going to vary from application server to application server implementation. 

Also, not that installing extensions in this way is only intended to allow you to try the extension in a non-intrusive way.  It is not the official mechanism or approach for deploying alfresco extensions. (I don't know what the official approach is, if you do, lets get this section up to date).




Tomcat


  • Install the Alfesco WAR
  • Start the application up without error - establish a known good state
  • Place the extension jar in the tomcat lib exploded folder of the alfresco WAR folder
  • Place the JCR-RMI jar (JackRabit) in the tomcat lib exploded folder of the alfresco WAR folder
  • Place the contents of the config folder in the tomcat classes exploded folder of the alfresco WAR folder
  • Configure the following file WEB-INF\classes\alfresco\extension\jcr-rmi.properties
  • Start RMI Registry (Default port will be 1099)
  • Start Tomcat

At this point you should be able to start another application in tomcat, another tomcat process all together, or any other RMI enabled application and get a remote reference to the Alfresco backed JCR repository you just started up.



Note: I originally intended to deploy the extension outside of the exploded WAR in the common folder of Tomcat allowing users to test the extension without compiling or tampering with the exploded war.  I turns out Spring seems to have trouble with the various class loaders which give some interesting results (interesting in a bad sense).
Its not a configuration I would recommend going live with anyway  but would have provided a way to deploy the application with a degree of separation.


Concrete Example


  • Download extension-jcr-rmi-1.0.0-src.zip from http://forge.alfresco.com/projects/jcr-rmi/ and unzip
  • Install AlFresco into a directory without spaces in its filename, eg: C:\AlFresco (NB: don't use the default suggested ie: 'c:\Program Files\...')
  • Start AlFresco so the WAR file is exploded into place
  • Stop AlFresco
  • Copy extension-jcr-rmi\lib\jcr-rmi-1-impl-classes.jar and extension-jcr-rmi\build\dist\extension-jcr-rmi.jar into $TOMCAT\webapps\alfresco\WEB-INF\lib
  • Copy the contents of extension-jcr-rmi\config\alfresco\extension into $TOMCAT\webapps\alfresco\WEB-INF\classes\alfresco\extension
  • Remove/Comment-out the line
<import resource='classpath:alfresco/jcr-context.xml' />

from $TOMCAT\webapps\alfresco\WEB-INF\classes\alfresco\extension\jcr-rmi-context.xml


  • Edit jcr-rmi.properties as required to set the port the RMI registry is running on.
  • Start an RMI Registry
  • Restart AlFresco

You can test the JCR-RMI connection thusly



JCR RMI Test

RMI Registery Server Name :localhost
RMI Registery Server Name :localhost
Remote JCR reference binding name:javaContentRepository

Connection String://localhost:1099/javaContentRepository

Testing...

looking up remote reference at //localhost:1099/javaContentRepository
creating local adapter for remotereference [ServerRepository_Stub[UnicastRef [liveRef: [endpoint:[10.84.49.66:3263](remote),objID:[0]]]]]
logging in as admin admin to default workspace
looking up workspace root node
root node UUID [33368539-b771-11db-bd11-8b696c27d61b]
logging out

Gotchas


Some error messages, and what they might mean ...



11:55:50,866 ERROR [jcr.repository.JcrRmiBindingUtil] 'error occured while binding JCR to RMI [java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
        java.net.MalformedURLException: no protocol: Files/Alfresco]

... is indicative of installation of AlFresco into a directory with spaces in its name.



INFO: Deploying web application archive alfresco.war
17:08:30,735 ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Cannot register alias 'NamespaceService' for bean name 'namespaceService': it's already registered for bean name 'namespaceService'
at org.springframework.beans.factory.support.AbstractBeanFactory.registerAlias(AbstractBeanFactory.java:461)
at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitions(DefaultXmlBeanDefinitionParser.java:303)

... indicates a cyclic dependancy within the Spring configuration - you forgot to remove <import resource='classpath:alfresco/jcr-context.xml' /> from jcr-rmi-context.xml



01:27:36,970 ERROR [org.alfresco.jcr.repository.JcrRmiBindingUtil] 'error occured while binding JCR to RMI [java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
        java.net.ConnectException: Connection refused]

... indicates that there is a problem contacting the rmiregistry. Check that the rmiregisty is running on the specified port. Also make sure you've properly configured any firewalls.

Attachments

    Outcomes