How to deploy simple Java projects in an EAR?

I use MyEclipse and I use the Enterprise Application Project (EAP), which automatically deploys my projects on the Internet and EJB.

These projects use some other projects that are just POJOs, "simple" Java projects. Like in the library.

The problem is that when I change something to "simple" Java projects, I need to redistribute all EAP in my JBoss to see the changes.

What I want is a way to automatically deploy these projects (POJOs) in EAP, so replacing hot codes also works with them.

Any ideas?

+4
source share
7 answers

With JBoss, you can simply leave your JARs in the server/default/deploy directory - this was at least true for older versions - thanks to the JBoss special classloader (hate or love).

With WebLogic, you can use the shared libraries .

In both cases, these functions are proprietary, that is, non-standard, and their use will make your application not portable.


Sorry, I meant automatically. For example: 1) Starting the server 2) Change something in the Java project (library) 3) Oh, I need to manually redeploy the library (create a banner, copy and restart the server). I want it to make changes automatically, like the hot version.

Ahhhh, ok, got it. In this case, Deployed Archive Deployment is the path that MyEclipse (and JBoss) supports. Quoting 7.1 J2EE deployment modes :

MyEclipse can deploy Web, EJB, and Enterprise Application projects on any application server included in MyEclipse. MyEclipse supports two deployment modes: deploying a deployed archive and deploying a batch archive.

  • Deployed deployment of archived archive . This is a J2EE application development and deployment model that is development oriented but non-standard. Like batch deployment, deployable application resources are organized according to the standard J2EE directory / file structure. But instead of creating and deploying one archived file, the entire structure of application resources — directories and files — is copied by the application server connector to a special server deployment location for exploded archives. The MyEclipse Deployment Service using on-demand synchronization technology will keep all MyEclipse project projects in sync with all the original changes in the corresponding MyEclipse project. Note: Diversity deployment is not supported by the J2EE standard and is not supported by all application servers.
+1
source

Is it possible to deploy the exploded EAR and then just copy some files that you changed? This is how I do my whole development. If you change a simple JSP or Java class, you can simply copy these individual files and the server will pick them up.

+1
source

There may be server-specific ways to do this to provide shared libraries for Java EE applications, but I don't think the Java EE specification contains any such object. One way is to add it to the server classes path, but you should usually avoid this and bundle your application as a separate device ... i.e. an ear. It seems that you are already doing.

It looks like an odd request, since you are already doing it right, so don't change it.

0
source

If you add your simple projects as libraries, have you considered using OSGI to dynamically replace packages at run time. You do not need to relocate all your applications, and you can simply change banks. jBoss has an OSGI implementation called jbossosgi , which is currently in beta.

0
source

Try to separate the POJO and J2EE elements in two separate EARs or WARs and EARs and deploy them separately. I have the same problem with the Weblogic project and EJB and all the staff have always been deployed if I changed something malicious. This idea came to me not so long ago. You do not have time to try to complete this project. But you can use my idea.

0
source

For this, it is called JRebel: http://www.zeroturnaround.com/jrebel , although I'm not sure that it will work in your particular case. A 30-day trial version is being tested for testing.

0
source

Since I use MyEclipse, I found a way to do this by adding a link in EAP to the java modules. When you deploy a project, java modules are deployed to AS.

The only bad thing is that now I need to manually manage application.xml.

All of this is explained in this link .

0
source

Source: https://habr.com/ru/post/1300063/


All Articles