cancel
Showing results for 
Search instead for 
Did you mean: 

Tomcat as a windows service for Alfresco3.3g tomcat bundle

rzs
Champ in-the-making
Champ in-the-making
Hello,

Im using the alfresco tomcat bundle zip file of version 3.3g (alfresco-community-tomcat-3.3g.zip) . I extracted the zip file, set the dir_root, JAVA_HOME and CATALINA_HOME and was able to start alfresco successfully.
However, i want to set tomcat as a windows service, so that it automatically starts when windows boots, but there is no service.bat in alfresco-community-tomcat-3.3g\tomcat\bin.
I tried following instructions given at http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service,but there is no tomcat6.exe either.There is startup.bat,catalina.bat etc.
What steps to follow to install tomcat as a windows service in this case ?

Thank You
11 REPLIES 11

denmills
Champ in-the-making
Champ in-the-making
I noticed too that there were missing files.  What I did was download the latest version of tomcat 6.0.26 from the apache website (I think this is what the 3.3g release is based off of).  I then extracted the zip file and copied the following files into my alfresco installation. and then followed the normal procedure for running tomcat as a windows service:

service.bat
tcnative-1.dll
tomcat6.exe
tomcat6w.exe

rzs
Champ in-the-making
Champ in-the-making
Thanks for the reply denmills. I copied those files from apache-tomcat-6.0.26 folder and copied them to my alfresco-community-tomcat-3.3g\tomcat\bin folder .
I also installed mysql as a service by following instructions given at http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service#Installing_the_MySQL_service.... So,now the MySQL in my alfresco folder is running correctly as a service.
Now, if i run service.bat install to run tomcat as a service, then tomcat gets installed as a service,but http://localhost:8080/alfresco,goes in an indefinite loop. Also, alfresco.log is not created.
If i install tomcat as a service by following steps given at http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service#Installing_the_Alfresco_Tomc...,then the service is added,but trying to start it fails.

Is there any way to fix the issue or did you follow some different steps to deploy alfresco ?

Please help.
Thanks a lot

denmills
Champ in-the-making
Champ in-the-making
The question about the alfresco.log file I believe is an easy one to resolve.  If you didn't modify the user that is running the alfresco/tomcat service, then I believe the log file shows up in your windows or windows\system32 folder.  Do a search for the file and you should find it there.  This is happening becuase you are running the service as an admin user and it puts the file under the windows directory. 
What I did to get around this is modify the log4j.properties file and point my alfresco.log file to the correct folder.   See below for what I modified

E:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\log4j.properties

###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=E:/Alfresco/alfresco.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n


I did have to make some changes to the service.bat file before it started correctly.  There is a section in the alfresco docs that says if you have memory problems to explicity set the jvm options in the service.bat file. Here is what I changed in the service.bat file.  The %EXECUTABLE% section is towads the bottom of the file.


"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-XX:MaxPermSize=128m;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.cconfig.file=%CATALINA_BASE%\conf\logging.properties" –JvmMs 256 –JvmMx 512 –JvmSs=96

The only other change I made was to add a depends statement to the service to make sure that mysql is running before the tomcat service starts.  I added this just before the %EXECUTABLE% section

set PR_DEPENDSON=MySql


Since I set the jvm options in the service.bat file, when you run service.bat you don't specify all the jvm parameters.  What I ran was the following from a command prompt:


service.bat install Alfresco tomcat6 //US//Alfresco



Those are the only changes that I made that should affect this setup.  I have other things setup like single sign on and apache running so I don't have to use port 8080, but that shouldn't cause affect running tomcat as a service.

Dennis

mangar
Star Contributor
Star Contributor
Thank you so much!!! I read the wiki on how to do this and could not figure out why none of the files mentioned were there!

To All: get the tomcat windows 32 bit zip file, the "core" zip file does not have the desired files.

All worked great!

rzs
Champ in-the-making
Champ in-the-making
Thank u sooooooo much denmills, its working now !!! Smiley Happy.I made the changes to service.bat that u suggested and then installed tomcat as a service using "service.bat install Alfresco tomcat6 //US//Alfresco", and it all works now. Thank u again ! Smiley Happy

jmdavid
Champ in-the-making
Champ in-the-making
Hello,

thanks for sharing.

I did all recommendations, added additional tomcat files, made changes in service.bat:

set PR_DEPENDSON=MySql
rem Set extra parameters
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" –StartMode jvm –StopMode jvm
rem More extra parameters
set "PR_LOGPATH=%CATALINA_BASE%\logs"
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp"
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties"
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-XX:MaxPermSize=128m"
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions –JvmMs 256 –JvmMx 512 –JvmSs=96
but when I start the service, it fails and I get this in event log:
"The Apache Tomcat Alfresco service terminated with service-specific error 0 (0x0)."

Configuration: Windows 2008 SP2 64 bits, 8GB RAM, Alfresco 3.3g full install (not bundled).

Please help.

jmdavid
Champ in-the-making
Champ in-the-making
RESOLVED.  I used 64 bits versions of exe and it works now.

Thanks again.

hvirik01
Champ in-the-making
Champ in-the-making
HI all, sorry to open this up again.

I tried all of the above to get Alfresco working as a Window Service.
I am running Windows 2003 SBS.
I have Alfresco Community Edition 3.3 Installed 32Bit.

I have tried the following:

1) http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service
Then after reading more post that it was easier to do http://forums.alfresco.com/en/viewtopic.php?f=8&t=27723 from the post made by denmills.
This seem to be fine for TomCat

2) http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service#Installing_the_MySQL_service....
by rzs

When i run the AlfrescoMySql i get the following error message:
Could not start the AlfrescoMySql service on local computer. Error 1067: The process terminated unexpectedly.

I followed posts made by rzs and from the other members who have posted and still not sure why it ain't working…

mangar
Star Contributor
Star Contributor
One thing I found was setting my -Xmx and -Xms settings for that service really low, just to get it started - then bump it up as high as I can. I found if it's too high, the service will not start. So try that, if not, it's something else….