Java - Retrieving User account application is running under - java

I've got a web application running on a Windows Server 2008 machine. The app is running under spring tcserver.
When the server group setup the box they created a service account that I run the application under. They also created a admin account for me.
Within the app through java it's executing a web service.
Most of the time the app works fine. Every once in a while if I'm logged onto the server with the admin account I'll get a HTTP status code 403 as a response when using the app. After a while (sometimes 10 mins, sometimes 30 mins) it will start working again. Talking to other developers # work they're saying that it's an issue on the remote server that the web service resides on. I've sent the errors to the owner of the webservice to see if they see any issues from their side. Being that it's only occurred when I'm logged on to the server I'm skeptical whether it could be somehow using my profile instead. Through task manager I can see the app running under the correct account.
So long story short, is there a way to retrieve the actual account the app is running under. When I try System.getproperty("user.name") this just returns system. It returns that the times when I get the error & also when it's working properly. Is there another method of retrieving the user account.
Also let me know if you think I'm wasting my time & that you also think it's an issue on the remote server.
Any other suggestions please let me know.
Thanks

Related

Not able to login into tomcat web application

I have a RedHat8 Linux server, so in that, I deployed my web application(Java based) on tomcat8. I tried to login into the application, but sometimes it login without any issues, and occasionally it takes more time to login. At that time I saw CPU and memory, Both are normal there is no high. (memory<40 and CPU<30). The connected database server also in azure only.
This issue happens in azure servers only because in AWS Linux2 server with the same configurations it's working fine
I don't know what is the reason. Please anyone help regarding this issue. it's very important to me.

Timeout a long running SQL Server query in a java application running inside tomcat server

I have a java web app that is running inside tomcat and the application has a page (JSP) where users clicks (some buttons on that web page) which results in hitting a query behind the page and reloads it with new information and sometimes that query takes longer than expected and I want to kill the query automatically if it runs longer than x minutes. How can I achieve that at tomcat side, is that even possible with any tomcat server configurations like timeout or anything, if so could someone please guide me or show an example configuration or setting change I can try? Thanks
I think you are looking for Statement.setQueryTimeout which is a feature of JDBC, not of any specific application server, etc. You will want to call that method and set an appropriate timeout. Your queries will throw SQLTimeoutException if the timeout elapses and your application will have to decide what to do next.

Java web app not responding to HTTP requests when deployed to Azure App Service using Windows app service plan

I have built a web app which runs with simply java -jar app.jar. It looks at the environment variable PORT to decide which port to listen on. now I want to deploy it to Azure with a Windows app service plan, this is called This is called "Java SE deployment" in Azure.
On a Linux app service plan, I can simply deploy the app.jar file (using vs code plugin, zipdeploy, or whatever), set the environment variable PORT, and everything is fine.
With a Windows app service plan, attempting to access the app gives a 500 error with the body "The web server failed to respond within the specified time". I've turned on all the logging I can, and I can see the request gets into IIS but no indication that it's attempted to send the request to my app.
However I can access my app directly from the Azure console using curl http://localhost:<port>. so I know it has started up.
I've done this tutorial https://learn.microsoft.com/en-us/azure/app-service/quickstart-java?tabs=javase&pivots=platform-windows which works fine, but I'm not using maven or spring boot - I need to build the jar file myself.
I've read https://learn.microsoft.com/en-us/azure/app-service/deploy-zip and https://learn.microsoft.com/en-us/azure/app-service/configure-language-java?pivots=platform-windows but they doesn't seem to be telling me anything I don't already know.
By dumping out the environment in my app, I discovered that Azure sets the environment variable SERVER_PORT to a number and that if you listen on that number, the requests are forwarded correctly. It actually sets quite a few environment variables to the same port number, but I chose SERVER_PORT because it looks like the most meaningful name, and there are some references to it in various blogs etc. HTTP_PLATFORM_PORT is also set.
I'd still be grateful for any references to official Microsoft documentation, so at least I know whether there's a "proper" way to do this.

Query on Kerberized HBase hangs

I have a web server which is presenting some data from a Cloudera cluster. The data are stored on HBase and the cluster is secured with Kerberos. When I try to perform a get, the server hangs without logging any error.
So far I've tried:
Launching the webserver from command line after a kinit (the server is just for testing purpose, so log-in duration and complex procedures to start it are not an issue)
The runAs approach described in here, both with and without the configuration file import from this answer.
The CLASSPATH configuration approach described here
Global authentication with UserGroupInformation.loginUserFromKeytab (with and without all the configurations from point 2 and 3)
I've executed all the gets from hbase shell after kiniting with the web server's user and they work in reasonable time (less than a second, while the last time I left the connection open the server didn't respond in over an hour), so it's not a performance or authorization issue. Inside the same web server, with every configuration listed, I'm able to perform other actions, like connecting to HBase and getting the table instances.
I've also checked the logs from Kerberos, HBase and my web server and none of them presents any error. In fact, I'm pretty much afraid that the authorization works, but it just gets stuck in some loop during the get.
UPDATES: After more testing, I've verified that there is a user set right before the call to HBase's API. Also, I've checked and no calls are made to HBase. So this is not an authentication problem, but something else. Did anybody have the same problem?

This app isn't verified This app hasn't been verified by Google yet. Only proceed if you know and trust the developer

Hi I have developed an web application using google app engine, for google shared domain contact, Its working fine when I am running it in the localhost but when I deploy that application into google app engine it showing warning screen before user conforming for consent(as shown in the image).
I am using 2 scope http://www.google.com/m8/feeds/contacts/ and https://www.googleapis.com/auth/userinfo.email. when I try to add a user information in the google shared contact I am getting a exception message as www.google.com. How can I resolve the problem? am i need to verify my application in the oauth_app_verification. Can any one solve this?
Thank you.,
You need to go through the verification process before you launch your app. This new process came recently to protect user's data. You can start the verification by submitting this form but before it is recommended to follow steps here

Categories