Windows Service created with apache commons not starting correctly and errors with path to jvm.dll not found - windows

I am running a java program as a windows service on windows server 2019 build 1809.
I am using apache commons procrun to create a windows service.
This is my configuration to start a service
"C:\Users\Public\agent\commons-daemon-1.2.1-bin-windows\amd64\prunsrv.exe" //IS//ic^
--DisplayName "Agent"^ --Description "This is a Agent Windows Service."^
--Startup=auto^
--Install="C:\Users\Public\agent\commons-daemon-1.2.1-bin-windows\amd64\prunsrv.exe"^
--Jvm="C:\Users\Public\agent\jre\bin\server\jvm.dll"^
--Classpath "C:\Users\Public\agent\agent-jar-with-dependencies.jar"^
++Environment="PATH='C:\Windows\system32';'C:\Users\Public\agent\jre\bin'"^
--JavaHome="C:\Users\Public\agent\jre"^
--StartPath=C:\Users\Public\agent\^
--StartMode=jvm^
--StartClass=com.agent.int.Runner^
--StdOutput=C:\Users\Public\agent\service-stdout.log^
--StdError=C:\Users\Public\agent\service-stderr.log
When i start the service, it fails with below error
2020-06-26 07:27:52 Apache Commons Daemon procrun stderr initialized.
[2020-06-26 07:27:52] [error] [5716] Failed creating Java 'C:\Users\Public\agent\jre\bin\server\jvm.dll'.
[2020-06-26 07:27:52] [error] [ 5716] The specified module could not be found.
[2020-06-26 07:27:52] [error] [ 5716] ServiceStart returned 1.
[2020-06-26 07:27:52] [error] [ 5716] The specified module could not be found.
Note - jvm.dll has correct path in configuration and in error log as well.
My configurations
apache commons procrun is 64 bit
JRE which i am supplying is also 64 bit
Windows server is also 64 bit
Let me know if any other details required
Thanks in advance.

I was not able to find root cause of the issue.
The way i solved the issue is i changed StartMode from jvm to Java.
--StartMode=Java
It worked on Windows 2016 Server, Windows 2019 Server and Windows 10 workstation.
Let me know if anyone has a reason for why it didn't work with jvm option.

We faced a similar issue lately and the root cause seemed to be a missing or too old installation of the Microsoft Visual C++ Redistributable package:
https://support.microsoft.com/de-de/help/2977003/the-latest-supported-visual-c-downloads
After installation/update of the package services could be started with --StartMode=Jvm again.

Related

"Failed creating Java" when using Windows Services to start Cassandra

I have had Cassandra 3.11.1 up and running correctly with no Java issues. I've been trying to set it up as a service using Apache Commons Daemon as recommended in the install guide. I was able to install it as a service, but when I attempt to start the service through Windows Services Manager it fails. The log reads:
Commons Daemon procrun (64-bit) started
Running 'cassandra' service...
Starting Service...
Failed creating Java
ServiceStart returned 1
Run Service finished.
Through cassandra config I am pointing to the 64 bit daemon prunsrv application.
Since cassandra seems to be working perfectly on its own it seems like it's a problem with prunsrv, but I have no idea how to track that down. I've seen similar problems, but it always seems to be a 32 vs 64 bit issue or the wrong environment paths for cassandra. Those seem fine for me.
Thank you!

Jmeter perfmon :EXCEPTION_ACCESS_VIOLATION

I am trying to run a performance test of my server using jmeter perfmon plugin. But I am getting an error as in the following image. I have searched a lot for a solution but couldn't find an answer. I tried setting JVM arguments but it didn't work. Link to error image.How can I get it worked?
INFO 2019-12-30 14:11:25.114 [kg.apc.p] (): Binding UDP to 4444
INFO 2019-12-30 14:11:25.155 [kg.apc.p] (): Binding TCP to 4444
INFO 2019-12-30 14:11:25.161 [kg.apc.p] (): JP#GC Agent v2.2.3 started
INFO 2019-12-30 14:11:37.974 [kg.apc.p] (): Accepting new TCP connection
INFO 2019-12-30 14:11:37.978 [kg.apc.p] (): Yep, we received the 'test' command
INFO 2019-12-30 14:11:37.979 [kg.apc.p] (): Starting measures: memory: cpu:
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000010014ed4, pid=12236, tid=6844
JRE version: Java(TM) SE Runtime Environment (11.0.4+10) (build 11.0.4+10-LTS)
Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.4+10-LTS, mixed mode, tiered, compressed oops, g1
gc, windows-amd64)
Problematic frame:
C [sigar-amd64-winnt.dll+0x14ed4]
No core dump will be written. Minidumps are not enabled by default on client versions of Windows
An error report file with more information is saved as:
E:\\hs_err_pid12236.log
If you would like to submit a bug report, please visit:
http://bugreport.java.com/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
I downloaded another sigar 1.6.4 jar (1.6.4.129 (17.1.2016) release) from below link and replaced sigar jar with this in specific tool lib path (ServerAgent-2.2.3\lib).., then it worked for me.
https://javalibs.com/artifact/org.hyperic/sigar
Looking into JVM crashes occassionally with access violation when using Sigar.getProcMem with disabled Windows performance counters #77 issue it might be the case that Windows don't have performance counters enabled hence Sigar fails to query the CPU status from Windows PerfMon
Check if CPU (and other stats) are exposed in PerfMon
Try running Powershell and Server Agent as Administrator
Try using cmd.exe interpreter instead of powershell
Try running ServerAgent.bat --sysinfo to see if there are any errors there
Inspect e:\hs_err_pid12236.log file for any clues
If nothing helps be aware that you can use SSHMon plugin for server monitoring, it doesn't require server-side software installation
I faced the same issue. Error code as follows:
"JRE version: OpenJDK Runtime Environment (11.0+28) (build 11+28)
Java VM: OpenJDK 64-Bit Server VM (11+28, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
Problematic frame:
C [sigar-amd64-winnt.dll+0x14ed4]"
I downgraded the JDK and JRE to the version : 8u241
Go to the Oracle download page here and search for the below JRE & JDK and install it in the Windows server and then start the serverAgent.bat
jdk-8u241-windows-x64.exe
jre-8u241-windows-x64.exe
This should fix the issue 100% sure. It worked for me.
Follow the below step.
Disable firewall setting
if still having same issue
Download the below .dll file and replace it(lib folder)
https://github.com/cnstar9988/sigar/raw/master/sigar-amd64-winnt.dll
It was solved at my end using the below steps:
Download ‘jre 1.8’ from this link https://java.com/en/download/win10.jsp
Once the jre is installed, copy the folder named ‘jre1.8.0_261’.
Image
Visit the ServerAgent folder that was downloaded >> Paste the ‘jre1.8.0_261’ folder inside the ‘ServerAgent-2.2.1’ folder.
Open ‘startAgent.bat’ file in Notepad ++ >>Initially it would look like this
Image
Replace text ‘java’ with the path of java.exe that is within the jre folder placed inside the ServerAgent-2.2.1 folder
Open command prompt in the ServerAgent-2.2.1 folder path and enter ‘startAgent.bat’ file to run the file
Execute JMeter script and now error should not happen.

Error in sonar startup, Unable to start JVM: No such file or directory (2)

I am facing strange issue with sonarqube 5.0.1 , one one of the machine it is not starting. Here is the error log - sonar.log -
--> Wrapper Started as Daemon
Launching a JVM...
Unable to start JVM: No such file or directory (2)
JVM exited while loading the application.
JVM Restarts disabled. Shutting down.
<-- Wrapper Stopped
Machine is x86_64 GNU/Linux - Centos 5.1.
this box has java installed -
$java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
The same sonarqube package works on another machine.
Any idea what could be the issue here?
Thanks.
Issue was in the wrapper.conf where the java wrapper command was not getting resolved. It worked if I give the absolute path - ‘wrapper.java.command=/path/to/my/jdk/bin/java’
This could be an issue with an environment on a host.. not sure.
Few things that helped me in troubleshooting this -
log level changed to DEBUG in wrapper.conf
comments given in the wrapper.conf!
Thanks all for chiming in! Appreciate your inputs.
1.Just close all running jvm from task manager
2. Change the port of the sonar runner from the properties
I had the same symptoms (wrapper starts then immediately stops).
I tried these steps and finally succeeded (on a windows 10 pc):
1) in wrapper.conf, specified the java command:
wrapper.java.command=C:\Program Files\Java\jdk1.7...\bin\java.exe
That did not help.
2) Finally this fixed the problem. In the windows Services, open the Sonar service and then open Log On tab.
Changed the Log On to myself as follows:
I was facing the same issue on sonar startup. After reading this post , i modified the JDK path in below file and it works.
Modify the JDK path in wrapper.conf
wrapper.java.command=%JAVA_HOME%/bin/java
Install jdk 11
sudo yum install java-11-openjdk -y
sudo alternatives --config java
Select the JDK 11 version
Set the JDK 11 version in wrapper.conf
vi /opt/sonar/conf/wrapper.conf
wrapper.java.command=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-3.el8_5.x86_64/bin/java
Could you verify the Java version on the machine starting?
Java 6 is no more supported http://docs.sonarqube.org/display/SONAR/Requirements#Requirements-Prerequisite but from your error message, I don't know if this is the problem you meet.
Solution 1
Set java path globally
Solution 2
Go to sonarqube-{version}/conf directory
Edit wrapper.conf file
Replace wrapper.java.command=java with wrapper.java.command= {path-to-your-java-bin-directory}/java
eg: wrapper.java.command=/usr/java/bin/java
Try using a relative path, if your Sonar Folder is located in the same root folder as your jdk. For me my sonar and jdk are both under "Program Files", which has restrictive permission, hence the error.
E.g:
wrapper.java.command=../../../Java/jdk-11.0.4/bin/java

import neo4j database from windows to ubuntu

I have created a neo4j database on my windows machine.
I have transferred the content of the database directory to my linux machine. This is because I have the community edition which does not support the backup functions.
mtt#mttPC:/var/lib/neo4j/data/log$ sudo service neo4j-service start
WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
WARNING! You are using an unsupported Java runtime.
* Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
Starting Neo4j Server...WARNING: not changing user
process [21498]... waiting for server to be ready..... Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
The file messages.log in the database directory says nothing.
Any idea? Are the windows and linux neo4js compatible? Thank you.
Edit
I have made a fresh install of neo4j on my ubuntu machine.
Now I finally get some logs:
2014-05-16 20:01:10.958+0000 ERROR [o.n.k.EmbeddedGraphDatabase]: Startup failed: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#25984c63' was successfully initialized, but failed to start. Please see attached cause exception.: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#3d34dcb' was successfully initialized, but failed to start. Please see attached cause exception.: 'neostore' has a store version number that we cannot upgrade from. Expected 'NeoStore v0.A.0' but file is version 'NeoStore v0.A.2'.
2014-05-16 20:01:10.958+0000 INFO [o.n.k.EmbeddedGraphDatabase]: Shutdown started
I should be related to this but I am not sure how to proceed. Is the issue related to the fact that when I copied the database, I just stopped neo4j on my windows machine from the neo4j window?
There is no reason why a Neo4j database should not be transferable between operating systems. Can you please provide the output of data/log/console.log? First thought is that you may have permission issues. The files should be read/write for the user the Neo4j process will run as.

Run ActiveMQ as a 64-bit service on Windows Server 2008

We were using Tanuki java service wrapper to run ActiveMQ previously. After migrating to a 64-bit server running Windows Server 2008 R2, we're not able to install ActiveMQ as a service unless we pay for the Standard or Professional version of java service wrapper.
I read that others were using Apache Commons Daemon as a service wrapper for ActiveMQ on 64-bit architectures http://blog.bigrocksoftware.com/2010/10/07/commons-daemon-procrun-as-a-java-service-wrapper-for-activemq/ . The instructions on this site allowed me to successfully install ActiveMQ as a service on our server, but we received errors in our Event Log when starting the service. I commented on this post at the bottom of the page
I was able to install ActiveMQ as a service using the instructions in this article, however when I start it up via the Service control panel I get
Windows could not start the ActiveMQ on the local computer. For more information, review the System Event Log.
When I check the Event Log I see
The ActiveMQ service terminated with service-specific error The operation completed successfully..
I think this may be related to my architecture. I’m running Windows server 2008 R2, my processers are 64 bit Intel Xeon. I did not see that architecture included in the commons-daemon package. When I installed, I used the generic ‘prunsrv.exe’ file instead of the amd64/prunsrv.exe, or the ia64/prunsrv.exe – I received errors when I tried to use these exe files during installation, and was only able to install using the generic prunsrv.exe.
Is there a way to get this to work with my architecture? or did I miss anything?
I was wondering if anyone had any suggestions for me on this list? Perhaps something I missed when installing via procrun, or another service wrapper that works on 64-bit Windows. Any comments are appreciated.
Thanks.
Edit 011312:
Thanks for your response. The activemq-daemon logs list these errors
[2012-01-11 09:45:43] [error] %1 is not a valid Win32 application.
[2012-01-11 09:45:43] [error] ServiceStart returned 1
[2012-01-11 09:45:43] [error] %1 is not a valid Win32 application.
[2012-01-11 09:45:43] [info] Run service finished.
[2012-01-11 09:45:43] [info] Commons Daemon procrun finished
[2012-01-11 09:46:05] [info] Commons Daemon procrun (1.0.8.0 32-bit) started
[2012-01-11 09:46:05] [info] Running 'ActiveMQ' Service...
[2012-01-11 09:46:05] [info] Starting service...
[2012-01-11 09:46:05] [error] %1 is not a valid Win32 application.
[2012-01-11 09:46:05] [error] Failed creating java C:\Program Files\Java\jdk1.6.0_29\jre\bin\server\jvm.dll
I interpret these errors to mean that maybe one of the options with which I installed activemq via procrun as a service is incorrect - I did verify that the jvm.dll does exist at that location in my file system. I installed procrun with these options, using the options listed in the blog post as a model
ActiveMQ.exe //IS//ActiveMQ --DisplayName=" ActiveMQ" --Description=" ActiveMQ Java Messaging Server" --Startup=auto --LogPath=D:\apache-activemq-5.5.0-bin\apache-activemq-5.5.0-bin\apache-activemq-5.5.0\data --LogLevel=INFO --LogPrefix=activemq-daemon --StdOutput=auto --StdError=auto --StartPath=D:\apache-activemq-5.5.0-bin\apache-activemq-5.5.0-bin\apache-activemq-5.5.0 --StartClass=org.apache.activemq.console.Main --StartMethod=main --StartParams=start --StartMode=jvm --StopPath=D:\apache-activemq-5.5.0-bin\apache-activemq-5.5.0-bin\apache-activemq-5.5.0 --StopClass=org.apache.activemq.console.Main --StopMethod=main --StopParams=shutdown --StopMode=jvm --Jvm=C:\Program Files\Java\jdk1.6.0_29\jre\bin\server\jvm.dll --Classpath=D:\apache-activemq-5.5.0-bin\apache-activemq-5.5.0-bin\apache-activemq-5.5.0\bin\run.jar --JvmOptions=-Xmx512M ++JvmOptions=-Dorg.apache.activemq.UseDedicatedTaskRunner=true ++JvmOptions=-Djava.util.logging.config.file=logging.properties++JvmOptions=-Dactivemq.home=D:\apache-activemq-5.5.0-bin\apache-activemq-5.5.0-bin\apache-activemq-5.5.0 ++JvmOptions=-Dactivemq.base=C:\Java\apache-activemq-5.4.1 ++JvmOptions=-Dactivemq.classpath=D:\apache-activemq-5.5.0-bin\apache-activemq-5.5.0-bin\apache-activemq-5.5.0\conf ++JvmOptions=-Dcom.sun.management.jmxremote.port=9004 ++JvmOptions=-Dcom.sun.management.jmxremote.authenticate=false ++JvmOptions=-Dcom.sun.management.jmxremote.ssl=false

Resources