Java Code in Azure cloud service - java

I have java code (that generates jasper reports) and I couldn't convert it to .net and I want to run it on a "Cloud Services" how can I run java code into cloud service ?
any help will be appreciated

#Dhana provided a link to a tutorial for pushing a Java app to Azure in Cloud Services (worker role). You could also push to a Web role but it makes less sense since IIS runs in a Web role, and you'll probably want Jetty, Tomcat, or JBoss for your web server.
If you're running a console app, that's fine too - just launch it from a startup script or the OnStart() in your workerrole.cs.
You'll need to install the tooling into Eclipse. At this point, you'll be able to build Azure deployment packages, in a similar way to Visual Studio (The Azure plugin for Eclipse only works on Windows though). Part of the packaging sets up links to the appropriate JVM and web server package, as well as your own jar files.
If, say, you have a console app that listens on a port, you'll just need to make sure you have an input endpoint set up for the port you want to expose.

Related

Transferring java application to server

I have created a java application in intellij ide. The application is working well. Now that my application is ready I want to transfer my java application from my machine to server and make it live. I have one server, domain and all the basic rights in the server. Can any one help me figuring out?
I am very new in this part. I dont know anything about hosting my own website and application.
The answer depends on what technology you use. If you use application that needs to be deploy into servlet container you can deploy it onto e.g. Tomcat.
Whatever technology you use you definiately should build your application - it also depends on what building system you use.
E.g.fFor gradle, you can use gradlew build.
For maven: mvn compile.
Tell us more details about technology you use to allow us to help you.
You have a java application (Dropwizard) and first need a server to run it on, which means that it must be a server with java installed or where you can install it yourself.
Then you need to transfer the application "fat" jar (typically you find this in the target directory, depending on how you built it) to this server and start it with java -jar my-application.jar.
Then you need to make sure that the port that the application runs on is available externally. This usually means that you need to have a web server installed (commonly nginx or httpd) which redirects from port 80 or 443 to the port of your application.
Only then is you app "live".

Running Java Application with ASP.NET Web API in an Azure Web Site

I'm developing an ASP.NET Web API that needs a particular 3rd party Java application to run constantly on the same machine to execute some methods.
For deploying in Azure - I guess I can install Java on a VM and then manually install and configure the Java application, my Web API, SQL Server and so on..
Is there an easier way?
For example, using the Azure Web Sites to run the Web API with Java pre-installed and somehow install the Java application (via code?) and run it?
Thanks.

Java Application running as web service communicating with Java EE app on Glassfish

I have a stand alone Java application that needs to get information (string data) from a Java EE application, running on a Glassfish 3.1 Application server. I have created a web service for my Java app, but I'm wondering how I could achieve communication with the Java EE glass fish app (using servlet?).
I hope to have a method on my app that can be called from, for example, a client running on glassfish (and vice-versa). This method would have something like a String array as parameter, so that I would be able to pass the data between the apps.
Note: I am unable to deploy my app on Glassfish, since we are trying to achieve separation till we are sure the application I am developing will not cause Glassfish to crash ( we currently have other critical apps running on Glassfish). Also note that this is all taking place on the same machine.
You should develop a web service and deploy it on Glassfish within your existing application. You can do this via a Servlet based web service, or a Session Bean web service, whichever is more appropriate for you.
You will then create a web service client against that web service for your Java app, and integrate it appropriately with calls to the servers via the web service.
Of course, this should all be done against development servers, not your production servers. Glassfish can be deployed pretty much anywhere: your machine, another machine, a VM, in "the cloud". Not having a development server available for, well, development is unacceptable. There is no way you can determine if your app will "crash Glassfish" unless you can test it.
To quote the esteemed Donald Knuth: "I have only proved it correct, not tried it."
Get a test server, develop against it. Move forward.
Have you looked at the URL class.
try this url Java URL example
This may help

How do I deploy multiple Java projects to the same Azure cloud service and storage account?

I am just beginning to learn Azure, so I expect this will seem an elementary question. Using Eclipse (and the Windows Azure Plugin with Java) I began by writing a basic JSP (html) file that simply displays some text in the browser.
Deployment of the first project went fine. It ran as intended in the storage and compute emulators, deployed fine into the new cloud service and storage account I added to Azure, works fine in staging and then production. I deployed the JDK and application server in the package.
I created a second project in Eclipse, same as the first, except that the project and application names are different. This package also includes the JDK and application server. Works fine in the emulator, but when I try to deploy to the existing Azure cloud service and storage account, it fails.
…
Uploading deployment package - 100% Completed
02/22/2013 12:29:45 - Creating deployment
02/22/2013 12:29:47 - Failed : HTTP error code : 409 Conflict
Is it not possible to deploy multiple projects to the same cloud service and storage account?
The first application is still running in the cloud.
thanks
ANSWER SUMMARY
Martin's answer resolved this issue for me. Although Eclipse did not display a message when I tried to publish to an existing cloud service, I was able to unpublish the existing cloud service and then publish to staging and then production as expected.
I do not think so, when you publish the second project to the same cloud service, Eclipse will ask you to unpublish your first one.
If you're publishing a newer version of the same service, then just click the Unpublish button on the toolbar (next to the Publish one) to remove your previous deployment first.
If you're intentionally publishing a whole different application that is supposed exist in addition to the one you already published, then you need to create a new service for it in the publish dialog, rather than selecting the same service again (which happens by default).
And if you're just adding another WAR to the same container installation (Tomcat and or what not), then do that in the Eclipse Azure project, and then republish - that is equivalent to publishing the same deployment in the same service (so you need to unpublish the previous one).

deploy java jax ws web service as stand alone server

i am new to webservice. i need your help to understand deployment process.
I have created a new webservice by using following tutorial
http://www.ibm.com/developerworks/webservices/tutorials/ws-eclipse-javase1/section2.html
web service is running fine in eclipse,
right now i am running this service by right clicking on endpoint class and run it as java application. i want to run this service manually because on our server we not going to install eclipse.
You need to bundle your web service implementation classes as jar and you need to deploy to any Java EE complaint servers like JBoss or GlassFish.
You need some web site to host your application. Eclipse is hosting it for you on your local machine but to use manually I assume you mean you want it on a real site?

Categories