cancel
Showing results for 
Search instead for 
Did you mean: 

Running Samples from a jar

ryanbobko
Champ in-the-making
Champ in-the-making
Hey Folks,
I'm on a Ubuntu 10.04 system, running Alfresco 3.4.d. I'm trying to jar up the FirstFoundationClient sample into a jar to run outside of Eclipse. (It runs fine inside Eclipse.) It looks like I'm on the right track, but midway through initialization, I get an error message:


[alfresco.config.JndiPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/alfresco-shared.properties]
[alfresco.config.FixedPropertyPlaceholderConfigurer] Loading properties file from class path resource [alfresco/domain/cache-strategies.properties]
Exception in thread "main" org.alfresco.error.AlfrescoRuntimeException: 02080001 File server configuration error, 02080000 Failed to initialize desktop action
<snip>
Caused by: org.alfresco.error.AlfrescoRuntimeException: 02080000 Failed to initialize desktop action
<snip>
Caused by: org.alfresco.filesys.alfresco.DesktopActionException: Unable to resolve drag and drop application as a file, class path resource [alfresco/desktop/Alfresco.exe]
<snip>

I've verified that the alfresco/desktop/Alfresco.exe path is in the jar, though I doubt it does anything on my linux system. Has anyone successfully packaged the samples into a jar? Any ideas how to get this to work, or what part of the config to remove?

Thanks in advance for your help!


By the way, here's a snippet of the build file I'm using:

<path id="classpath">
  <fileset dir="../../lib/server">
    <include name="**/*.jar"/>
  </fileset>
</path>

<pathconvert property="manifestpath" pathsep=" ">
  <path refid="classpath"/>
  <mapper>
    <chainedmapper>
        <flattenmapper/>
        <globmapper from="*.jar" to="lib/*.jar"/>
    </chainedmapper>
  </mapper>
</pathconvert>
  
   <target name="dist" depends="compile">
     <mkdir dir="${dist.dir}"/>
     <mkdir dir="${dist.dir}/lib"/>
     <copy flatten="true" todir="${dist.dir}/lib">
       <fileset dir="../../lib/server" includes="**/*.jar"/>
     </copy>

     <jar destfile="${dist.dir}/sample.jar">
       <fileset  dir="${build.dir}"/>
       <fileset dir="../../lib/server/config" includes="alfresco/**"/>
      
       <manifest>
         <attribute name="Main-Class" value="org.alfresco.sample.FirstFoundationClient"/>
         <attribute name="Class-Path" value="${manifestpath}"/>
       </manifest>
     </jar>
   </target>
1 REPLY 1

ryanbobko
Champ in-the-making
Champ in-the-making
Hey Folks,
In case anyone else tries to do this, the missing step was copying everything from  <SDK dir>/lib/server/config to the jar before running it. I also had to write a file-services-custom.xml file, and update the alfresco/subsystems/fileServers/default/file-servers-context.xml file to eliminate the problem with Alfresco.exe reference. I was not able to write a custom-file-servers-context.xml file as the wiki suggests.

ry