Glassfish webapp auto-deployment - eclipse

I am using Eclipse with Glassfish plugin with a complex project consisting of several webapps and EJB projects.
Each time I change some smallest thing in JSP or CSS, the whole webapp is redeployed, which wastes a lot of development time on waiting.
In Tomcat, which I use in parallel (also as an Eclipse "Server" added through Eclipse GUI), things work like a snap - everything is deployed right away without delay.
So, is there a way to enable partial/changes-only deployment of web applications for Glassfish v3.1 and latest Eclipse?
How do you quickly deploy your projects using Glassfish v3/Eclipse combination?

This does not really answers your question but an alternative approach is suggested.
I have not seen the Glassfish plugin but while I use MyEclipse that contains deployment customization options. We do it using exploded deployment
Go to manage deployment
select externally launched
Hit Add - Select Project
Select the "Exploded deployment" (development mode)
This should take care of your faster deployment.

Related

Glassfish: Fast hot deployment setup

What is a good setup for really fast hot deployment of a Java EE application to Glassfish, so the changes are visible in less than e.g. 1 second?
Currently I'm using Eclipse Luna to develop a JSF2.1 application on Glassfish 3.1.2. When I change something in a jsf, a managed bean or an ejb, it takes ages to deploy the changes. I've already found some good advise,
GlassFish (real) hot deployment of JSF pages and resources (CSS etc.) in Eclipse
Glassfish taking 20s to do hot deployment, is that right?
but I don't think I can speed up my setting to get the deployment under e.g. < 1sec. Also I think "directory deployment" is not supported in GF3.
So what setup can you recommend? Should I switch to Netbeans? Or are there any hidden Eclipse settings to speed this up? Or do you reach fast hot deployments with Eclipse Luna and I'm just missing some properties?
Some more information: I have to use GF3.1.2 Furthermore I use maven, the backend jar and the front end war are bundle together in an ear file. I use EJBs and JPA to connect to a DB2 database. So except GF nothing special.
As far as I know, Glassfish does not support hot deployment. You would need something like JRebel to accomplish that. In case you're not bound to glassfish you might consider switching to wildfly or some other AS that supports this feature.

Turnaround Time in Spring JBoss Eclipse

I am currently writing a site in Spring, Thymeleaf, JBoss and I am using Spring Tool Suite. The turnaround time is horrible. I have to recompile and package the app, every time I make a change and then push it out to the server. How to make my turnaround time quicker?
Try JRebel. You can get it free if you spread some social media love for them.
http://zeroturnaround.com/software/jrebel/
Consider using a tool which supports continuous integration, and which supports working on an exploded war file.
For example, sbt supports that mode. It integrates jetty, and the webapp is restarted, if a source file changes (resources like .html, .css and .jsp do not restart the container).
As for details look here: Eclipse + Tomcat - Serve webapp directly from workspace. This question shows other possibilities as well.
If you use EJB features like session beans, you can split your project. If the EJB and pressentation is kept separate, the turn around times for redeploying EJB ears are acceptable.

JBoss ejb3.0 instant hot deployment

I am newbie with jboss-eclipse. I have to work on javaEE5 with JBoss AS 5.1.0.GA. I don't want to use JRebel at the moment.
I installed "Eclipse Java EE IDE" with "JBoss Tools". I added the JBoss 5.1 Runtime server on eclipse and added a new ear project with :
an EJB3.0 class in ejb project;
a javabean class and index.jsp in web project.
I noticed when I make a modification in the jsp file, I can see instantly the changes after refreshing the web browser. That's ok.
When I modify EJB and javabean classes, there is no instant hot deployment. I have to restart the ear application (without restrating jboss server) or "full publish" the ear via eclipse to see changes.
Is there any way to have instant hot deployement for EJB and javabeans?
PS: I tried "incremental" publish but it hasn't worked.
Thank you!
You do need 3rd party tools for that, the most notable being JRebel. Without advertising I have to say this tool has saved me lots and lots of hours already while developing EE applications.
In jboss AS 7.1.1 you just have to go to the as admin console at localhost:9990 and select: Profile -> Core -> Deployment Scanners -> Auto-Deploy Exploded . You might also want to change the scan interval to something smaller. Afterwards, you may deploy your application for the first time by selecting "Run on Server". From this time on, your application will get automatically deployed whenever you change a file and it manages to compile.
I do not know if Jboss 5.1 has this feature, and if I were you I'd consider using 7.1.1 for development when it does not have it.
The hot deployment works fine with JBoss when publishing new files in your deploy folder, only class exchange will not happen in your currently deployed application.
That's why you see changes to all static content like HTML files immediately, but not changes to your java code.
In order to do activate them, you'll have to restart your application (not the whole JBoss, only your application, done for example in JBoss server view).
I have no practical experience with JRebel and I do believe that it saves you time, but you have to be careful with such tools, as they can introduce new problems which you spend much times in debugging, ending up in restarting the container and everything works fine.

One click build and deploy using Eclipse/Maven/JBoss AS 7

I was wondering if it is possible to make a Java EE application being managed by Maven and automatically deploy it to JBoss all from Eclipse. To my knowledge I current right click on my project and select "Make install". After that completes, I open the server pane and right click on my deployed ear and either select "Full Publish" or "Incremental Publish". Is there a way to condense these actions into one click? I tried to write a windows batch file but I didn't have much luck with that, and it would only work for our devs working on Windows machines. I know I can make run configurations but when I try to make one it is very intimidating and I get frustrated and give up.
Thanks for your help!
You can use JBoss Tools 3.3.0 (Current milestone M4) with the maven integration to easily deploy projects (wars or ears) to your AS7 server.
Once you defined your AS7 instance in eclipse, all you have to do is right click on your project > Run As ...> Run on Server. It'll start your app server if it's stopped, or just deploy your app if it's already running.
See http://vimeo.com/25768303
and http://community.jboss.org/en/tools/blog/2011/11/09/jboss-tools-shift-happens-in-m4
If you are using maven, you can use the cargo plugin: http://cargo.codehaus.org/Maven2+plugin
You just configure where the JBoss is installed, set the plugin to run in the phase you want (or make a new one) and you are all set.
You can also create different configurations for different profiles, so you have local, integration, test, production, etc... And just by running with the selected profile deploys the ear in the server, remote or local.
If you want more control, you can set the path of the container as a variable that you pass in the Eclipse run configuration, that way each developer can have their servers in different paths.

How do I - Incrementally deploy in debug mode and other wise using Eclipse Helios and JBoss Tools

Environment
Win7
Eclipse Helios, Eclipse 3.6.1
Java 6
Jboss Tools version 1.0.0.v20110123-0129-H10-CR1 from the nightly builds
Jboss 4.2.3
In the past I used MyEclipse, which is a paid tool. In myEclipse, it's easy to configure a JBOSS Server and then deploy
your webproject in it. While in debug mode, if I change a java class (OR JSP), its changes are immediately reflected under Jboss and
I can test that change, without doing any explicit redeployment
So myeclipse had these features working outof the box....
I'm trying to accomplish same functionality with Eclipse Helios and Jboss Tools
Case 1
I added the Jboss Server via Java EE perspective->Add Server etc...
And then added my WebProject to this Jboss Server
When I right click on this added project and publish from here, it runs an ant script, to create a single (Standard) war file...and it always does the whole thing over.
I dont get a choice to deploy it expanded and anything to specify an incremental deployment
Case 2
Since Case 1 didnt allow exploded war and anything incremental, I decided to use JBOSS Tools
So I opened, Window->Show View->Other->Jboss Tools->Project archives
Selected my webproject, after which it showed up in the "Project archives" tab
So then....Right click on the project name in "project archives" tab.....->New Archive->WAR...and I added my project to deploy in exploded form. ok.
Now if I right click on the added WAR and click "Build Archive (full)"....it deploys the whole web project. Everytime it does the whole thing, instead of incremental.
Since that option didnt do it incrementally, so I right clicked and clicked "Publish to Server". The window that pops up, doesnt show me any servers...from where do i add to this?
In summary....
A) I havent seen any way to incrementally deploy
B) When I'm in debug mode, my java file changes dont reflect immediately...I dont mind redeploying, but since its not incremental, its annoying to do the whole thing over and over.
So question is ...
1) How do I do an incremental deployment?
2) How do I configure this, such that my changes in java classes are reflected immediately when in debug mode.
btw I have seen people suggest an alternate soln to use a custom ANT script....But will ANT script incrementally deploy, if I use it's copy command?
Thanks
Amit
It's MUCH simpler than this.
Forget about JBoss tools Archives, simply use the WTP adapter that JBoss tools provides. This one does incremental deployment (like MyEclipse).
Make sure you install JBossAS Tools from JBoss tools (yes the name sucks). Its description is:
Provides a WTP adapter for JBoss AS 4.x and 5.x. Supports incremental and exploded deployment.
Dish the WTP Server adaptor you created earlier from "Add Server etc..." and do it again, but this time don't choose from "JBoss" but choose from the new folder "JBoss Community". You'll see several new adapters there with the red logo and a slightly different name (e.g. WTP bundled is JBoss v5.0 but the one supplied by JBossAS Tools is JBoss AS 5.0).
Alternatively you can also use JRebel, which does incremental deployment no matter what WTP adapter you use (you disable the automatic deployment in that case).