Solved

JBoss Hot-Deployment with Eclipse

Posted on 2008-10-16
8
7,187 Views
Last Modified: 2013-12-15
I'm searching for a usable solution to hot-deploy a web project with Servlets, JSPs and a lot of dependent Java Projects and JAR files into Jboss.  I hope I use the right words for it. I mean I want to just save a JSP or a Java class in Eclipse and it should be used by JBoss right away. Without running Ant-Tasks  and without restarting Jboss and without restarting the web context.

I used MyEclipse for  it which worked fine but now I have reasons to no longer use MyEclipse. So I have a standard Eclipse 3.4.1 (with WTP) here and I don't find a nice solution. When I use WTP for the deployment then hot-deployment works fine for Java classes but every time I modify a static file then Eclipse rebuilds a WAR archive and moves it into the jboss which then restarts the web context. This is not usable. My web application is pretty huge and building the WAR takes lots of seconds and starting the web context also takes pretty long.

So is there any other possibility?
0
Comment
Question by:kayahr
  • 4
  • 2
  • 2
8 Comments
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 22730904
u said for normal java classes hot deployment is working fine.for which files its rebuilding?what do u mean by static file? are you touching web.xml file for restarting the server?
0
 
LVL 7

Author Comment

by:kayahr
ID: 22730918
I mean HTML, JSP, CSS, JS, PNG, stuff like that.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 22737825
You can redeploy the web application from administrator console

http://linux-sxs.org/internet_serving/c516.html
0
 
LVL 7

Author Comment

by:kayahr
ID: 22738414
Well, I don't want to redeploy the web application. I try to explain again. I'm talking about local deployment during development. Deployment on a production server is not a problem. We have scripts for that and we restart Jboss for it anyway so no need to hot-deploy here. I'm just talking about a local JBoss installation where we test our stuff during development. And we just want to save our files and press F5 in the browser and we want to see our changes right away.

With myEclipse it worked like that: The web was deployed ONCE and after that each file modification was "hot-deployed" into the jboss. So if I modified a java class then the change was immediately visible in Jboss so I could just hit F5 in the browser and it worked. When I modified a JSP or some other static file then MyEclipse copied this file immediately to the deploy directory of jboss so the file was immediately visible when I hit F5 in the browser. So development is pretty fast with MyEclipse: Save your changes and test it immediately in the browser without doing a full deployment and without the need of reloading the web context or restarting Jboss or whatever.

Now I have reasons to no longer use myeclipse and I'm searching for an alternative. The alternatives I have found so far are:

1. Using Ant build scripts. Everytime I change a file I run an Ant target which copies the modified files into the JBoss deploy directory. Works, but is pretty slow because the Ant target must walk through ALL files to find out which one is new/modified. So this solution has two problems: I must start an ant target everytime I want to test my changes AND I must wait a long time for this ant target to complete.

2. Using WTP in Eclipse. This partially works. Like in MyEclipse I do a full deploy once and after that changes done to Java classes are magically hot-deployed into the Jboss. But this does not work for static files (HTML, JSP, ...) Everytime I save a static file in Eclipse the following happens: WTP creates a new WAR which takes pretty long (because the project is pretty large) and then it copies this WAR into the deploy directory of jboss. So Jboss now sees a new WAR and redeploys the web which also takes pretty long. It's possible to deactivate this behavior in Eclipse but then changes to static files are not communicated to JBoss at all.

3. Using a complex structure of symlinks to link all classes, libsand static files directly into the jboss deploy directory. This works great on Linux (And should work for Mac, too). No need to deploy the stuff, no need for a special Eclipse extension. Only problem is: it doesn't work on Windows because this stinking operating system has no symlinks (NTFS Junctions are not a full replacement and have some serious problems with data integrity).

So all three alternatives have problems. And I'm searching for more alternatives. Hoping that there is one that works.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 500 total points
ID: 22738664
Given the constraints you have the ideal way to do it to write a eclipse plugin, which would may not be preferable. The other option you can choose is to use ant scripts and set preservetimestamps attribute to true while copying the file so as it will copy only the modified files.

You can also set the ant file as builder so whenever any file gets modified, it will be invoked. The way to do that:

1. Select the project and right click
2. Select Properties on the context menu
3. Goto Builder on section
4. Click on New button on right hand side
5. Select "Ant Builder"
6. It will open a dialog where you can select the ant file and the target you want to run on each eclipse build operations like clean, manual build, auto build.
0
 
LVL 7

Author Comment

by:kayahr
ID: 22739271
@Ajay: I know the preservetimestamps attribute and this is already used if we use Ant for deployment. Problem is our Project is so large that even "scanning" the project for new files takes too much time. So maybe writing an eclipse plugin would be a better option... Well, I'll wait some time for more answers. If nothing better comes the way then you'll get the points.
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 22755543
we are also using myeclipse for hotdeployment in jboss quite successfully.i think hotdeployment is possible only with jboss-myeclipse combination.if i go for another server like oc4j,websphere etc then may be hotdeployment is not possible even with myeclpise also .am i correct?if i want to acheive hotdeployment with other servers what changes do i make?writing eclipse plugin is only one option?

kayahr,
tomorrow we  can also shift from myeclipse to eclipse so whatever things you are doing  if you can share with us it will be helpful for the future purposes?. what do you say?

0
 
LVL 7

Author Comment

by:kayahr
ID: 22793816
As I said I give the points to Ajay because no better solution than writing an eclipse plugin was mentioned. Before we try to write an eclipse plugin we are going to use Junctions and Hardlinks on Windows to link the projects into the JBoss (Have to tell the Windows developers that they MUST NOT delete these links with Explorer...)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now