cancel
Showing results for 
Search instead for 
Did you mean: 

Ant build failed. Tomcat lib directory missing.

sihnu
Champ in-the-making
Champ in-the-making
Hello, I'm new to Alfresco and trying to set up development environment via Eclipse. I'm using Ubuntu 10.10 and I've been following the Alfrsco wiki guide. After I finally got to the point to build Alfresco from Eclipse I get this error:

/home/[user]/workspace/ALFRESCO_SVN/alfresco/HEAD/root/build.xml:574: Directory does not exist: /home/[user]/workspace/ALFRESCO_SVN/alfresco/HEAD/root/${env.TOMCAT_HOME}/lib

The environmet variable is set correctly for TOMCAT_HOME. I've tested it using echo $TOMCAT_HOME but when I go to check the directory there doesn't exist lib directory. I don't know why doesn't it exist and I'm not sure if I should create one or what it should include. I'm using Apache Tomcat Version 5.5.31. Please, could someone help me to solve this problem?

Thanks in advance.
7 REPLIES 7

mrogers
Star Contributor
Star Contributor
I think the tomcat builds expect Tomcat6.

What build target are you using?

However it looks like your environment variables are not expanding correctly.    You need to set TOMCAT_HOME.

That said the differences between Tomcat 5.5 and Tomcat 6 are fairly trivial and will just need a couple of properties changing.

sihnu
Champ in-the-making
Champ in-the-making
Hello, thanks for the answer.

Right, tomcat6 got lib folder in it's root and now I'm using it. In Tomcat5 needed lib folder seems to exist in a different location.

I've set environment variables with these commands:

sudo su
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/
export TOMCAT_HOME=/usr/local/tomcat/
export APP_TOMCAT_HOME=/usr/local/tomcat/
export VIRTUAL_TOMCAT_HOME=/usr/local/virtual-tomcat/

and tested them with ,for example, echo $TOMCAT_HOME. Test works fine but for some reason those environment variables will not stay if I restart Ubuntu.
What do you mean I have to set TOMCAT_HOME? I've followed the wiki instructions and that is the way it tells me how to do.

My build still fails =(

mrogers
Star Contributor
Star Contributor
There's no point in just saying "my build fails"   without specifying details.

I do note that you are using Java 1.5 which won't work with the recent Alfresco code lines.

sihnu
Champ in-the-making
Champ in-the-making
Thanks again for the answer and sorry, I meant the build failed for the same reason as before when I said: "My build still fails".

Here are some more details:

BUILD FAILED
/home/[user]/workspace/ALFRESCO_SVN/alfresco/HEAD/root/build.xml:574: Directory does not exist: /home/[user]/workspace/ALFRESCO_SVN/alfresco/HEAD/root/${env.TOMCAT_HOME}/lib

I've commented the line where the build fails error message is pointing (line 574).


<!– ****************************************************** –>
   <!– **************** Deployment targets ****************** –>
   <!– ****************************************************** –>
  
   <target name="deploy-virtual-tomcat"
           description="Deploys to Virtual Tomcat (the virtualization server)"
           depends="init, clean-virtual-tomcat-deploy">
      <deploy-virtual-tomcat location="${home.tomcat.virtual}" />
   </target>
  
   <target name="-deploy-tomcat-common" depends="init">

      <available file="${home.tomcat}/common/lib" type="dir" property="tomcat5.present" />
     
      <fail if="tomcat5.present" message="Deployment using these scripts requires Tomcat 6." />

      <!– ensure mysql drivers and xalan files are present –>
      <delete>             # this is the line 574 where the error message is pointing
         <fileset dir="${home.tomcat}/lib"              # and I think here is the actual problem
                  includes="mysql-connector*"
                  excludes="${file.name.jar.mysql.connector}" />
      </delete>

      <copy todir="${home.tomcat}/lib"     
            file="${dir.project.3rdparty.lib}/${dir.name.devenv}/${file.name.jar.mysql.connector}" />

      <copy todir="${home.tomcat}/endorsed"
            file="${dir.project.3rdparty.lib}/${dir.name.xalan}/${file.name.jar.xalan}" />

      <copy todir="${home.tomcat}/endorsed"
            file="${dir.project.3rdparty.lib}/${dir.name.xalan}/${file.name.jar.serializer}" />

      <!– enable WCM functionality –>
      <copy todir="${home.tomcat}/shared/classes/alfresco/extension"
            file="${dir.project.installer}/wcm-bootstrap-context.xml" />
   </target>

I'm using JAVA 1.6 now and the build fails for the same reason as stated above. To me it looks like there is still something wrong with my TOMCAT_HOME environment variable. For some reason deploying Tomcat Virtual Server seems to "build" fine. I've noticed that other people have stumbled on the same problem while I've been browsing the forums but I've not found any answer.
For example here is part from a tutorial I found from the forums:

You should now see a link to build.xml in your Ant project. Double-click the file to see the contents. Eclipse also has several options to allow you to run targets in the file.
One way is to use the Outline window as it shows you all the targets in the project. Find the target you want to run and right click. Choose Run As > Ant build.
If you get errors because the environment variables, like TOMCAT_HOME, are not defined, then you can define them via Window > Preferences > Ant > Runtime > Properties and add env.TOMCAT_HOME

I've tried to define them but not sure if I'm doing it right. I would need more details about that.

I wish I could give more details but that's all I can tell now.

EDIT: I got it working now! There were missing configurations for ant in Eclipse. I added environment variables to Ant > Runtime > Properties and after that the build was successful. I can also login to Alfresco site. So in case anyone else stumbles to the same problem here is the fix:

Configure Ant

In the Eclipse toolbar select Window > Preferences > Ant > Runtime > Properties

By clicking the "Add Property…" button add the following names / values:
env.TOMCAT_HOME = /usr/local/tomcat/
env.APP_TOMCAT_HOME = /usr/local/tomcat/
env.VIRTUAL_TOMCAT_HOME = /usr/local/virtual-tomcat/

It is in the wiki I just missed that and I'm sorry about that. The bad was all mine. Anyway, I can now go forward and finally get into extending Alfresco Smiley Happy

jaja
Champ in-the-making
Champ in-the-making
Hi,
I have a problem when lunching build.xml in exlipse;it crashes whenever I click to open this file.When I tried to lunch build from the terminal by typing this lines:
ant incremental-slingshot-tomcat-exploded
ant incremental-webclient-tomcat-exploded
I had a succeful build for slingshot but not for webclient.This is the result of typing ant incremental-webclient-tomcat-exploded :
Buildfile: /home/khaoula/root/build.xml

init:
     [echo] user.home = /root
     [echo] version.number = 4.2.c

compile-core:

package-core:

incremental-core:

compile-datamodel-java:

compile-datamodel-jibx:

compile-datamodel:

package-datamodel:
      [jar] Building jar: /home/khaoula/root/projects/data-model/build/dist/alfresco-data-model-4.2.c.jar

incremental-datamodel:

compile-jlan:

package-jlan:

incremental-jlan:

compile-mbeans:

package-mbeans:

incremental-mbeans:

compile-deployment:

package-deployment-jar:

compile-repository-java:
    [javac] Compiling 2 source files to /home/khaoula/root/projects/repository/build/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] 1 warning

compile-repository-jibx:

compile-repository:

package-repository:
      [jar] Building jar: /home/khaoula/root/projects/repository/build/dist/alfresco-repository-4.2.c.jar

assemble-deployment:
     [copy] Copying 2 files to /home/khaoula/root/projects/deployment/build/assemble

package-deployment-zip:
      [zip] Building zip: /home/khaoula/root/projects/deployment/build/dist/alfresco-community-deployment-4.2.c.zip

package-deployment:

incremental-deployment:

incremental-repository:

compile-wdrdeployment:

package-wdrdeployment-jar:

package-wdrdeployment:

incremental-wdrdeployment:

compile-remoteapi:

package-remoteapi:

incremental-remoteapi:

compile-webframeworkcommons:

package-webframeworkcommons-jar:

package-webframeworkcommons:

incremental-webframeworkcommons:

compile-jndi:

package-jndi:

incremental-jndi:

compile-catalinavirtual:

package-catalinavirtual:

incremental-catalinavirtual:

incremental-webclient-depends:

compile-webclient:

package-webclient-jar:

-deploy-tomcat-common:

BUILD FAILED
/home/khaoula/root/build.xml:542: Directory does not exist: /home/khaoula/root/${env.TOMCAT_HOME}/lib

Thank you for your help

abarisone
Star Contributor
Star Contributor
Hi,
it seems you have the same problem that has been solved in the previous post.
Did you properly set Ant configuration in Eclipse?
<blockquote>
Configure Ant
In the Eclipse toolbar select Window > Preferences > Ant > Runtime > Properties

By clicking the "Add Property…" button add the following names / values:
env.TOMCAT_HOME = /usr/local/tomcat/
env.APP_TOMCAT_HOME = /usr/local/tomcat/
env.VIRTUAL_TOMCAT_HOME = /usr/local/virtual-tomcat/
</blockquote>

Regards,
Andrea

jaja
Champ in-the-making
Champ in-the-making
Thank you Andrea for your reply,but I set very well ant configuration.
In fact,eclipse worked very well for too days.
Best regards,
jaja