cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 3 Tomcat 6 Windows Service

dlsap
Champ in-the-making
Champ in-the-making
Hi.  I have installed the Alfresco 3 Evaluation version on a Windows 2003 Server machine and am wondering how to run the Alfresco Server as a Windows Service?  I have followed the following Wiki for Tomcat 5

http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service

and am not getting the service to work.  It starts, then stops after a few seconds. 

Is tomcat 6 and alfresco 3 have different steps to run the Alfresco Server as a Windows Service then the wiki link above? 

any help would be great.  Thanks
9 REPLIES 9

neorainbow
Champ in-the-making
Champ in-the-making
Hi, I have exactly the same problem and also need a solution for installing Alfresco 3.0.1 as windows service.

OS: Windows Server 2003 Standard SP 2 German as VM on ESX 3.5
Alfresco Enterprise 3.0.1 Full-Setup without MySQL.

Has someone already got an answer to this or could Alfresco please update the wiki and/or the installation manual?
Thanks.

mrose24
Champ in-the-making
Champ in-the-making
I am also having an issue getting Tomcat 6 to work as a Windows Service for Alfresco Labs 3.0 Stable.  I have installed Alfresco Labs 3.0 Stable and can get it to launch using the "Start Alfresco Server"; however, when I follow the wiki (replacing tomcat5.exe with tomcat6.exe) to make it a Windows Service I am unable to get the service to start and it gives me the following error in the Event Log:

The Apache Tomcat alfresco service terminated with service-specific error 0 (0x0).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Any help would be greatly appreciated.  I have tried just about everything that I can find utilizing Google, but unfortunately there is no sure-fire way to get it working that I have found yet.

-Matt

luaspassenger
Champ in-the-making
Champ in-the-making
Hello,

I also faced this exact same issue. There is no documentation on using Alfresco 3 + Tomcat 6 as a Windows Service.

My issue can be described as follows: while I can run alf_start.bat with no problems, I cannot get Alfresco 3 + Tomcat 6 to work as a Windows Service.

I'm using a workaround I'm not entirely satisfied with, but it works. The workaround consists in using the SRVANY tool available with the Windows 2003 Resource Kit (which you can download from Microsoft). The SRVANY tool allows you to use the alf_start.bat file as a Windows Service.

I got the inspiration from this thread: http://forums.alfresco.com/en/viewtopic.php?t=4071
And this article: http://www.tacktech.com/display.cfm?ttid=197

And this is what I did:

1. Download the Windows Resource Kit from Microsoft. Install the kit.
2. Optional step: copy the INSTSRV.EXE and SRVANY.EXE files to a folder like (c:\reskit)
3. At the command prompt, run this command:
c:\reskit\INSTSRV.EXE "MyAlfresco" c:\reskit\SRVANY.EXE
This creates the service in the Services manager and the registry keys to setup what program to run.
4. Then open regedit.exe (Start -> Run -> regedit.exe)
5. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyAlfresco
6. Create a key called Parameters
7. Create a value inside this key called Application (string type). Assign this value: c:\alfresco\alf_start.bat (the full path)
8. Create another value called AppDirectory. Set this value to: c:\alfresco (this is the working directory).
9. Open the Services console (Start -> Administrative Tools -> Services) and look for MyAlfresco.
10. Right click on it and select Properties.
11. On the Log On tab, specify an account that has access to your database server (I use SQL Server).
12. Click Apply and Start the service.

This did the trick for me. Check your alfresco.log file for errors and status.


—-

Also, I wanted to tell you what I tried before that didn't work. This should be the correct solution, but it just doesn't work. I don't know why.

First I followed the steps outlined in http://wiki.alfresco.com/wiki/Configuring_Alfresco_as_a_Windows_Service
I just used tomcat6.exe instead of tomcat5.exe (obviously).

Then I performed these steps:
cd c:\alfresco\tomcat\bin
tomcat6w.exe //ES//alfresco
On the Java tab:
Point the Java Virtual Machine to C:\Alfresco\jdk\jre\bin\client\jvm.dll
and the Java classpath to C:\Alfresco\jdk\lib\tools.jar;C:\Alfresco\tomcat\bin\bootstrap.jar
On the Startup and Shutdown tabs I made sure the Working Path was set to c:\alfresco

When I started the Windows Service I got these errors in alfresco.log:
14:24:14,875 ERROR [org.alfresco.config.BaseConfigService] Input stream invalid - skipped for source: classpath:alfresco/web-framework-config-commons.xml'
org.alfresco.config.ConfigException: Failed to parse config stream
   at org.alfresco.config.xml.XMLConfigService.parse(XMLConfigService.java:177)
   at org.alfresco.config.BaseConfigService.appendConfig(BaseConfigService.java:255)
[…]
Caused by: org.dom4j.InvalidXPathException: Invalid XPath expression: './edit-form|./view-form|./create-form'. Caused by: PermGen space
   at org.dom4j.xpath.DefaultXPath.parse(DefaultXPath.java:362)
   at org.dom4j.xpath.DefaultXPath.<init>(DefaultXPath.java:59)
[…]
14:24:16,250 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webscripts.container' defined in class path resource [alfresco/webscript-framework-application-context.xml]: Cannot create inner bean 'org.alfresco.web.scripts.atom.AtomService#13fd435' of type [org.alfresco.web.scripts.atom.AtomService] while setting bean property 'scriptObjects' with key [TypedStringValue: value [atom], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.alfresco.web.scripts.atom.AtomService#13fd435' defined in class path resource [alfresco/webscript-framework-application-context.xml]: Cannot resolve reference to bean 'webscripts.abdera' while setting bean property 'abderaService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webscripts.abdera' defined in class path resource [alfresco/webscript-framework-application-context.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: PermGen space
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.alfresco.web.scripts.atom.AtomService#13fd435' defined in class path resource [alfresco/webscript-framework-application-context.xml]: Cannot resolve reference to bean 'webscripts.abdera' while setting bean property 'abderaService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webscripts.abdera' defined in class path resource [alfresco/webscript-framework-application-context.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: PermGen space
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webscripts.abdera' defined in class path resource [alfresco/webscript-framework-application-context.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: PermGen space
Caused by: java.lang.OutOfMemoryError: PermGen space
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

There are some weird out of memory errors there. However, when I was running the batch file, I didn't get any memory problems. I tried increasing the memory available to the service, but that didn't work.

Anyway, for now the SRVANY workaround is working fine for me. But I don't think that's the ideal solution.

Thanks,
LP

mikeh
Star Contributor
Star Contributor
The "PermGen space" problem is a common one, solved previously on these forums.

Mike

helper1000
Champ in-the-making
Champ in-the-making
Thanks : LuasPassenger

The service seems starting OK using services, but when I stopped it the java process still running in the task manager.  Any ideas?

louisb
Champ in-the-making
Champ in-the-making
Hello,

I am running VISTA64 here and installed Alfresco3 to get un impression.

Must say that the package is *not* running smooth. I traced down to at least two issues:
1) Tomcat <> Alfresco
2) TomCat <> Java Permgen error

Seeing that I tried to install the latest Tomcat version, but even that did not work / made things worse.

From this experience a few remarks:
- Tomcat should be installed *before* and idependend form Alfresco is installed in its own directory, and definitly not in an Alfresco subdirectory
- During this tomcat install %Catarina_Home% schould be created
- needed tomcat / java code should be installed in an Alfesco subdirectory
- You should have the option to have tomcat running as a service
- this will affect ALF_START.bat and ALF_STOP.bat those  which should start Alfresco NOT Tomcat
- Java code creating the Permgen error should be fixed !!
- Java settings related to memory allocation and memmory clean up mechanismes should be changed to "temporarely bypass" the permgen error
- Of course the preferable Tomcat version is 6020 not 6018

I hope that the development team agrees, and make the suggested changes.

Sincerely,


Louis

compaqnx7300
Champ in-the-making
Champ in-the-making
Is it possible to access log messages (visible in tomcat console window) when Alfresco is started as windows service?
c:\alfresco\alfresco.log file is not enough because does not contain user information…
Is it possible to turn on user information in alfresco.log file?

angrydot
Champ in-the-making
Champ in-the-making
A look into the C:\Alfresco\tomcat\logs\jakarta_service_yyyymmdd.log showed these errors upon startup of the Tomcat Windows service:
[2010-12-08 15:33:38] [info] Commons Daemon procrun (1.0.2.0) started
[2010-12-08 15:33:38] [info] Running Service…
[2010-12-08 15:33:38] [info] Starting service…
[2010-12-08 15:33:39] [info] Error occurred during initialization of VM
[2010-12-08 15:33:39] [info] Could not reserve enough space for object heap

So i used the following command to open the Tomcat Service GUI:
C:\Alfresco\tomcat\bin\timcat6w //ES//AlfrescoTomcat

And on the Java tab, reduced the Java heap size from "-Xmx768M" to "-Xmx128M".

The alfrescoTomcat Windows service now starts fine.

I installed Afresco Community edition 3.6 on Windows XP with 2GB RAM for evaluation.

darryl_staflund
Champ in-the-making
Champ in-the-making
Hi there,

I am going to describe how I got it working on Windows XP 32-bit as I encountered a lot of problems – in the form of a mail-out I send to some team members on the topic.  BTW, The Alfresco Tomcat WAR is once again available as a download for Alfresco Enterprise 3.3.4!

Darryl

—> snip <—

Hi everyone,

As you probably know, Windows Community releases after 3.4 and Windows Enterprise releases after 3.3.3 are now installed a Windows services.  So, unless you've worked with Windows-service-based Tomcat instances, you might not know how to run and debug Alfresco in these instances.  Here's what works for me:


a.  How to start of an Alfresco service install on a 32-bit environment (XP)
—————————————————————————-
Some of us here at AU have not been able to start Alfresco out-of-the-box on 32-bit XP systems – we keep getting OutOfMemory heap or perm-gen errors.  So fix them, try the following:

1.  Install Alfresco using default settings.
2.  Open a command-prompt.
3.  Go to c:\alfresco\tomcat\bin.
4.  Type 'tomcat6w.exe //ES//alfrescoTomcat' (to edit the settings of this service)
5.  Go to 'Java' tab of the resulting dialog box.
6.  Replace default Java options with the following:

-Xms512M
-Xmx768M
-Dalfresco.home=@@BITROCK_INSTALLDIR@@
-Dcom.sun.management.jmxremote
-Dcatalina.base=C:\Alfresco/tomcat
-Dcatalina.home=C:\Alfresco/tomcat
-Djava.endorsed.dirs=C:\Alfresco/tomcat\endorsed
-XX:MaxPermSize=256m


b.  How to debug Alfresco service installs remotely in Eclipse
————————————————————–
In UNIX, as well as older, versions of Alfresco, you can remotely debug your applications by starting up Tomcat using the:

    catalina jpda start

command and settings a number of environment variables.  This doesn't work in Windows service-based Tomcat installs, however, since the service acts as a proxy and maintains its own property values.

In order to enable remote debugging in an Alfresco 3.3.3.7 instance which is installed as a Windows service, you need to do the following:

1.  Open a command shell.
2.  Go to 'c:\alfresco\tomcat\bin'
3.  Type 'tomcat6w.exe //ES//alfrescoTomcat'.
4.  Go to 'Java' tab of resulting dialog box.
5.  Add the following values to the end of the 'Java Options' text area:

    -Xdebug
    -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

6.  Restart Tomcat by typing the following:

    > c:\alfresco\servicerun.bat STOP
    > c:\alfresco\servicerun.bat START

That's it.  You will now be able to remotely debug your applications from within Eclipse.

Darryl