Which approach to uninstalling a Java application would you recommend?

I wonder how best to integrate Java modules designed as separate JE applications (2). Each of these modules provides Java interfaces. POJOs (Hibernate) are used with these Java interfaces, there are no DTOs. What would be the best way to integrate these modules, for example, one module that calls the remote interface of another module?

I was thinking about: EJB3, Hessian, SOAP, JMS. There are pros and cons to each approach.

People, what is your opinion or your experience?

+7
java remoting
source share
6 answers

Having worked on several remote technologies and found them to be universally unfair, I would now use Spring remote access as an abstraction from the implementation. This allows you to focus on writing your functionality and let Spring handle the remote part with some configuration. You have a choice of several implementations (RMI, Spring HTTP invoker, Hessian, Burlap and JMS). Abstraction means that you can choose one implementation and just change it if your needs change. See SpringSource docs for more details.

+8
source share

Using a standard RMI between the various components of a service will be a standard approach, but this will lead to problems exchanging your Java interfaces and version changes in your domain model, especially if you have many components using the same classes.

Are you really running each service in a separate virtual machine? If these EJBs always talk to each other, then you better put them in the same virtual machine and avoid any remote procedure calls, as these services can use their LocalInterfaces.

Another thing that can bite you is to use HIBNNATE POJO. You might think these are simple POJOs, but behind the scenes Hibernate was busy with CGLib trying to do something like lazy initialization. If these beans are serialized and passed across remote boundaries, then you might get an odd Hibernate Exception. Personally, I would prefer to create simple DTOs or write POJOs as XML for passing between components. My colleagues will take another step and write their own wired protocols for data transfer for performance reasons.

I recently used the MULE ESB to integrate various service components. This is quite nice since you can combine RMI, sockets, web services, etc., without writing down most of the boiler plate code.

http://www.mulesource.org/display/COMMUNITY/Home

+3
source share

Why would you go with something other than the simplest thing that works?

In your case, it sounds like EJB3 or maybe JMS, depending on whether the connection should be synchronous or asynchronous.

EJB3 is by far the easiest to build on RMI with a container that provides all the additional features that you might need - security, transactions, etc. Presumably, your POJOs are in a common bank and therefore can simply be transferred between your EJBs, although I tend to transfer value objects on my own. Another advantage of EJB is that when everything is done correctly, it is most effective (this is just my opinion);).

JMS is a little more involved, but not so much, and a system based on asynchronous communication gives certain subtleties in terms of parallelizing tasks, etc.

The overhead of the performance of web services, the inevitable additional configuration and additional points of failure make them, IMHO, there is no problem if you do not have a requirement that requires their use - I think we are interacting with non-Java clients or providing data to the outside here.

+2
source share

If you need network connectivity between Java applications, Java RMI is the way to go. It has better integration, greater transparency and lowest cost.

If, however, some of your clients are not Java-based, you should probably consider other options (Java RMI actually has IIOP dialogs, which allows it to interact with CORBA, however - I would not recommend doing this, if only this not for integration with legacy code). Depending on your needs, the web service is probably your friend. If you agree to the network download, you can go to web services through Hessian.

+1
source share

Do you literally mean remotely? How to work in a different environment with different accessibility characteristics? With network overhead?

Assuming yes, my first step would be to take the service approach, to postpone the call technology for a moment. Just consider the design and meaning of your services. You know that they are compared to expensive calls, so small busy interfaces are usually bad. You know that a service system can fail between calls, so you can use stateless services. You may need to repeat requests after a failure, so you can approve idempotent service projects.

Then consider accessibility relationships. Can your client work without a remote system. In some cases, you simply cannot progress if the remote system is unavailable (for example, you cannot turn on an employee if you cannot get into the personnel management system), in other cases you can adopt the “fire and story” -me-later philosophy; process request and response queues later.

If there is availability, then simply exposing the synchronous interface seems appropriate. You can do this with SLSB EJB if all this is Java EE, it works. I tend to generalize, expecting that if my services are useful, non-Java EE clients might also want them. Therefore, SOAP (or REST) ​​tends to be useful. Adding a web service interface to your SLSB these days is pretty trivial.

But my pet theory is that any large enough IT system needs aynch connections: you need to separate accessibility restrictions. So I would like to look for a JMS-style relationship. The appearance of the MDB in front of your services, or SOAP / JMS, is not so difficult to do. This approach tends to emphasize failure design problems that are likely to be hidden anyway; JMS tends to make you think, “Suppose I don't get an answer? Suppose my answer is delayed?”

+1
source share

I would choose SOAP.

JMS would be more efficient, but you would need to encode a message controlled by a bean for each interface.

SOAP, on the other hand, contains many useful toolkits that will generate your message definition (WSDL) and all the necessary handlers (client and server) when providing EJBs.

With soap, you can (but not necessarily) deal with certificate security and secure connections over public networks. Since the default protocol is HTTP over port 80, you will have minimal pain with firewalls, etc. SOAP is also great for hetrogenious clients (in your case, something that is not J2EE), with good support for most common languages ​​on most common platforms.

0
source share

All Articles