configure apache bridge for tomcat - java

I have got two java projects:
is a web service, which is running fine on Tomcat 6.
the other is a client developed using Play 1.2.4 framework and must be deployed on the same tomcat as that of the web service.
My problem is that when they are deployed as a war file on tomcat, client request URL's don't include the application context and thus the path could not be found.
I read as it is possible to make Apache a bridge for tomcat will solve the problem but don't know how to configure it.
Please help me out.

I think what you mean is that your UI, developed with Play, is deployed under a context like /myapp.
You have two options:
rename the WAR file to ROOT.war. Tomcat will deploy it to /
Use Apache as Proxy and implement a Redirect
Apache config would look like:
RedirectMatch "^/$" /myapp
ProxyPass /myapp http://tomcatserver:8080/myapp

Related

Java Spring MVC deploy .war on GlassFish

At first i want to say that i'm a beginner in java servers and never deploy an java .war app on server other than localhost in my intellij.
I have a simple only REST app Which work fine in localhost, i also created war file and deploy it by command "asadmin deploy --port 4849 war_name", but when i go into url http://stachurskipiotr4.usermd.net/cookbook-1.0-SNAPSHOT there is an server error.
I completely don't know what it is, i will be grateful for any help.
Access the domain port for that case. Default is 8080 if you haven't configured.
http://stachurskipiotr4.usermd.net:8080/cookbook-1.0-SNAPSHOT
Also, please use or log in your admin console to see the apps if it's deployed. You can also access it directly from there.
Glassfish already provides the Jackson libraries and the version conflicts with the one Spring depends on. Glassfish is an enterprise container, is there a specific need for the enterprise container? Try a regular servlet container like Tomcat instead. If you do want enterprise, maybe you shouldn't need using Spring
EDIT:
Removing jackson jars from your project won't help you; Spring code wants the version it wants. You can try to find out which version Glassfish provides and then see which version of Spring depends on that and use that version of Spring. This is a wrong thing to try as this will be just the tip of the iceberg. Do not try to deploy Spring code in an enterprise container, these are competing specs.
Your options are
1) figure out why is Tomcat not working. Tomcat is a battle-tested servlet container with thousands of production deployments.
2) Try a different servlet container such as Jetty.
3) Rewrite your code to the JEE specification and deploy to an enterprise container such as Glassfish or Wildfly (there are others).
4) Use Spring Boot to embed the container and package your app as an executable jar.
EDIT2:
If you chose Spring Boot, your artifact will be an executable jar, you do not deploy it into a container since the container is embedded. You start the jar via a java command. You remove the container from your deployment entirely. I don't know your deployment environment, but you do not use Glassfish at all at this point, you have to run the java command to start the server.
If Glassfish is a requirement, you have to rewrite your code

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

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.

How jetty server can be integrated with apache server?

I am developing an web application where some existing part is written already in php and for that apache server is being used. But now i have to complete rest of module in Java using jetty web server. Is there any way to integrate jetty webserver with existing apache webserver so that i can simply deploy as war file?
Yes, of course. Jetty is a servlet container similar to tomcat. There are instructions here:
http://wiki.eclipse.org/Jetty/Tutorial/Apache#Configuring_Apache

Deploying SIP servlet on Jboss

I'm new to SIP Servlet development and I would like to know how to deploy my Sip servlet to my Jboss server.
I can't seem to find how to do it by googling it. I see a lot of information on using mobicents but do I have to?
Can't I just deploy directly like I would my HTTP servlets?
Thanks!
EDIT:
Also what is the exact difference between JAIN sip servlets and Sip servlets?
Mobicents provide Jboss and tomcat applications servers with additional modules which are required to deploy and run your sipservlet application
if you download and extract the jboss distribution you can see there are some modules call
sip-presence,sip-balancer , mobicents-media-server-1.0.3.GA.sar in deploy folder these are few and you will find a lot of additional modules/resources.
What you have to do is download the jboss from here and deploy your sipservlet war file as a normal web deployment.

Deploy War File in Microsoft IIS 7

I would like to ask how can I deploy a war file to Microsoft IIS 7?
Thanks in advance.
You can't. You need a Java EE Web Container such as Tomcat or JBoss in order to do so. IIS can just act as a front facing proxy for the stuff hosted through the WAR file.
What you probably need is a way to connect IIS and Tomcat together so that requests for any dynamic resources such as JSPs and Servlets can be delegated to Tomcat.
The following link explains how to do so in detail.
http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
Please read this article: Deploying Java Servlet applications on Windows with IIS The Java is running on Jetty and IIS is used as a proxy, but in this solution all components are fit together to make it look and feel like it is built-in IIS feature of running WAR files.

Categories