Search code examples
javawindowsclojureclasspathdatomic

Setting Datomic classpath functions for use by transactor in Windows


I'm trying to set a classpath function to be used by my custom transactor functions as described here: https://docs.datomic.com/on-prem/database-functions.html#classpath-functions

I have set DATOMIC_EXT_CLASSPATH environment variable to path to my .jar file and added :requires to transactor function. Still, when trying to run function I get FileNotFoundException Could not locate some_ns/some_file.clj on classpath error.

I'm using Windows 8, should I be doing some additional steps? Can I see in Datomic transactor's logs that transactor IS using jar file correctly?


Solution

  • As of the latest version (0.9.5786) there is a bug in which DATOMIC_EXT_CLASSPATH is not taken into account in windows scripts. As a workaround I modified bin\classpath.cmd file in Datomic distribution by appending DATOMIC_EXT_CLASSPATH to CP_LIST:

    @echo off
    set CP_LIST=
    
    for %%i in (.\lib\*.jar) do call bin\cpbuild.cmd %%i
    for %%i in (.\*transactor*.jar) do call bin\cpbuild.cmd %%i
    set CP_LIST=bin;resources;%CP_LIST%;%DATOMIC_EXT_CLASSPATH%
    

    With this fix everything works fine