Wednesday, November 5, 2014

Where to put an enterprise license file for alfresco-maven-sdk

I've been using the alfresco-maven-sdk version 1.1.1 with community alfresco for quite some time.  Recently, I started using it for enterprise version 4.1.4, and tried several ways to install the license file.  My findings are below.

The following did not recognize and install the enterprise license file
  1. Using the tomcat shared extension location:  The alfresco-maven-sdk has embedded tomcat setup, where only the tomcat context.xml file exists under the tomcat folder.  Creating tomcat/shared/classes/extension/license, and saving the license there didn't work.  For example:
  2. ./alfresco-amp
    ./alfresco-amp/pom.xml
    ./alfresco-amp/src
    ./alfresco-amp/tomcat
    ./alfresco-amp/tomcat/context.xml
    ./alfresco-amp/tomcat/shared/classes/extension/lic/<licenseName>.lic



  3. Using the alfresco extension location inside the amp folder structure:  I figure this didn't work because the amp structure gets overlayed during the deployment process and doesn't "stick around" like a regular external tomcat deployment setup.  For example:

  4. D:\workspaces\cherryshoe\alfresco-amp\src\main\amp\config\alfresco\extension\license



  5. alfresco-global.properties dir.license.external with an relative path to the license file:

    • dir.license.external=tomcat
    • dir.license.external=./tomcat
    • dir.license.external=${alfresco.data.location} (this is pointing to alfresco-amp/alf_data_dev as specified in the pom file)
Solution - recognized and installed the license file (renamed license file to .installed and can see in log file)
  1. alfresco-global.properties dir.license.external with explicit path:  For example, putting the license file under the root of the alfresco-amp module.  
    • I had hoped I would find a solution where an explicit path to the license folder location could be avoided.  If I have multiple people on my software team, then each person would need to change this value.

    dir.license.external=D:\workspaces\cherryshoe\alfresco-amp

  2. alfresco-global.properties dir.license.external with explicit path via property replacement:  For example, putting the license file under the root of the alfresco-amp module.  Then adding a new custom property, we'll call it alfresco.license.location in the pom properties, then using property replacement in the alfresco-global.properties file.  
    • This solution is a little better than the one above, since the pom.xml file *will probably* change less than the alfresco-global.properties.

    pom.xml
    <!-- custom to pick up alfresco enterprise license location -->
    <alfresco.license.location>D:\workspaces\cherryshoe-team\alfresco\alfresco-extensions</alfresco.license.location>

    alfresco-global.properties
    # enterprise license location
    dir.license.external=${alfresco.license.location} 

Possible Solutions that I wasn't able to verify
  1. You should also be able to load the license via Share.  Login as administrator, More -> More -> License Descriptor -> Edit -> Click 'Load License' button.
    1. This didn't work for me with Chrome Version 38.0.2125.111 m, Internet Explorer 11.0.9600.17280, or Firefox 33.0.2 (Look at Alfresco 4.1.x supported browsers - http://www.alfresco.com/services/subscription/supported-platforms)
  2. With 4.2 or higher, you should also be able to use the Alfresco Administration Console to upload a license.
Please let me know if you found another way that makes the maven alfresco sdk recognize an enterprise license file.  What questions do you have about this post? Let me know in the comments section below, and I will answer each one.

2 comments:

  1. Hi Judy,

    What happens if you have a property reference with a full path? I don't see that combination.

    Also, can the property come from the alfresco-global.properties, or some properties you control at runtime? Instead of at build time?

    ReplyDelete
  2. Hi Dave,

    Thank you for your suggestion on pulling a property reference with a full path out, that work. I updated the blog with "Solution number 2", which I like better!

    Also, alfresco.war/WEB-INF/classes/alfresco/repository.properties file has the following license properties, which could also work for license placement.

    #Directory to find external license
    dir.license.external=.
    # Spring resource location of external license files
    location.license.external=file://${dir.license.external}/*.lic
    # Spring resource location of embedded license files
    location.license.embedded=/WEB-INF/alfresco/license/*.lic
    # Spring resource location of license files on shared classpath
    location.license.shared=classpath*:/alfresco/extension/license/*.lic

    Thanks,
    Judy

    ReplyDelete

I appreciate your time in leaving a comment!