A few days back, while the built-in server (Tomcat v5.5) in eclipse was running, and while I was modifying the code, the server used to recompile and restart itself. I've gotten into a problem from the last day, where, the server DOESN'T load the LATEST version of the code I'm writing, instead, (I'm assuming) it compiles its own internal cache. Yesterday evening, I fixed that problem by (as I can remember) by clearing some cache or something. But, I did the same today, and its malfunctioning in both ways -- by not compiling the latest version and -- not auto restarting when I modify the code. I've even tried restarting eclipse but the server is still compiling its own code which CAN'T be seen in the workspace.
[EDIT]
I've now resolved the problem which was with something with importing the right add-on library to the working directory.
While the embedded Tomcat in Eclipse should recompile the classes/JSP:s/whatever it falls victim of its own caching which causes it to load old versions of the classes after reloading. So yes, the new classes actually exist in the embedded Tomcat but since the cache isn't cleaned properly (or maybe not at all) it won't reload classes automatically and thus has to be restarted every single time you've made a change.
Additionally it seems that there's some bugs in the Eclipse Server controller which causes the auto-reloading to just stop working at times. Basically it's a bit of a mess and all you can do is to restart it continuously. Or use Jetty which is a lot faster to use when developing.
Use Jetty instead?
I have occasionally found that Eclipse gets confused about something, and frequently the easiest way is just to dump the current Eclipse tree, and unpack a new one, in which you rebuild your workspace.
We use projectSet.psf's in our source repository which makes the above process something that can be done in about a minute.
Related
Everytimes, I change the java coding in java class under Eclipse. I click the run-as, it requires to restart the embedded Tomcat server in order to make the change effective. How can I test the change without the need to restart the Tomcat server. Because it is very time-consuming, if I need to restart the embedded Tomcat server whenever I change some coding. It will spend one minute for testing a little change.
Thanks
What you need is a hot deploy:
Hot-deployable services are those which can be added to or removed
from the running server. It is the ability to change ON-THE-FLY what’s
currently deployed without redeploying it.
Hot deployment is VERY hot for development. The time savings realized
when your developers can simply run their build and have the new code
auto-deploy instead of build, shutdown, startup is massive.
And good news there is a hot deploy in Eclipse. Just Follow the Eclipse tutorial for this
This process is called hot swap or also hot deploy. There are tools that do this process for you. One open source tool that you can check is HotSwapAgent. One paid alternative would be JRebel.
Obviously goes without saying that these two are far from comparable in terms of features and efficiency. But if it is just for testing purposes the open source alternative is just fine. In industry, not that much(we have tried it in my company and didn't fit our expectations).
If i am not wrong there is a option to do that. I am pretty sure that you have seen that.
Reading through Eclipse debug topics I did not find an answer to my specific problem. I wonder if anybody else has seen it. I only experience this since switching to Luna, I used Kepler and Indigo before.
I usually debug Tomcat, but it happens for any one-class test app. When the app hits the first breakpoint, Debug view is shown, then I have to wait 20-30 seconds for the debugger to initialize, and only then is the code line highlighted in the editor. From that point on every break is immediate. Other kind of slowness is not experienced. In Tomcat any subsequent request stops quickly. The problem is that it's restarted often when hot code replacement is not feasible.
Anybody knows how to tweak it? There is no building or validating process going on at that time, and I tried to allocate various amounts of memory to Eclipse. -Xms256m, -Xmx2048m usually works very well for me.
Clearing all breakpoints worked for me too. Probably it was because of that breakpoint in jar files it would be taking more time for generating line numbers for those files.
I don't know how to tweak it, but in experiencing the same problem I found an Eclipse bug ticket already created for this along with duplicates: 440470 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=440470).
Starting Eclipse with "-consolelog -debug" hasn't showed any additional errors related to this.
I am working with a large core Java project and have also installed EMF (Eclipse Modeling Framework) and GEF (Graphical Editor Framework) plugin packages and dependencies via update site. I have installed these in previous versions of Eclipse without the debug delay issue. I tried closing this project and created a new test project with a simple Java class. There was no delay when debugging this class.
I found this post trying solve my issue: Very very slow to initialize tomcat, hibernate, etc. If you fall down here for similar problem I would suggest you what resolved to me. Try:
Clear all breakpoints, mainly those in API's, clear expressions too.
That's what worked for me.
My issue was fixed in Luna SR1.
The ide used is :IBM Rational® Software Architect™ for WebSphere® Software
Version: 7.5.5.3
The app server used is Wbesphere 6.1.
I am posting this question because my server takes about 7 to 8 minutes to start.
So even if i make a small change ,i have to wait 10 minutes to test the change in my application.So is there a way where i can make changes to my java code and test them without restarting the server.
Suggestions appreciated !!!
Note:
I am not supposed to use any build tool in my environment.
There is a plugin called JRebel that let's you do changes without restarting the server.
Dynamic Code Evolution VM is open source alternative to JRebel you can try for reloading classes. It will do entire class redefinition, even reloads changes done to class hierarchy.
Theoretically reloading classes is build into the JVM, although most implementations (specifically Oracle's) only reload (hot swap) as long as you only change code inside the body of a method.
The other problem is that in Eclipse the WTP adapter has to cooperate and only deploy the changed class definition (incremental deploy). GlassFish for some reason has always been a big opponent of incremental deployments, and hence its WTP adapter restarts the server after making even the most tiny change.
JBoss used to be a proponent of incremental deployments, but after AS 7 ("everything has to be different"), they are now a follower of the "restart the server" school as well.
Yet another issue is that plain class loading is often only one part of the story. In EJB, JSF, JPA and many other frameworks classes also have to be re-registered by the framework, caches have to be cleared, etc
This all is where something like JRebel comes it. It reloads nearly all kinds of changes to classes. It also works independently from the WTP adapter thus freeing you from the whims of the server vendors regarding if restarting is hip today and lame tomorrow or exactly the other way around. JRebel also has knowledge and plugins for many frameworks.
Unfortunately JRebel is not perfect and occasionally things will just fail, but overall it works pretty well.
One other piece of advice: most modern application servers start up in a second on relative fast hardware and with a small application or a some 10 seconds for a larger app. With those and session serialization you almost don't need things like JRebel anymore.
We recently started using Eclipse to develop our java application and have been running into some issues. It should be known that we do not use any version tracker, or build software which probably is not best practice, although I was hoping to find an alternative solution to our problem. We have up to 4-5 developers who could be editing a particular project at one time. Throughout our work days, we constantly run into Eclipse wanting to clean/build the project as certain files are edited. We were previously developing using TextPad and compiling at the command line, and would ideally like to use Eclipse in a similar fashion to make coding easier. Is there anyway to setup Eclipse to do what we're trying to do, or will we need to start using some kind of version tracker?
You should definitely use version control, for many reasons, not just this issue.
If you're all editing the code in the same location on a share, that'd cause this issue. You can avoid that by everyone having a local copy, which would require version control of some kind.
De select Project -> Build Automatically in your eclipse. You need to manually build your project when you want to. Think this is what you are expecting
I am having my web application deployed on Tomcat5.5 and I use it in integration with eclipse 3.2.Each time I close the eclipse and restart it, I need to republish the application even when it hasn't been modified.
Is there a way to avoid this or any step I am missing ?
Go to Preferences->Server->Launching . Remove option 'Automatically Publish When Starting Server'
I think adij.wordpress.com correctly nailed this one. If you find that you're spending a lot of time waiting for Tomcat to restart as you develop your application, consider using Jetty instead. It'll restart in a fraction of the time Tomcat does and provides a full featured alternative that is ideal for agile development.
We use Glassfish (Tomcat based) with multiple EAR files and it's dog slow for development so each EAR project contains a Jetty launcher that simply fires up for the single WAR the developer is working on at the time. If you use IntelliJ this can be made automatic so that changes at any tier of the application can be instantly reflected into the currently running application in the time it takes to click onto the browser and refresh the page.
Do eclipse 3.3 or 3.4, or later versions of WTP behave the same way for you?
As this is a quite old question and still filed under unanswered, I'd like to broaden the scope with this answer:
I assume there is a reason for you to want to cut out republishing of your application that I don't know (other than the aversion against unnecessary work being done)
The only thing I can guess is that it takes a significant amount of time. For me the publishing time has never been an issue, but if they are for you, you might think about
increasing your memory (if swapping virtual memory slows republishing) - e.g. buying new RAM
optimize dependencies in your project, e.g. prepackage dependent projects if there's a huge number of them or create subprojects and depend upon them if there's only one huge project. (This assumes, that any of these factors slows republishing. I have not measured it)
does using Tomcat6 or glassfish help?
It might be, that not publishing is your issue but startup time. You might gain a lot by controlling that very tightly, e.g. starting services on demand after the webapplication has started. I know several applications that do some heavy work during startup (before they accept their first connection and before they pass control on to the next application startup that might do the same). I hate them. Usually such services get lots of swear words and finally their own web/application server. Having to restart one of these applications should at least not make all the other applications (and their users) suffer that are written with nice startup times in mind.
If your question is still an issue and you are still looking for a solution, please comment. What is your republishing time?