Link to home
Start Free TrialLog in
Avatar of kayahr
kayahrFlag for Germany

asked on

JBoss Hot-Deployment with Eclipse

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?
Avatar of chaitu chaitu
chaitu chaitu
Flag of India image

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?
Avatar of kayahr

ASKER

I mean HTML, JSP, CSS, JS, PNG, stuff like that.
Avatar of Ajay-Singh
Ajay-Singh

You can redeploy the web application from administrator console

http://linux-sxs.org/internet_serving/c516.html
Avatar of kayahr

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Ajay-Singh
Ajay-Singh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kayahr

ASKER

@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.
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?

Avatar of kayahr

ASKER

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