Score:0

Liferay 7.4 doesn't start as windows service

ag flag

i already asked in Liferay forum but i didn't get an answer, i was trying to configure a clean Liferay 7.4 portal to start as a service on Windows Server 2022, i followed the same steps used to configure Liferay 6.2.5 and generic Tomcat servers as a service, and while the latters start without problems, Liferay 7.4 won't start showing the following error:

2023-01-18 13:46:05 Apache Commons Daemon procrun stderr initialized.
18-Jan-2023 13:46:06.582 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1057] milliseconds
JVM arguments: -Dcatalina.home=C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68 -Dcatalina.base=C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68 -Dignore.endorsed.dirs=C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68\endorsed -Djava.io.tmpdir=C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68\conf\logging.properties exit abort -Xms128m -Xmx256m
18-Jan-2023 13:46:10.657 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [com.sun.proxy.$Proxy6]
    java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy6.contextInitialized(Unknown Source)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4767)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5231)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:690)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1889)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:583)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.liferay.shielded.container.internal.proxy.ContextClassLoaderInvocationHandler.invoke(ContextClassLoaderInvocationHandler.java:43)
        at com.liferay.shielded.container.internal.proxy.EventListenerInvocationHandler.invoke(EventListenerInvocationHandler.java:64)
        ... 42 more
    Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Error initializing storage.
        at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:248)
        ... 48 more
    Caused by: java.lang.RuntimeException: Error initializing storage.
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:71)
        at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
        at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
        at com.liferay.portal.bootstrap.ModuleFrameworkImpl.initFramework(ModuleFrameworkImpl.java:204)
        at com.liferay.portal.module.framework.ModuleFrameworkUtil.initFramework(ModuleFrameworkUtil.java:37)
        at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:236)
        ... 48 more
    Caused by: java.io.FileNotFoundException: C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\osgi\state\org.eclipse.osgi\.manager\.fileTableLock (Access is denied)
        at java.io.RandomAccessFile.open0(Native Method)
        at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
        at org.eclipse.osgi.internal.location.Locker_JavaNio.lock(Locker_JavaNio.java:36)
        at org.eclipse.osgi.storagemanager.StorageManager.lock(StorageManager.java:388)
        at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:701)
        at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:2011)
        at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:2028)
        at org.eclipse.osgi.storage.Storage.<init>(Storage.java:216)
        at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:151)
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:69)
        ... 53 more
18-Jan-2023 13:46:10.657 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
18-Jan-2023 13:46:10.657 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
null
null
BeanLocator is null
18-Jan-2023 13:46:10.704 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStop Exception sending context destroyed event to listener instance of class [com.sun.proxy.$Proxy6]
    java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy6.contextDestroyed(Unknown Source)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4815)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:690)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1889)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:583)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.liferay.shielded.container.internal.proxy.ContextClassLoaderInvocationHandler.invoke(ContextClassLoaderInvocationHandler.java:43)
        at com.liferay.shielded.container.internal.proxy.EventListenerInvocationHandler.invoke(EventListenerInvocationHandler.java:64)
        ... 43 more
    Caused by: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator is not set
        at com.liferay.portal.kernel.bean.PortalBeanLocatorUtil.locate(PortalBeanLocatorUtil.java:68)
        at com.liferay.portal.spring.context.PortalContextLoaderListener.closeDataSource(PortalContextLoaderListener.java:380)
        at com.liferay.portal.spring.context.PortalContextLoaderListener.contextDestroyed(PortalContextLoaderListener.java:151)
        ... 49 more
18-Jan-2023 13:46:10.751 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [4150] milliseconds

I used this command to install the service:

C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68\bin>service.bat install liferay74_59_clean
Installing the service 'liferay74_59_clean' ...
Using CATALINA_HOME:    "C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68"
Using CATALINA_BASE:    "C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\tomcat-9.0.68"
Using JAVA_HOME:        "C:\Program Files\Java\jdk1.8.0_211"
Using JRE_HOME:         "C:\Program Files\Java\jdk1.8.0_211\jre"
Using JVM:              "C:\Program Files\Java\jdk1.8.0_211\jre\bin\server\jvm.dll"
The service 'liferay74_59_clean' has been installed.

If i try to start the portal with startub.bat in tomcat/bin folder all works without problems, so it's something relative to the launch as windows service.

Anyone have an idea of what's going wrong?

Thanks.

in flag
`Caused by: java.io.FileNotFoundException: C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\osgi\state\org.eclipse.osgi\.manager\.fileTableLock (Access is denied)` My first guess would be a filesystem permission problem.
Score:0
np flag

To run properly, Liferay needs some write permissions on the file system. If you run it (or tomcat) as a windows service, you're typically running under a different user account than you're running interactively. Whichever account it is, that account needs write access to a few directories. I wouldn't claim to be exhaustive, but some of them are, under your ${liferay.home}, which seems to be C:\Portals\liferay-ce-portal-7.4.3.59-ga59_clean\:

  • /deploy
  • /osgi
  • /data
  • /tomcat/temp
  • /tomcat/work
  • /tomcat/logs
  • /logs

Those can be configured to be elsewhere, but you're looking for these directories to typically be writable. Don't blame me if I missed one...

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.