How to deploy non-ear website in jboss - jboss

I have a website comprising of a server and client. The server is an EAR, and I'm using JBoss to deploy it. The frontend is a series of html/js/css files that call into the backend via ajax.
I can deploy the frontend to an apache (2.2) server, and it works fine, however, I have a requirement that they both be on the same port (with different contexts). How do I deploy my static files to jboss in their own context? It also needs to be able to use mod_rewrite (or something similar).
Thanks

You could use Apache as the front end web server for the Jboss app server behind it. You can deploy all your content to Jboss and configure Apache to manage it.
Or you can use Apache to serve the static content and still use it as the front end for Jboss, configuring Apache to map your Jboss port to Apache. You can configure it to use different contexts if you need to.
Take a look here

Related

Like Spring boot, can I switch to a different http server in vertx?

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html
Spring boot allows changing the web server, other than the embedded Tomcat server. Does Vertx provide similar capability?
Vert.x is implemented over netty (A lightweight event-driven network application framework).
Under the hood, starting a Vert.x HttpServer bootstraps a Netty server by default: meaning you cannot switch to another implementation.
While it should be possible to use Vertx with any web server, Vertx comes with a HttpServer in the Vert.x-Web package that can deliver static files and has routing options, role and security features and many more.
All of these are optional, yet pretty easy to use/implement if you follow the documentation. Also see all the other available modules.
If you use the Vertx webserver module you don't need a container like Tomcat, you can deploy a fat-jar and start that like any java application.
You could as well use nginx as a reverse proxy in front of vertx. This setup gives you more flexibility and you can use the full power of nginx for serving static files, your ssl configuration, gziping etc.

Configure IBM HTTP server for Jboss Application server

Recently we have moved our application from websphere to jboss application server.
IBM Http server (IHS) has front ended(proxy) the websphere application server.
Now we want to make changes to httpd.conf to make the IHS to front end the jboss. So whats the configuration to be done at IHS server to act like reverse proxy for JBOSS application server?
There's really no reason to do this, because IBM HTTP Server is only ever supported when it's used with IBM software that it was bundled with.
If you do do it, you're nearly alone in doing so and w/o the assistance of IBM.
Technically, you could use mod_proxy_balancer and mod_proxy_http just like any other Apache-based server, but they're not as well maintained because they are only used in one very obscure/withdrawn IBM product that bundles IHS. It's a basic proxy configuration for Apache and not really worth going into detail here.
The best option for JBoss AS/Wildfly application server proxy for you is Apache HTTP Server with mod_cluster.
Community
You can give it a try with Fedora: mod_cluster package
And there is an example on how to compile it from sources and configure it with Apache HTTP Server from scratch: example, recorded terminal session. It also operates on Windows and Solaris.
Why mod_cluster over mod_jk/mod_proxy?
The main benefit of mod_cluster over mod_proxy*balancer / mod_jk solutions is that both JBoss AS and Wildfly contain mod_cluster subsystems that automatically report deployed contexts and life cycle events to the mod_cluster balancer in Apache HTTP Server. JBoss AS/Wildfly workers join Apache HTTP Server balancer automatically, you don't have to reconfigure anything in your httpd.conf nor restart httpd when you add another JBoss AS/Wildfly worker.
Current load report is also a part of these service messages. One may use several different load metrics within JBoss AS/Wildfly, e.g. heap utilization, CPU load, number of currently open sessions, or one could easily implement a custom load metric.
The result is a high-throughput dynamic load balancer that takes into account actual utilization of your JBoss AS/Wildfly workers.
Commercial support
If you need a fully supported solution for mod_cluster balancer, both Red Hat JBoss Web Server, i.e. Apache HTTP Server, mod_cluster, OpenSSL, Tomcat 7, Tomcat 8, mod_jk, ModSecurity, and Red Hat JBoss Enterprise Application Platform (EAP), i.e. application server built on Wildfly 10+ or AS 7+, entitle you to fully supported mod_cluster balancer fronting either Tomcat workers or EAP workers.
Full Disclosure: I am an engineer at Red Hat

How I can deploy my GWT application on www

I created my first Java EE application (GWT + Hibernate). I want deploy my application on a Tomcat web server.
Could you give me a step by step tutorial?
You can start with Google App Engine + GWT tutorial if you are trying out deploying into Google Cloud - https://developers.google.com/web-toolkit/doc/latest/tutorial/appengine
This question is massive so I will try to bring it down to some steps that need some research to implement.
1st. You created an application using GWT and Hibernate. That means that you need some kind of a web server that understands java and can re-write the logic from java to javascript (for the clientside), and also connect to the database on the serverside and retrieve the data for the client.
This web server is tomcat so what you need is:
A computer that will work as a server. This could be your own machine or some server you can buy as a hosting solution. Buying something like this requires research and effort on your part and cannot be explained here.
A version of Tomcat or Resin or any other web server that understands java
A domain name. These can be bought from sites like this one, but there are some free ones around the web. They require static ips that is you cannot use them from a home line that changes ips. Even without a domain name you can host your site on the server but you need to access it by writing the machine's ip instead. - optional - A temporary solution would be to use some kind of dynamic dns service on your router.
After having set up tomcat (you might want to give port 80 to tomcat) and the server you can host your application by uploading the war file. You can make a war file from gwt by following the instructions here
To upload the war file you can use the tomcat manager interface, or you can connect to the server and place it manually in the folder used for the web applications.
I know that each step propably needs as much if not more explanation by I hope I cleared the area a little bit here.

Deploying .ear file (contains rest services)

I have a few questions about deploying my .ear file (was provided to me, the file itself should not be the problem). I set up jBoss application server jboss-6.0.0.Final and was able to run a simple hello world app to ensure the server was functioning properly.
I was told to place the .ear file in /server/default/deploy so I did. When I ran jboss (through /bin/run.bat) I got no errors related to deploying the ear file.
Question
Is this all the software I need (jBoss)? Do I also need something like Apache or tomcat?
The .ear file contains RESTful service calls that should return xml. Will these be deployed (accessible through a jQuery ajax call after the server (jboss/bin/run.bat) is executed?
Currently when I try to make the calls, the resources do not seem to exist.
Thanks in advance for taking the time to help.
JBoss AS ships with an embedded Tomcat as a servlet container so you really don't need that anymore. Apache Web Server is NOT required for your .EAR to be deployed properly.
To answer your questions
No other software is needed to deploy the EAR. You simply copy your EAR file to deploy directory (which you have rightfully done so).
If your EAR contains RESTFul services, they will be deployed and you can access them using any client including jQuery or even a simple browsers. The trick is to know the access URL to the RESTFul services.
If you have difficulty identifying the URL for accessing your RESTFul services please refer [1] for more information.
Hope this helps.
Good luck!
[1] https://docs.jboss.org/author/display/AS7/JAX-RS+Reference+Guide
I can answer the first question. You need apache if you want to serve static content or you need to isolate the traffic (say keep apache in the dmz and then use apache to proxy traffic to the internal jboss servers). tomcat is bundled along with jboss, so you do not need it.

Best approach to integrate netty with openshift

In fact, I'm trying to see which would be the best approach to achieve play framework native support on openshift.
Play has it's own http server developed with netty. Right now you can deploy a play application to openshift, but you have to deploy it as a war, in which case play uses Servlet Container wrapper.
Being able to deploy it as a netty application would allow us to use some advanced features, like asynchronuos request.
Openshift uses jboss, so this question would also involve which would be the recommended approach to deploy a netty application on a jboss server, using netty instead of the servlet container provided by jboss.
Here is request for providing play framework native support on openshift There's more info there, and if you like it you can also add your vote ;-)
Start with creating 'raw-0.1' application.
SSH into the server and
cd $OPENSHIFT_DATA_DIR
download and install play into a directory here. $OPENSHIFT_DATA_DIR is supposed to survive redeploys of your application.
Now you can disconnect from SSH.
Clone the application repository. In the repository, there is a file .openshift/actions_hooks/start. It's task is to start the application using a framework of your choice. The file will need to contain at least (from what I know about Play)
cd $OPENSHIFT_REPO_DIR
$OPENSHIFT_DATA_DIR/play-directroy/play run --http.port=$OPENSHIFT_INTERNAL_PORT --some-other-parameters
Important
You have to bind to $OPENSHIFT_INTERNAL_IP:$OPENSHIFT_INTERNAL_PORT. Trying to bind to different interface is not allowed, also most of the ports are blocked.
To create some sort of template, save the installation steps into .openshift/action_hooks/build file. Check if play is installed, if it is do nothing, if it's not, execute the installation process.