Start Java WebStart with procrun - java

I'm trying to launch a Java WebStart application as a Windows Service using procrun. In order to do this, I created a small Java application which only launches the Java WebStart using ProcessBuilder. If I run this application directly, I don't have any problems and the Java WebStart is started too. If I run this application configured as Windows service using procrun, nothing happened. The procrun logs show me that nothing bad happened but the Java WebStart is not launched (no UI seen and no request on the servers from JavaWS).
I'm wondering if it is possible to do what I'm trying to achieve and if there is alternative ways to do it?
My goal is to launch a small Java application which uses JMS and somes Swing UI using JavaWS and start it as a Windows Service (it must be always started in the system).

Related

How to load a java web app in the terminal?

I have a java web app developed on Struts and deployed on a Tomcat server. I want to run commands and use the functions of the app using the console - something like in 'rails console' such that even if the server was not running, the entire app environment is loaded and the app is usable from the terminal itself.
I have tried Grails (Groovy) but couldn't figure out how to interface the java app with it as 'grails console' works for app developed on Grails.
How to go about doing this?

Running FFMPEG and FFserver from Glassfish Java Servlet

I'm planning to design a web interface to control my FFserver remotely. The question is, is it possible to start/stop the FFserver running on my Linux server using a Servlet running on the same machine?
I'm using Glassfish server and Java EE 7 for my web application. Currently I managed to get my web app to obtain http streams (which are started manually in terminal with predefined config file) and play them on the web. However, now I want to find a way to stop the streams and start the streams on demand.
Is it possible for me to run a Bash script via the servlet? Or are there any better solutions which allows Servlets to run linux commands in the servlet?

Should I run Jenkins without a servlet container in production i.e using java -jar jenkins.war

I'm new to Java and Java web applications. I'm trying to understand why I should use a Java application server like Tomcat instead of running it from command line.
Should I running Jenkins without a servlet container in production i.e using java -jar jenkins.war?
Is Tomcat more suitable for production environments?
Are there other advantages?
Please give me some idea why running the application in a servlet container is important.
Actually when you run Jenkins as "java -jar jenkins.war" it starts embedded servlet container anyway (Winstone or Jetty). Since main load on build server comes not from web users, but (surprise-surprise) from build jobs, I don't think servlet container type can affect performance. Moreover build jobs are started in separate JVM or even on slave machines.
Also all server/job/plugins configuration is stored in Jenkins home / config folder, so the way you started Jenkins does not affect server maintenance / backup tasks. Native installers also create user and start Jenkins as a service.
"Jenkins: The Definitive Guide" - "Running Jenkins as a stand-alone application may not be to everyone’s taste. For a production server, you might want to take advantage of the more sophisticated monitoring and administration features of a full blown Java application server such as JBoss, GlassFish, or WebSphere Application Server. And system administrators may be wary of the relatively little-known Winstone server, or may simply prefer Jenkins to fit into a known pattern of Java web application development. If this is the case, you may prefer to, or be obliged to, deploy Jenkins as a standard Java web application."

Can web application in a container stop itself

I have a case where a java application that is to be managed can be running within tcserver or Apache Tomcat or as a standalone java process. I know tcserver and tomcat expose mbeans/url endpoints to start/stop but they are different and I am trying to find a generic common way covering all 3 cases to stop an application. A stand alone process can exit itself easily but for a container managed application, what would be the best way?
Same way as a standalone app - just System.exit(0).
Or, if this is on Unix, kill <pid>

Calling a .Net Window-based application using Runtime.getRuntime().exec from a Spring Controller running on Tomcat

I am calling an exe file called myapp.exe via a Spring Controller; here is the code in the controller:
Runtime.getRuntime().exec("D:\vmd\apps\myapp.exe");
myapp.exe is a C# .NET application. If I click directly on myapp.exe using Windows Explorer, the application opens up and runs; however, if I call the command through a Spring Controller within Tomcat, the application does not open up; but, when I open Task Manager I can see that the myapp.exe process is running. Nevertheless, the window for myapp.exe does not open up. In JBoss, the application is successfully invoked via the Spring Controller. Does anyone know why the .NET application does not open via Tomcat?
Tomcat is installed as a service. When starting Tomcat manually using the startup.bat file, and then invoking myapp.exe from a link within the Tomcat webapp, myapp.exe launches successfully. However, I am not sure about wether or not Tomcat being started as a service is preventing myapp.exe from running properly, because when JBoss was started as a service, myapp.exe launched successfully.
In Windows, a process running as a service cannot access the regular user desktop. And since a program started by a service inherits this property, it usually is not allowed to get to the desktop either.
As you state, that the Tomcat is running as service, I think this is the cause of the problem. Cannot find a suitable reference for this right now, sorry.
Why not have your .NET application start automatically in a user session? You could connect to the Tomcat via socket, waiting for some kind of start signal to arrive, which would then trigger the mapping the application's main window.

Categories