掲示板

Running Liferay on Tomcat as a Windows Service

9年前 に Devon Chopp によって更新されました。

Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
I am currently working on a Proof of Concept project for our IT R&D department using Liferay. I have been successful in getting Liferay up and running using the manual process of installing Liferay on a Tomcat instance. My issue comes when I try to create the Liferay/Tomcat instance to run as a Windows service. I would like to get this to work as, if Tomcat or the server itself were to have issues that cause them to stop, the Windows service would then automatically try to restart Tomcat/Liferay. I currently have Liferay starting at start up through task scheduler, but this is just a short term solution. I was just wondering whether anyone else has tried to do this or whether it is even possible?

Thanks,

Devon
thumbnail
9年前 に André Bunse によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

Junior Member 投稿: 65 参加年月日: 14/02/13 最新の投稿
Hello Devon,

"issues that cause them to stop, the Windows service would then automatically try to restart Tomcat/Liferay"

does not sound like a good idea. Perhaps for some issues.

Why do you want that?
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
We are trying to get away from using user accounts on the servers as the account is always logged into the machine to run the program/application. We configure Tomcat to run as a service so that if the Tomcat instance was to go down or failed to start with a reboot of the server, the service will try and restart itself so that we do not manually have to go into the server to start the Tomcat instance. It seems that when I have tried creating the service for Tomcat which in turn is running Liferay the service tends to hose everything up and I end up having to delete the service in order to get Liferay working properly again.
thumbnail
9年前 に Krzysztof Gołębiowski によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

Liferay Master 投稿: 549 参加年月日: 11/06/25 最新の投稿
Hello Devon,
Running Tomcat as a Service is a the proper way to run Liferay on Windows servers. There are many tutorials on the net about this topic, which one did you use? What is exactly your problem?

Regards,
KG
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
I was finally able to install Tomcat as a service on the server and get that up and running to where I can get to the default Tomcat webpage. My issue now is the following:

When I copy the Liferay.war contents into the ROOT folder replacing all of the default Tomcat files (per the instructions located on Liferays website - https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/installing-liferay-on-tomcat-7-liferay-portal-6-2-user-guide-15-en) and I start the service, Liferay never actually starts and I am unable to view the Liferay Portal webpage on the server. Also after I have copied the Liferay.war contents into the ROOT folder this breaks the service and the Tomcat service will not stop cleanly and I get an error saying that the service did not respond or timed out and so therefore it was not able to be stopped. This causes me to have to delete the service, restart the server, and then go back to the drawing board to see what else I could possibly configure in order to get the Liferay webpage to actually start up properly through the Tomcat service.

Sincerely,

Devon
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
Here is what I found in the log file for catalina. It would appear if I am not mistaken that it is getting hung up on the actual deployment of the web application directory as there is nothing after that.

Jun 02, 2014 4:14:24 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.30 using APR version 1.4.8.
Jun 02, 2014 4:14:24 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Jun 02, 2014 4:14:25 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1g 7 Apr 2014)
Jun 02, 2014 4:14:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-80"]
Jun 02, 2014 4:14:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Jun 02, 2014 4:14:26 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3440 ms
Jun 02, 2014 4:14:26 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 02, 2014 4:14:26 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Jun 02, 2014 4:14:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory E:\tomcat7\webapps\docs
Jun 02, 2014 4:14:31 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory E:\tomcat7\webapps\docs has finished in 4,805 ms
Jun 02, 2014 4:14:31 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory E:\tomcat7\webapps\examples
Jun 02, 2014 4:14:34 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory E:\tomcat7\webapps\examples has finished in 2,418 ms
Jun 02, 2014 4:14:34 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory E:\tomcat7\webapps\host-manager
Jun 02, 2014 4:14:35 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory E:\tomcat7\webapps\host-manager has finished in 1,560 ms
Jun 02, 2014 4:14:35 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory E:\tomcat7\webapps\manager
Jun 02, 2014 4:14:36 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory E:\tomcat7\webapps\manager has finished in 1,139 ms
Jun 02, 2014 4:14:36 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory E:\tomcat7\webapps\ROOT
thumbnail
9年前 に Krzysztof Gołębiowski によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

Liferay Master 投稿: 549 参加年月日: 11/06/25 最新の投稿
Why do you want to install Liferay to fresh Tomcat, did you try to install Liferay+Tomcat bundle? On Windows (if I really have to use them), I usually install bundled version, tune it and then configure for windows services.
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
We prefer to use standard Tomcat instances rather than bundled packages as it allows us more control over the Tomcat instance and we have moved to this option as a company default when we are trying out new software. I did as you mentioned try the bundled package which worked fine all the way up to creating the service. The bundle did not have the Tomcat7.exe included in the bundle which you need in order to create a Windows service. I did try downloading a Tomcat package and just copying and pasting the tomcat7.exe into the bundled instance, but it did not seem to like that.
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
If you know or have a link to instructions on how to create a Windows service using the bundled package then I would be more than happy to give it a shot and see if that solves my issues. For all I know it might hold the key as to why my service ends up failing.

Devon
thumbnail
9年前 に Krzysztof Gołębiowski によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

Liferay Master 投稿: 549 参加年月日: 11/06/25 最新の投稿
Hello Devon,
Sorry for late reply. You just have to get missing files from original Tomcat bundle (bin/tomcat7.exe, tomcat7w.exe and service.bat) and go through standard service installation procedure. There are lot of tutorials about that, the one I used recently was https://www.liferay.com/community/wiki/-/wiki/Main/Starting+Liferay+as+a+Windows+Service.

Regards,
KG
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
Ok so after many months of this project being shelved it is now back on the priority list. I still have not been able to get Liferay to run successfully as a service. I have tried this articles solution, https://www.liferay.com/community/wiki/-/wiki/Main/Starting+Liferay+as+a+Windows+Service, but to no avail. Does anyone have any other ideas as to why this will not seem to run as a service. I am using a bundled package to test creating Liferay as a service with, I'd like to just do a manual install of Liferay on Tomcat, but until I figure out this running as a service bit I figure work with something I know works if using the startup.bat file.
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Personally, Devon I recommend a different approach...

Download Tomcat separately from tomcat.apache.org. Use their installer to put tomcat where you want and create the service. Test the service and make sure it starts the way you want...

Once that is working, then install Liferay to that instance. Usually it's just a change to catalina properties, the conf/localhost/ROOT.xml file, additional jars in lib/ext, then copy over all of the webapps from the bundle to new tomcat.

It will save you so much time and obviously some headaches as well trying to get the bundle to work.
thumbnail
9年前 に Bob Ward によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 7 参加年月日: 11/09/21 最新の投稿
We use the steps below on our Windows servers. The key is getting the right files from the standalone Tomcat and copy into the bundle.

After the setup you can access the jvm startup params by right clicking on the .exe and then run as administrator. This gives you access to the java properties dialog and you can set your heap size, etc. .

** Make sure you use the right files for 7.0.42

(1) Download http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.25/bin/apache-tomcat-7.0.25-windows-x64.zip (as this server is a 64-bit server) and extract it at some temporary location.
(2) Copy tomcat7.exe, tomcat7w.exe and service.bat file from apache-tomcat-7.0.25\bin directory and paste it in bin folder of your installed Liferay instance (C:\liferay-6.1\liferay-portal-6.1.10-ee-ga1\tomcat-7.0.25\bin).
(3) Rename tomcat7w.exe to liferayw.exe.
(4) Now go to command prompt and change directory to bin folder of your liferay instance (C:\liferay-6.1\liferay-portal-6.1.10-ee-ga1\tomcat-7.0.25\bin) .
(5) Give below command to install Liferay as windows service.
service.bat install Liferay

This will create “Apache Tomcat Liferay” service in Windows. You can set it’s startup type “Automatic” if you want to run at window’s startup. Right now I have kept it as manual.
9年前 に Devon Chopp によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service (回答)

New Member 投稿: 8 参加年月日: 14/06/02 最新の投稿
I was finally able to get this working as a service. It ended up being that I needed to add in a few lines of options to the java options under the tomcat service configuration gui. Once I did that it started working as a service right away. These ended up being the lines of options I had to add:

-Dfile.encoding=UTF8
-Duser.timezone=GMT
-Djava.security.auth.login.config="%CATALINA_HOME%/conf/jaas.config"
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Weird, because non of those things have anything to do with running as a service...
8年前 に srikanth adde によって更新されました。

RE: Running Liferay on Tomcat as a Windows Service

New Member 投稿: 3 参加年月日: 15/05/06 最新の投稿
Hi All,

I am trying to create windows service for liferay. I got it done by following above steps and it is working fine except for ehcache.
i have 2 nodes with liferay running on it. There are able to communicate each other if i start the tomcat normally but if try and run through service then they are communicating each other.

any pointer here is a great help.

regards
Sri