执行startup.bat 时可以正常运行门户。但是当我尝试将它作为服务运行时,请按照此处答案之一中的步骤操作:将 Liferay 作为 Windows 2012R2 服务安装我收到 java.lang.NullPointerException 错误我使用的是 tomcat 9 而不是 7(如链接中所示)
tomcat9w.exe 中的 Java 设置如下
Java虚拟机:
C:\Program Files\Java\jdk1.8.0_181\jre\bin\server\jvm.dll
Java类路径:
D:\liferay-dxp-7.1.10-ga1\tomcat-9.0.6\bin\bootstrap.jar;D:\liferay-dxp-7.1.10-ga1\tomcat-9.0.6\bin\tomcat-juli.jar
Java 选项:
-Dcatalina.home=D:\liferay-dxp-7.1.10-ga1\tomcat-9.0.6
-Dcatalina.base=D:\liferay-dxp-7.1.10-ga1\tomcat-9.0.6
-Djava.io.tmpdir=D:\liferay-dxp-7.1.10-ga1\tomcat-9.0.6\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=D:\liferay-dxp-7.1.10-ga1\tomcat-9.0.6\conf\logging.properties
-Dfile.encoding=UTF8
-Djava.net.preferIPv4Stack=true
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
-Duser.timezone=GMT
-Xms512m
-Xmx10240m
-XX:MaxPermSize=16384m
-XX:MaxMetaspaceSize=16384m
Java 9 选项
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
初始内存池:10240 MB
最大内存池:24000 MB
线程堆栈大小:512 KB
Liferay 日志文件中的条目
2019-02-12 03:55:26.465 INFO [main][HikariDataSource:95] HikariPool-1 - Starting...
2019-02-12 03:55:27.558 INFO [main][HikariDataSource:107] HikariPool-1 - Start completed.
2019-02-12 03:55:27.574 INFO [main][DialectDetector:77] Determine dialect for Microsoft SQL Server 13.0
2019-02-12 03:55:28.011 INFO [main][DialectDetector:155] Found dialect org.hibernate.dialect.SQLServerDialect
2019-02-12 03:55:31.621 INFO [main][HikariDataSource:95] HikariPool-2 - Starting...
2019-02-12 03:55:31.652 INFO [main][HikariDataSource:107] HikariPool-2 - Start completed.
2019-02-12 03:55:32.574 INFO [main][BundleStartStopLogger:35] STARTED org.eclipse.osgi_3.10.200.v20150831-0856 [0]
2019-02-12 03:55:32.761 INFO [Start Level: Equinox Container: d09fc806-7a2e-0019-1de8-abaf0d99730c][BundleStartStopLogger:35] STARTED com.liferay.util.taglib_3.1.3 [2]
....<i truncated because too long>...
com.liferay.portal.social.activity.extender_1.0.1 [48]
2019-02-12 03:55:36.793 INFO [Start Level: Equinox Container: d09fc806-7a2e-0019-1de8-abaf0d99730c][DefaultLPKGDeployer:307] Start refreshing uninstalled orphan bundles
2019-02-12 03:55:36.793 INFO [Start Level: Equinox Container: d09fc806-7a2e-0019-1de8-abaf0d99730c][DefaultLPKGDeployer:315] Finished refreshing uninstalled orphan bundles
2019-02-12 03:55:38.308 INFO [Start Level: Equinox Container: d09fc806-7a2e-0019-1de8-abaf0d99730c][BundleStartStopLogger:35] STARTED com.liferay.portal.target.platform.indexer.impl_1.0.1 [49]
2019-02-12 03:55:38.324 INFO [Start Level: Equinox Container: d09fc806-7a2e-0019-1de8-abaf0d99730c][BundleStartStopLogger:35] STARTED org.apache.felix.dependencymanager.shell_3.2.0 [50]
2019-02-12 03:55:38.590 ERROR [main][PortalContextLoaderListener:114] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.kernel.servlet.DirectServletRegistryUtil.clearServlets(DirectServletRegistryUtil.java:27)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextDestroyed(PortalContextLoaderListener.java:135)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4626)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5263)
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:742)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1840)
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:525)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:424)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1586)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
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:943)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
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:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
2019-02-12 03:55:38.605 ERROR [main][PortalContextLoaderListener:114] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.reset(HotDeployUtil.java:53)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextDestroyed(PortalContextLoaderListener.java:142)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4626)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5263)
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:742)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1840)
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:525)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:424)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1586)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
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:943)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
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:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
2019-02-12 03:55:38.605 ERROR [main][PortalBeanLocatorUtil:109] BeanLocator is null
来自 tomcat stderr 文件的条目在这里:https ://pastebin.com/TjgAjubq