How to deploy a JSP on to a server other than Tomcat - java

I am trying to deploy a JSP/servlet onto a server. Not tomcat but on a real web domain. This is my first time doing so and so far I exported it into a war file and placed the file onto the server. Nothing happened which is why I am here. All the google searches seem to concentrate on Tomcat which I have already ran the project on. Advice?

Ok, let's get really basic. You want to see the compiled JSP in a browser, through some public URL, right?
First, find a place to host your application. You can try Digital Ocean (starts at $5/mo), EATJ (free version available), Amazon AWS (free trial available), OpenShift (free gears available), your own computer with dynamic DNS, or many other options available through Google.
Next, you packed your compiled code to a war file. That war file needs to be unpacked (deployed) using some software.
There are numerous ways to handle this (Tomcat, Jetty, Glassfish, etc.). They all have their pros and cons. Pick one and learn the very basics. Tomcat doesn't require a separate web server but you can set one up with it if you like. At this stage, I would keep it simple and not do that yet.
Lastly, set up GoDaddy (or whomever you used to get your URL) to point to the IP address of that server. If your server is running and enough time has passed for the changes to propagate, you should see your page.

There are plenty other J2EE server for example, JBoss and Glassfish. Each one has it's own way to deploy your war files. For example, Glassfish is throught a web administration console (https://docs.oracle.com/cd/E19798-01/821-1757/6nmni99aj/index.html) and in JBoss you need to deploy the war file in a specific directory (http://docs.jboss.org/jbossweb/3.0.x/deployer-howto.html).
It depends on which J2EE server you are using.
Now if you want to get your own server and configure it:
Get the server or VPS
Install JAVA
Install Apache
Install a J2EE server (I prefer glassfish)
Configure glassfish with apache (http://www.codefactorycr.com/glassfish-behind-apache.html) to use apache in front of glassfish
You may want to block the ports 4848 and 8080 used by glassfish
Deploy your webapp
Have fun!!!
PS: I'm assuming you have root access to the server

Easy Apache Tomcat 7 install after,
Run Code via SSH:
/usr/local/cpanel/scripts/addservlets2 --domain=domain.com
For Linux.

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".

Apache and Tomcat Server Cross Domain

I have three distinct heavily coded web-projects; two of them (new) is newly developed with Java/Script, the other (old) one with PHP. All of these three project has some common resources like HTML containers, Element classes etc. Moreover, one of the Java project is Main Project that call the other two projects.
The issue is that Java projects run on a Tomcat Server, PHP needs to run on Apache Server. And PHP project has some location paths for resources like "../SomeResourceFolder/somePage.php". However, when I run Main Project (Java) on Tomcat Server which has "localhost:8080" I could not reach PHP project which is run on Apache Server with "localhost:80", even if I accomplish to reach PHP project, PHP one fails to reach common resources in Tomcat.
I solve the issue a little bit unconvincing way with JavaBridge and Quercus; they help to run PHP on Tomcat Server. However, again I have some path problems.
Actually these projects runs on production with load-balancer which direct request to related server. I try to simulate this or at least run PHP on Apache, Java on Tomcat and connect them somehow. How can I construct this kind of structure without cross domain problems?
I solve the issue by using "Tomcat Connector". It connect Apache and Tomcat by defining Tomcat as worker, and send HTTP request with given path configuration.
You can follow guide given by Nanyang University. In guide Tomcat 6 and Apache 2.2 are used but I used Tomcat 7 and Apache 2.4 with the same directions.

Could OpenShift deploy war on a DIY Tomcat or should I switch to OpenStack

Well, I've been trying to deploy war files on tomcat 8 DIY that I installed, but I couldn't find any useful tutorials, they all give examples with an OpenShift Tomcat 6/7 with git clone containning src folder and pom.xml. But DIY git clone contain misc and diy folders only.
I was able to deploy ode.war Apache server and axis2 through the web browser => ManagerApp, but it doesn't work with webServices it gives me 404 error.
Besides I need to deploy a BPEL process which cannot be rendered in a war file, is there a way to deploy a folder on ode that i've just installed it contain the processes folder pretty much like webapp in tomcat
Or should I switch to OpenStack, is it more easyier especially that all of this is just for test. Thank's
You are really talking about two different technologies there, OpenShift is a PaaS, and OpenStack is a way to control large pools of compute, storage, and networking resources throughout a datacenter.
If you really want to write Web Applications using Java, try using one of the application servers like JBoss, JBoss EAP, or WildFly, instead of using a servlet container (Tomcat).

Java JVM versus Glassfish

I'm really new to Java and I have a basic question. I'm getting ready to deploy a Java web service that I have created in Netbeans/Glassfish. I used Netbeans because of the development GUI and tools. Of course I also deployed to Netbean's built in GF server because of easy and simplicity. I have a Windows 8 server with IIS that I now need to deploy this to. I was thinking that since Java 1.7 EE was already on my IIS server, than I wouldn't need a "container server" like GF but that doesn't appear to be the case. So, I'm confused. What's the difference between the server that Glassfish creates and the JVM that Java EE creates when it is installed? If I have to install Glassfish on my IIS server, am I going to have competing web services and port conflicts to resolve?
Thank you.
The Java Virtual Machine (JVM) is used to execute any Java program. However, all it does is execute the byte code in a Java binary, for example a Java archive (.jar) file. It does not include implementations of many of the Java EE libraries.
A web application, typically deployed as a web archive (.war) file, usually requires libraries not provided by the JVM. In addition, the standard Java web application architecture means that the entry point for the application is not in the .war file - it is in the web application server, which then calls into the code provided in the .war file.
The web application server, which includes full J2EE containers like Glassfish and also more limited web servers like Tomcat and Jetty, acts as an intermediate layer, running on a JVM and executing the web application provided in the .war file.
Probably the best way to run your application on an IIS server is to set up the IIS server as the front end - so the client facing ports would be under IIS control - and set up the web server as a back end to which IIS forwards the relevant requests. The answers at the following question provide some links that may be useful:
Deploy War File in Microsoft IIS 7

Run Tomcat from Java Web Start

Is it possible to distribute Tomcat by Java Web Start and run it from there?
My application shall run within its own Tomcat server on the machine it is deployed on. Can I package Tomcat and the client application into one Java Web Start archive and run the Tomcat server and the client once the user has
downloaded the Java Web Start archive?
You cannot run a full blown Tomcat as it expects a certain layout in the filesystem and scripts and more.
You can however run an embedded web server in an application where you control it completely. I have done that with Jetty. You might find Howto embed Tomcat 6? interesting.
This might be possible if you signed all the jars correctly. But, it seems like this is quite a heavyweight solution. Have you considered doing this with Jetty?

Categories