Executing jstack getting access denied - java

My application is running as a windows service.
When I try to take thread dump using below command from Cmd running as Administrator, I am getting access denied on a machine running on Windows 2016 server
"D:\myapp\jre\bin\java.exe" -classpath tools.jar sun.tools.jstack.JStack 2544 >log1.txt
Getting
2544: Access is denied
Similar command when I run on another machine running in Windows server 2012,it successfully captures thread dump.
And both of these services are running with Local system.
As I googled and found this issue could be due to the service running under Localsystem and the command prompt(which I am using to execute jstack) running under different process, I modified the service to log on as my user account and restarted the service, still getting access denied.
Also tried using PsExec using below command:
psexec -s "D:\myapp\jre\bin\java.exe" -classpath tools.jar sun.tools.jstack.JStack 2544 >log1.txt.
I dont know why but I am getting
Error: Could not find or load main class sun.tools.jstack.JStack.
(Just to add I am running this command from the same folder where tools.jar is residing.)
I seem to have been stuck at all places..Any help will me much appreciated

Related

AWS ec2 web app goes down when command prompt is closed

I ssh into the ec2 instance using command prompt. I then launch the jar file from there. The web app runs perfectly from any device until the command prompt is closed. The site immediately goes down. The instance is shown as “running” when the site is down. ideas?
Well, ec2 is the virtual machine and it will show as running because you didn't shutdown or terminate it.
Your webapp is down because closing the command prompt will quit the shell session and thus terminating/killing the running jar.
It seems you are not running the jar as a background process.
If you are using Linux EC2 instance then try running your jar as
$java -jar jarfilename.jar &
The & makes your java process as a background job.
Note down the process id and then close the session. Now your webapp will keep on running as long as your ec2 instance is running.
I'd suggest reading about nohup and background processes in Linux in general.

Permission denied while running native commands in Tomcat

I'm trying to build an webapp as wrapper for youtube-dl. I'm calling the youtube-dl command using Runtime.getRuntime().exec() but all I'm getting is permission denied saying File system is read-only
And I'm passing the working directory while executing command like Runtime.getRuntime().exec("youtube-dl ...",null,workingDirectory)
Permission for the workingDirectory is changed like below
drwxr-xr-x 1 tomcat tomcat 0 May 13 08:21 Folder
Even tried ProcessBuilder instead of RunTime results same issue and tried other commands such as touch to create file, but the result is same. got touch: cannot touch 'a.txt': Read-only file system error
I'm using tomcat9 - 9.0.16-3ubuntu0.18.04.1, Java8 - 1.8.0_242, Ubuntu - 18.04.1 and tomcat is installed via apt-get
Could anyone tell me what I'm doing wrong?
Seems like your file system went to read only mode.. Please get that server reboot..

Installing jvisualvm as service giving error

I am trying to install jvisualvm as Windows Service since my Tomcat is also running as Windows Service. I ran following command to install jvisualvm as service:
sc create jvisualvm binpath= ...(Location for jvisual.exe without quotes("))
And I get message of CreateService SUCCESS
But when I try to run from Services it is giving me error:
Windows could not start the jvisualvm on Local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.
Can anyone suggest me what can be the cause for this error?

java missing class when supervisor running process but not when running as www-data user

I've made my first clojure app and I've built it with leiningen by running lein ring uberjar. I can run this on my dev machine (fedora 23) and I can run this on my ubuntu production machine java -jar tomahawk.jar. I've followed the digital ocean tutorial here that describes how to set up the environment. My supervisor conf is the following:
[program:tomahawk]
environment=TOMAHAWK_DB=$TOMAHAWK_DB
command=/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -jar tomahawk.jar
logfile=/tmp/supervisord.log
directory=/var/www/tomahawk/app
user=www-data
autostart=true
autorestart=true
startretries=3
redirect_stderr=true
stdout_logfile=/var/www/logs/tomahawk.app.log
However, when using this through nginx, i get the error
2016-03-19 23:34:08.594:WARN:oejs.AbstractHttpConnection:/
java.sql.SQLException: No suitable driver found for jdbc:sqlserver:$
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:255)
This comes from the com.microsoft.sqldbc4.jar file. However, I can run this standalone jar file, as well as I can run sudo -u www-data env TOMAHAWK_DB=$TOMAHAWK_DB java -jar tomahawk.jar just fine. Also, while this is running, I can hit it through the nginx reverse proxy.
I've searched around and found an unanswered email on the supervisor mailing list from 2011. Why can I only sometimes see the missing jar file?
I've tried putting it inside of the /usr/lib/jvm/.../lib/ext location for my jvm, bundled inside of the jar file, running from Tomcat, etc. I've made an upstart script as well with identical results as well. I am not sure what other paths I can try and was wondering if anyone had any insights.

Error when running add-user.bat for Wildfly server

I'm trying to access the Administration console for Wildfly, but first it says I must
run the 'add-user.bat' file in [server installation directory]/bin/
Which I do but then get an error saying, well, look:
When I simply try and run the file by double clicking it I get:
I'm running Windows 8.1 64bit (Urgh) and Java 8
This might help. try using cmd /c add-user.bat or just run add-user.bat without any command before it and Check Java home path.

Categories

Resources