Display log file in browser with java script - java

Hi I'va the next doubt and I want to know if it's possible to implement. I have some wars deployed in a wildfly/jboss server. For some reason, that server doesn't log anything and the administrator of it seems that doesn't want to do his job. So I was wondering if there's a way to see the log of each war in a browser by a frontend design by me.
I think that I can add in each war a log file, but, there's possible to access each file from a browser and see each one? Also there's no need to be in real time.
Help would be appreciated.
Thanks.

Related

JAVA application with file write/output on linux cant be read by non root user

We have this JAVA webservice that runs on tomcat 9(installed by root).
The webservice creates a generic file log for our client. The problem is only the root user can read and access the file that is being generated.
My question is can I change the output file to be readable for all users by default? (without using chmod everytime the file is generated)
Should it be on code level or configure it on linux?
I have read about this https://docs.oracle.com/javase/tutorial/essential/io/file.html.
But one of our old redhat servers dont have a code level config on its webservice and its working fine.
Thanks
You should not be looking at this from a "java io" side of things.
This is a user permission problem. In other words: probably your tomcat servers shouldn't be running as root in the very first place.
Consider creating a special user that is used to run your tomcat instance. Here you can find guidance how you could do that for an Ubuntu system. And your favorite search engine will for sure know similar links for your favorite Linux distribution, too.
That might also be better from a security perspective: do you really want that people attacking your tomcat ... end up being root on your system if they succeed?!
Long story short: your problem is not some java code within tomcat that writes files; and then other users on your system being unable to access those files. Your problem is that your tomcat service is running as root! Fix the later; and your "initial" problem will be fixed, too.
Final word of warning though: I am not saying that it is easy to change the user setup for you. Maybe it is; but especially if your setup is using "root" for a long time, then there is a certain chance that other things you put in place rely on "being root". So, "not being root" is the right direction; but it might be a painful path to get there, from where you are now.

Java Applet on Tomcat using servlet?

I have a working applet on my Tomcat server but in this applet I need to save information locally.
I used writefile.. and it was working on eclipse, but it doesn't work like that on a server..
I did a lot of research to do a servlet to be able to save the information in an html file. I know I have to use a Post, but I don't know how.
I also want to know if the servlet is just a Servlet.class placed in my tomcat folder and how to call it from my java application?
First, I used writefile.. and it was working on eclipse, but it doesn't work like that on a server..
Continue using that. The applet will need to be digitally signed before it can be successfully deployed, so if it declares all-permissions in the manifest, it should be able to write to the local file system.

channel.connect.failed error when deploy flex/java project to linux redhat server

i keep getting this error ive been looking at it for a day now and im just beat. i was wondering if anyone can help me.
this is the error
Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8080/Learn/messagebroker/amf'
when i do this locally on tomcat server on local development machine it works fine when i brought it over to linux im getting this error.
i dont know what to do anymore it should be straight forward but i'm having no luck.
i do have a web.xml and i see a broker for my remote access so i just dont know what it could possibly be. i would appreciate any help anyone can offer.
Miguel
ok i figuered it out. when i brougth my project over to linux tomcat expects to see all the java classes, flex config files and web.xml file under the root/web-inf. I wish i can change that but thats just the way it works. I was hoping with blazeds i can just put my files on a server and it would all work but thats not the case so if your like me and are new to the whole blazeds scene. Be careful you will nee to change the server web.xml file along with adding additional files under the ROOT/WEB-INF directory. One thing that helped me alot was the LOG files under tomcat_instal/LOG/logfilename.
Good luck to you

Package an application including java war file, Tomcat, DB

i have a java based web application, i have the source code as well as the war file, the application uses mySql and need some web server like tomcat all to be added to some package that can be directly installed on window and linux machines directly..
i need to setup DB, WebServer, and app in one go. Would be great if it can create services for all as well.
is it possible???
i mean the user should just give the location to store and everything should get stored in one go, is it feasible? and if yes please guide me how to do so...
In short: Yes, it is.
Projects like XAMPP are already following that approach. All relevant software components are inside a single ZIP file which you can extract to an arbitrary location on the user's harddisk. All configuration then uses relative paths when referencing files.
So essentially, you will have to put in a little effort in advance to make the "installation" as easy as possible. Maybe you can simply build upon a project like XAMPP and use the infrastructure already provided?

HOW-TO: remote file access from a web server?

We have a web application which which is deployed and used within an intranet. The application reads in text files from a specified location on the web server itself.
Now we have a requirement of reading in text files from other machines as well, so i'm exploring possible options to implement this. Possible options i've been thinking of are:
Maybe start a ftp server on each local machine and then write a servlet to ftp given machines n read-in data.
Maybe run some utility program thats would read in file contents and push it back to the server using xml etc ?)
Ne help about above/or new ideas would be highly appreciated!
Technologies i'm using are :
Tomcat/Struts/JSP/AJAX.
P.S i want to handle non NFS situations as well!
Thanks,
Abhishek.
apart from the fact that I don't know whats the purpose of the application you're building, and knowing it is a Web-app, why not have users upload the specific files you want to process?, or even better, if they are configuration files, you might put them all in one single location, let's say just one machine. That might be better than having your app stuck just because some machine is not accessible.
I have an idea for you.... You may expose web service on each machine where from you want to get logs.These web services will read log files and send to your web application in bytes. You web application will call these service periodically and will take latest data. your entire system would work like a distributed system. you need to ensure that log file should generate with the name in uniform format - for eg.. log-24-12-2010.log or log24122010.log (if your log file generates on daily basis) - so that web services can form the right name of log and access it.
I recommand you to use RESTful web services because they are pretty easy for such purposes. Use JAX-RS APIs to develop such services.
I hope you would get my idea a little bit.
~~ Priyanjan

Categories

Resources