Java Web Services with GlassFish and Remote Connections - java

Currently I have a Windows 2008 R2 server. On this server I have installed Glassfish 3.1. On my server, I also have a copy of Netbeans installed. I use Netbeans to develop a web service. I can get Netbeans to deploy the web service I have created correctly to Glassfish, but it deploys on localhost. Do I need to modify Glassfish or Netbeans so that the web service is deployed on the public ip address for the server and not local host?
Thanks

Glassfish in the standard configuration binds to all network interfaces (i.e. responds on all IP-numbers the machine has).
Hence, if you have deployed it to Glassfish on a machine you should be able to access it with an URL pointing to any of the machines names or IP-numbers.

Related

Apache web server or Tomcat for java war and php

I'm building an application for a company and I also have to handle the deployment.
The application is a java restful API which I usually deploy on a tomcat. The front end for the application in written in PHP (not by me) and will be installed on the same machine. The back end must be reachable both from the front-end and from the web.
What is the best approach, considering that this is a production environment?
Do I install everything on a tomcat? Both the war and the php application.
Do I install the war on a tomcat and the PHP front end on Apache web server?
Do I connect the tomcat to the Apache web server?
Something else entirely?
Also are there downsides on having both the back-end and front-end on the same machine?
If your back-end uses the Servlet API, you require a servlet server and Tomcat is a common choice. Even if Tomcat provides CGIServlet, I believe nobody uses it on production servers to run PHP scripts. So you need at least two servers.
I would extend it to three servers and run:
the back-end on Tomcat (bound to localhost),
the front-end on a PHP FastCGI server like PHP-FPM (bound to a Unix socket),
a proxy server like NGINX (lighter than Apache2) to connect to PHP-FPM. It does not have to proxy Tomcat, since everything is on the same machine.

glassfish: remotely invoke EJB module with Application Client Container

After fighting passwords on Glassfish 4.x remotely on Ubuntu 14.04 Tahr, I'm ready to proceed to installing my first remote EJB module -- just want make sure I'm on the right path. Going from the Netbeans example Creating and Running an Application Client on the GlassFish Server, How would I make a client for the EJB module which is deployed remotely?
The Netbeans example assumes that Glassfish is running on the localhost. The exact mechanics are unclear to me, as it's not explicitly configured for localhost. Presumably it's implicitly configured for localhost...
I would like to use the ACC to connect to, not a local, but rather a remote Glassfish server. For context, the ACC is:
Introducing the Application Client Container
The Application Client Container (ACC) includes a set of Java classes,
libraries, and other files that are required for and distributed with
Java client programs that execute in their own Java Virtual Machine
(JVM). The ACC manages the execution of Java EE application client
components (application clients), which are used to access a variety
of Java EE services (such as JMS resources, EJB components, web
services, security, and so on.) from a JVM outside the Oracle
GlassFish Server. The ACC communicates with the GlassFish Server using
RMI-IIOP protocol and manages the details of RMI-IIOP communication
using the client ORB that is bundled with it. Compared to other Java
EE containers, the ACC is lightweight. For information about debugging
application clients, see Application Client Debugging.
GlassFish Server Open Source Edition Application Development Guide Release 4.0
see also:
https://stackoverflow.com/questions/25830149/how-to-package-a-stand-alone-remote-ejb-application-client
From a client application, how does the ACC remotely invoke the EJB module?
There must be a configuration. Does the ACC pick this up from jndi.properties? I can't find much documentation or examples on ACC usage. If the ACC is unsuitable, then, of course, I'll use a different approach. Presumably there's a way to specify a remote Glassfish server for the ACC.
How do you intend to deploy your application?
In my days when i use to develop application clients for the ACC, i used to bundle everything in an EAR (I will still do that, cause it is easier).
Glassfish deploys the artifacts, generates required configurations (You can override configurations in application.xml anyway).
One thing that the ACC takes care is the CORBA properties needed for remote connection.
When you download the client jar from the glassfish admin, you download a java webstart application, that downloads all required libraries as appropriate and a configuration is automatically set from which host (paramount that you set glassfish domain host properly, or this will be an internal IP or localhost) it was downloaded from.

Configuring JBoss Web Server to connect to JBoss AS

I am trying to configure JBoss Web Server to connect to JBoss AS. We have a JBoss Web Server installed and configured on one machine, and JBoss AS installed and configured on another machine. How do i configure my JBoss Web Server so that when i call some url mapped to web server, it will redirect me to actual application deployed on JBoss AS. I tried to search on the web for the same, but couldn't find the specifics. This might be a very simple scenario, but i am novice in configuring it. Can somebody help me over here?
Depends on kind of application you have on your JBoss AS server: EJB or web application.
If this is EJB application then create EJB client in your Servlet or JSP page or Servlet Filter or whatever else is used on JBoss Web Server. That client would call EJB component on JBoss AS.
If on JBoss AS server you have also web application, then simply redirect request to the JBoss AS or

How to deploy a web service to amazon EC2?

i've just created a web application and deployed it to Amazon EC2 , but now i want to create a java web service and deploy it to instance in Amazon AWS to be able to use it in my Application
There are many possible configurations. This can be one of them:
Start the application server (probably tomcat) with AJP enabled.
Use the apache HTTP server JK module to connect the webserver to the Tomcat application.
Deploy your web application on the application server and make it generate the WSDL using the external domain name or ip. For example: http://www.domain.com/application/service
Make sure that the Amazon firewall has the port 80 open for that instance.
If you use domain name, make your DNS point to that host.

How to deploy web service on two different system within a LAN?

I have created a web service using Netbeans in Fedora which is working fine in local host. But I want to deploy client on different computer and server on different computer.
I could also connect two Fedora systems using a LAN cable(SSH), but could not access the web service.
What is the procedure to deploy it? Does a webDav-http service connection be established? If so how to do that?
To deploy your project in a different machine, compile it, and the copy the war file to the application server you desire. I use Tomcat, just need to copy the war to the webapp folder, you should have something like in glassfish.
About the clients:
What are you using to generate the client? I assume metro, since is the default in netbeans.
Create a new java project;
Add new, Web Service Client;
Create it from the url: something like http://example.com.someService?wsdl.
Changing the ip you change the machine that this client will communicate to.

Categories