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.
Related
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.
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.
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.
I am using the JBoss Tools to deploy a seam application to a JBoss server from within eclipse. I am consistently seeing a strange behavior. Every time the .xhtml files are changed the seam application is auto-deployed as expected. However, the entity manager instance is becoming null and I am forced forced to restart the seam application by removing it and adding it through the eclipse server view. The whole process is taking more time than I can afford. Is there a workaround to this problem?
If you change a xhtml file only that single file should be copied and the entitymanager should not be affected. Are you refreshing the browser ? Triggering some specific action on that page ?
I'm guessing you use JBoss 5.1.0 server? If yes, there are a bunch of problems with this server while working with Seam especially in version 2.2.0. You may also read about general problems with deployment to JBoss5 container.
The other thing you must remeber is to set debug mode for Seam and development mode for facelets. Whitout this two configurations hot deployment won't work.
Is there any way I can speed up the development of JSF in Eclipse and Tomcat?
Basically I'm looking for a way to make the client-side changes (.jsf, .html, .css, .js) to happen a lot faster, and with out having to restart tomcat.
And if possible, also a way to make tomcat (or any other Windows + Eclipse compatible Servlet Container), restart a lot faster.
Because if I compare to my experience with ASP.NET/Visual Studio/IIS, it feels like I'm spending half the day waiting for Tomcat to restart, and sometimes I even get 404 in the browser, since it's not going fast enough.
There MUST be some other way to be more productive, and still allow more test driven development.
Just in case you use Maven to build your project, you can use this command line to test in Tomcat:
mvn clean war:exploded tomcat:run
That will run a slim instance of Tomcat (tomcat:run) taking the changes of your web files (.jsp, .html, .css, .js) directly from the source you're editing (war:exploded), so you'll just hit F5 in your browser
A quick and dirty way to force Tomcat to recompile/reload your pages is to delete Tomcat's working directory. In my limited testing it works fine but obviously, I wouldn't recommend this in production. :)
I believe MyEclipse, if configured correctly, will let you update applications running in Tomcat without restarting Tomcat. It is unfortunately a commercial product though.
Oracle JDeveloper had a copy of OC4J bundled and it was possible to make changes on-the-fly without restarting the container, again this may not be possible given your environment.
If I'm not mistaken you can just copy your client-side changes (.jsf, .html, .css, .js) to the webapps folder of your application, whilst it is running. The jboss J2EE version of Eclipse I'm using allows hot replacement of some java code.
You can use some other container, not tomcat, which not needed to be restarted when you make some changes in you project. It's can be Jboss. Also If you will use some tools, for example JBoss Tools, you develop much faster and easy :-)
As for me, when you make changes just in .css or .xhtml page, you shouldn't restart tomcat, you should just republish you application. In JBoss Tools you can make it using JBoss Tools server view.
put this in your web.xml.
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
This means : "how often will the app server recompile my JSP". The value is in seconds.
You should use Dynamic Web Projects and tell Eclipse Java EE to deploy to a suitable Tomcat instance. This will allow Eclipse to help all it can (but that is still not blazing speed though).