Welcome to Headwind MDM Q&A, where you can ask questions and receive answers from other members of the community.

Please do not post bug reports, missing feature requests, or demo inquiries. If you have such an inquiry, submit a contact form.

0 votes

I’m running into a problem with tomcat9 deploying the hmdm.war now for some reason.

I just wanted to try upgrading to the new version by replacing the old hmdm.war with the new one. Now tomcat always fails to deploy it, giving me an exception in the log.

Strange thing is even when I try using the older version of hmdm (3.20.1) – it still throws the same error. I haven’t changed anything regarding tomcat when I tried the update.

I tried to manually remove the old hmdm folder from the webapps after it failed, but that also didn’t help anything.

Can you please help?

06-Jul-2020 11:16:17.170 INFORMATION [main] com.google.inject.internal.MessageProcessor.visit An exception was caught and reported. Message: java.lang.NullPointerException

java.lang.RuntimeException: java.lang.NullPointerException

at com.hmdm.guice.module.AbstractLiquibaseModule.getConnection(AbstractLiquibaseModule.java:130)

at com.hmdm.guice.module.AbstractLiquibaseModule.configure(AbstractLiquibaseModule.java:70)

at com.google.inject.AbstractModule.configure(AbstractModule.java:61)

at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:344)

at com.google.inject.spi.Elements.getElements(Elements.java:103)

at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)

at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)

at com.google.inject.Guice.createInjector(Guice.java:87)

at com.hmdm.guice.Initializer.getInjector(Initializer.java:67)

at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)

at com.hmdm.guice.Initializer.contextInitialized(Initializer.java:131)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4685)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5146)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)

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:936)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)

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:633)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)

Caused by: java.lang.NullPointerException

at java.base/java.lang.Class.forName0(Native Method)

at java.base/java.lang.Class.forName(Class.java:315)

at com.hmdm.guice.module.AbstractLiquibaseModule.getConnection(AbstractLiquibaseModule.java:122)

... 51 more

by

1 Answer

0 votes

Looks like there's an issue on Tomcat 9: it may remove the configuration on upgrade! It detects the absence of the WAR file (too fast) and decides to "undeploy" the web app and remove the XML configuration.

I would recommend you to back up the configuration when running Headwind MDM on Tomcat 9:

# cp /var/lib/tomcat9/conf/Catalina/localhost/hmdm.xml /var/lib/tomcat9/conf/Catalina/localhost/hmdm.xml.bak

Here is the sample XML configuration file for Headwind MDM:

<?xml version="1.0" encoding="UTF-8"?>

<Context>

    <!-- database configurations -->

    <Parameter name="JDBC.driver"   value="org.postgresql.Driver"/>

    <Parameter name="JDBC.url"      value="jdbc:postgresql://localhost:5432/hmdm"/>

    <Parameter name="JDBC.username" value="hmdm"/>

    <Parameter name="JDBC.password" value="SQLP@SSWORD"/>

    <!-- This directory is used to store uploaded app files, must be accessible for tomcat user -->

    <Parameter name="files.directory" value="/var/lib/tomcat9/work/files"/>

    <!-- URL used to open Headwind MDM control panel -->

    <Parameter name="base.url" value="http://your.host.com/hmdm"/>

    <!-- private / shared; shared can be used only in Enterprise solution -->

    <Parameter name="usage.scenario" value="private" />

    <!-- A shared secret between mobile app and control panel. 

         Don't change this unless you know what you're doing -->

    <Parameter name="hash.secret" value="12345"/>

    <!-- This directory is used to store files by plugins, must be accessible for tomcat user -->

    <Parameter name="plugins.files.directory" value="/var/lib/tomcat9/work/plugins"/>

    <!-- Configuration for logging plugin, do not change this -->

    <Parameter name="plugin.devicelog.persistence.config.class" value="com.hmdm.plugins.devicelog.persistence.postgres.DeviceLogPostgresPersistenceConfiguration"/>

    <!-- Don't change this -->

    <Parameter name="role.orgadmin.id" value="2"/>

    <!-- Swagger Docs UI location -->

    <Parameter name="swagger.host" value="your.host.com"/>

    <Parameter name="swagger.base.path" value="/hmdm/rest"/>

    <Parameter name="initialization.completion.signal.file" value="/var/lib/tomcat9/work/hmdm_install_flag"/>

    <Parameter name="log4j.config" value="file:///var/lib/tomcat9/work/log4j-hmdm.xml"/>

    <Parameter name="aapt.command" value="aapt"/>

    <!-- MQTT notification service parameters -->

    <Parameter name="mqtt.server.uri" value="your.host.com:31000"/>

</Context>

Note: replace your.host.com to your domain name, and update the SQL password (and optionally other parameters). If you had installed Headwind MDM in the root of the domain, remove /hmdm from the URL configuration parameters.

Note: For Tomcat 9, the directory where Headwind MDM stores files, must be /var/lib/tomcat9/work (not /opt/hmdm or something like that, because Tomcat 9 is running in the "sandbox").

by (34.1k points)
...