JBoss ejb3.0 instant hot deployment - eclipse

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.

Related

Integrating JBOSS and Eclipse

I have JBOSS server. I used to make web applications using just notepad++. I used to create the necessary folders like web-inf and files like web.xml. For larger projects doing all this and manually compiling has become cumbersome. I want to use eclipse for that. I saw this tutorial - http://www.eclipse.org/webtools/community/tutorials/BuildJ2EEWebApp/BuildJ2EEWebApp.html . But I don't understand how to make a server. I already have a server. What I want to do is write JSPs and Servlets in eclipse and the build should automatically be deployed in jboss server.
How to to this?
Install JBoss Tools
After that follow the instructions from here to get started and deploy apps to JBoss Server.
To automatically deploy apps after the build you could use a build tool such as ANT or Maven.
I wrote a tutorial for this some time ago: Setting up web development environments with Eclipse
It shows how to setup JBoss within Eclipse (in addition, it also shows how to setup Tomcat and Weblogic), and also shows how to build a simple sample Servlet to verify the proper installation.
If you already use JBoss on the server side, then have a look at the client side as well: http://www.jboss.org/developer
(I haven't tried it myself, but...)
Just open eclipse then go to:
"Help-> Check For Updates" It will check for eclipse updates and installs new availables.
Now "Help -> Eclipse Market Place" Search for "Jboss tools" from search result select one(as your eclipse version) and install it. It will add adapter for new jboss versions.
Now add new server from server view select Jboss version then next add your Home directory of jboss. Then finish.
Step 1 is optional but it sometime it helps.

How to avoid that glassfish deploys all the previous project?

When I start the glassfish server I have noted that it loads all the previous projects that i have developed and previously deployed.
I think that somewhere there is a config file that tells the server to reload the projects, but if i would like to work just on one of them what i have to do?
i suppose that i have to change or delete some entry in a glassfish configuration file, but i don't know where it is and how to do that.
thanks
Massimo
You have different options.
You can go to the Glassfish admin GUI via http://localhost:4848 and look under "Applications". You can undeploy properly deployed applications there.
If this is not working you can manually delete the applications from the glassfish folder: Look at
/[glassfish_installation_path]/glassfish/domains/[your_domain]/applications
or
/[glassfish_installation_path]/glassfish/domains/[your_domain]/autodeploy
Glassfish is running applications in these folders at startup time.
The undeployment depends somehow on the method you used to deploy the applications...if you used NetBeans to deploy you can probably even select the application in NetBeans and click "Clean and build" do undeploy it.

Glassfish webapp auto-deployment

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.

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).

Eclipse Redeploy/Undeploy Web Project without Restarting the Server

In my eclipse web application I made a Web Project and a Library Project. The Web Project referenced the Library Project.
When I started the Server, every time I change a code in the Library Project and build it. The server wants to restart and it does not redeploy by the Web Project only. I do not want to restart the server because it takes a lot of time waiting the startup of the server.
Another is I am developing portlets using Liferay Portal and every time I change the Library Project, the auto-deploy of Liferay comes in but the Library Project Jar is locked and resulted to crash the portlet and did not deploy it until I restart the server.
Please Help!!!
In Java EE perspective find "Servers" tab at the bottom, delete your EAR out of there.
Try JavaRebel
If you install the nightly build of Liferay IDE (eclipse plugins for Liferay) it has support for delta-deployment where after the initial deployment (full deploy) it will only deploy the delta or just the individual files that you change as you save them (a single JSP or CSS file, etc).