I have a Java Application consisting of a Main Class and Java Proxies(Created using Axis 1.4).There are no Servlets or JSP`s
The program takes i/p from an excel sheet.Queries an internet application using Webservices.This process continues until all the records in the Excel have been executed.
Now my First question is how do I deploy this application on Weblogic:As a WAR, EAR or JAR(Not as WAR ofcourse)
If it is a web application we can invoke it by a path like
http://server:port/contxt_root/abc.jsp
but this aint a web application, so how would I invoke it.
In Jdevloper I right Click on Main Class, Click RUN and it starts executing.Now I have to deploy over a Weblogic Server in a Linux System
Second Question: How do I shedule it.Suppose if i want it to run weekly or daily.
For this, you don't need any kind of web related servers, but some kind of a task scheduler, like cron to schedule a command line starting your Java application
You can run your compiled classes too, I'd advise to create a JAR file of them, that makes things a lot more clean.
You could make your program a timer EJB:
http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html
Just note that Java EE entities don't work to well with local files, so you need to consider where your excel sheet is located.
I'm not so sure you need to make it a Java EE app, just a scheduled program.
Good luck
Related
I have built a Java Play app using the latest version. Currently I am running the application using the batch file that gets generated. There's a zip file created inside target->universal folder (When I go to the bin folder inside the extracted folder this batch file is available).
How can I run this in production Windows environment? This play app is a backend service that needs to run continuously. Should this be created as a Windows Service? As in, should I try to run this batch file as a Windows Service through some means? I can't find any online references on this. Any help would be much appreciated.
There are service wrappers available, that can take almost any arbitrary application and run it as a service or daemon on some operating systems. I would highly recommend that you avoid them. Writing secure, performant services for Windows is not trivial. You can however run any script using Windows TaskManager (GUI) or Task Scheduler, and it has all the knobs you need to easily control how your application runs, when it starts and what to do if it crashes.
See schtasks.exe for command line interface reference.
What I want to do is to have my main Java application to update another java application using Java Web Start and then run the second application "silently" upon user request.
I know Runtime.exec to call javaws and silently import the second application in the cache. I can do that when the first application runs and then I am sure I have an updated copy of the second application. My problem is how to run the second application without showing the Java Web start "Verifying application" window.
Doing some research I see no way to avoid that if I execute the .jnlp. I am wondering whether I can run the second application calling directly the downloaded jar files by passing Java Web Start.
Any Ideas?
Thanks
You have basically two possibilities here:
you can use the JNLP Api service and use the DownloadService;
or use the URLClassLoader and load the remote class.
I don't know if this what you want to do, may be for you it seems as a trick around, forgive me if so...
Why don't you run it as exe, by using process object?
Process process = new ProcessBuilder("C:\\...Desktop\\MyExe.exe").start();
And you can convert your app to exe easily by using jsmooth
I am new to building Java web applications & WAR files. I am working with a fairly large web application that is built on Java & JSP pages. We have a ANT file that will re-build the entire application every time a single change was made. I want to know if it is possible to only re-build the part of the application that was modified instead of the whole entire project.
Testing is a 10 minute process because I will make a change, shutdown Tomcat, run the ANT script, start Tomcat, re-load application in browser which now takes 7min to do load for the first time after a re-build (I'm also curious to know what it's doing here?)...Basically complete hell for testing.
If anyone could suggest a better testing strategy I would be awesome! Also maybe anyway we would just have the ANT script re-build only modified classes.
There are several things one can do.
One can modify jsp in the tomcat/temp directory. The change will be available immediately without any recompiling/reloading
One can use the remote Tomcat debugging (from Eclipse). This debugging allows one to change the source code and this change will be propagated to Tomcat immediately
The best way to organize your ant script is to separate compiling into several jars and then creating a war file. Then recompilation for one change will happen only in one jar.
It is not required to restart Tomcat under redeployment if you specify reloadable=true for the context
I have a Java application ready to be deployed. I tried using Java Web Start (JWS) to launch my application. My application was able to launch it loads the MainFrame but some of the functionality does not work. For example my search button (which creates a new thread to search information over the internet) is not working and several other buttons. My application works perfectly as intended when I run it using the typical java -jar or by double-clicking the JAR file. Do you have any ideas why did it happen? Or am I using a wrong technology for deployment? When I read about JWS the thing that I really like is the auto-updating of the application when new versions are released for the app. I really want this feature for future updates.
Solved:
I wasn't aware of the of Web Start Console. My problem is solved now as I was able to see the stack trace. It has something to do with permissions and my JAR file being unsigned.
a very noob question.
Can I run a .jar file on Tomcat. I am not building a web-app. I simply need to run a .jar with
say HalloWorld in it. Is this possible/appropriate.
Thanks
You can run a Java archive without Tomcat, simply with a Java Runtime Environment:
$ java -jar myhelloworldapp.jar
Tomcat is a servlet container, only needed for web applications.
I don't really know what your use case is, but what you probably need is a virtual private server (VPS) provider. They give you a virtual host which runs OS of your choice and you can install JVM on it. There are many VPS' available. Try Linode or Slicehost.
It would help if you would explain what you are trying to achieve, then we might be able to give you a better answer.
I think what you want is Java's webstart
It sounds like want you want to do is deploy batch code to your server and then run it. You could either create a new web-app that contains your jar, or add the jar to an existing web app. Then you can trigger execution with a servlet. You could even have a JSP that contains:
<%
String [] args = new String[0];
MyClass.main(args);
%>
Of course you'd want to secure that JSP so that not just anyone can run your job.
We use the quartz scheduler to schedule batch jobs from within tomcat. This let's us monitor our jobs much more easily than if they were run from the command line.
http://www.quartz-scheduler.org/