I'm planning a project to run on Linux. I think it will be a java webapp using Tomcat. I'm not sure yet, because of the following problem and the solutions. This project will be able to configure some settings and run some system commands.
My problem is these commands need to be called from root or to use sudo. I would like to avoid this from a webapp or to avoid root to run Tomcat.
How can I run these commands (directly/indirectly) from my webapp ? Is there an architecture/design pattern/any solution for this kind of problem without to reduice the security of the system ?
Thank you.
Stef
Related
I am trying to run a glassfish local server from Intellij Idea and have some troubles. The server only wants to run from terminal via sudo command, and the Intellij runs by default without sudo, so how do I fix it? Do I have to make the file to always get executed as sudo(if yes, then how) or should I set in the Idea configs to run that specific file as sudo?
All information consists in this guide: "Run/Debug Configuration: GlassFish Server".
I solved this by unzipping this to my home directory and changed the location of glassfish inside idea to the new location.
When I run for the first time there doesn't show any errors and I did double check the code and there is no error, but once again when I build the file again the following error pops up.
Deleting directory C:\Users\Vbabey\Documents\NetBeansProjects\PersistenceMYEX2\build C:\Users\Vbabey\Documents\NetBeansProjects\PersistenceMYEX2\nbproject\build-impl.xml:1054: Unable to delete file C:\Users\Vbabey\Documents\NetBeansProjects\PersistenceMYEX2\build\web\WEB-INF\lib\toplink-essentials-agent.jar
I cannot understand the reason for the above error? Can anybody explain me what it is?
Based on your comments, you are running into the default windows locking behavior. If you have a jar file open to run an application, you can't overwrite it.
You might be building it when the server is on. Some other application is using your files.
Try switching off the server or other applications that may be using the files.
A quick fix can be to export the project and import it with a different name and then you can build it.
Simply stop the tomcat or kill the java.exe process before building again.
Secondly, I believe you're using Clean & Build option, which does create issue, when the project is already running. Instead just use the build option or run option in case you want to run.
I am using Eclipse for Java web development. I have WTP and Tomcat installed. I run Tomcat via Eclipse (which is a pretty standard configuration).
What I want to understand is that:
When you right click on a server in the Servers tab, it gives you two options:
Clean
Clean Working Directory
Not much information could be found on Google. People are blindly choosing "Clean". Could someone please explain the difference between the two options?
Thank you in advance.
Clean: Purges all webapps and redeploys them (don't do this while the Tomcat instance is running)
Clean working dir: Cleans out Tomcat's work dir, e.g., where compiled JSPs go. See here.
I have some ant scripts that create various things from the command line.
My command environment is complex, and we are doing some icky things I don't really want to do in eclipse, that won't really run from an ant script invoked inside eclipse. But if there is a way to have an ant script in eclipse start the server, that would be OK too.
Sometimes they take a while to run. It would be nice if when they were done, I could start my Java EE server inside eclipse. I happen to use JBoss 1.4.2 if that matters. I would like to start it in debug mode if possible. This way I could test without having to navigate to the server and start up debug from within eclipse as soon as my code finishes building. Is there any easy way to do this?
You can always manage your Application Server externally. by calling <JBOSS_HOME>/bin/run.(sh|bat) -b <ip_address> (JBoss 5) or <JBOSS_HOME>/bin/standalone.(sh|bat) -b <ip_address>
To start and stop your server from ant and having it appear as if you started it from within eclipse, that is a harder task. You would have to create a Run/Launch Configuration from within eclipse and then call it from ant see Launch an Eclipse Run Configuration from ANT
I am working on an academic project using Eclipse 3.X , jsp's, servlet's etc. The server i chosed to deploy my application is "Tomcat 6.0".
when i change any of my code in the application, i am facing problem with running the application. the changes in the code are not showing any affect even though i restart the server. the changes only get affected, if i restart my eclipse. i tried lot of ways by googling about integration of eclipse with tomcat but nothing worked?. I always have to restart the eclipse, to see my changes.
Please help me with this issue.
thanks in advance.
You should simply be able to use the "republish" feature after saving/building.
1, If the development path and deployment path is the same dictionary, make sure that the "Build Automatically" is checked, it's in "Project->Build Automatically", it can help you deploy the files which are changed.
2, If the development path and deployment path is not the same dictionary, you can write an ant task to deploy project.
if u are running in eclipse it is running the tomcat server of eclipse so for changes to be affected it should be refresh so u have to restart eclipse better way is to use outside eclipse and use localhost and tomcat manager u can restart and can see the changes or use ajax