Skip to main content

Reloading class using spring-loaded Jar

As a  java developer using eclipse, every time, when we made the change on the class, annotation or the xml files, eclipse will pop up a message let us decide ‘continue, restart  tomcat and more’. I am kind of appreciate its kindness. However,  most of the time, I have to select ‘restart’. So, I just wish eclipse  or tomcat can help to reload class files and don’t bother me that option.

Before, I found jRebel which is perfect for my wishing. It is just hard to push management team pay for that  $365 per license annually.

So, I need to cater myself and the one I can afford which is $0 a year, and it’s using Apache License.

How to config?

#2 in your eclipse, adding below arguments in the VM arguments. You need to amend the path to the jar file in your machine.

-Djavaagent:C:/Dev/lib/springloaded-1.1.2.20130430.jar –noverify

#3 Ready to go

Comments

  1. in my case it worked as:
    -javaagent:/path_to_jar/springloaded.jar -noverify

    ReplyDelete
  2. Thanks. Yours are more generic :)

    ReplyDelete
  3. On a Windows Service tomcat installation I found that I had to use

    -Xverify:none
    -javaagent:"C:\path_to_jar\springloaded-1.2.1.RELEASE.jar"

    notice I used -Xverify:none instead of -noverify, otherwise it woudn't recognize the command, spent hours troubleshooting because of that little detail.

    I find that it works great for changing method bodies or constructors, but it doesn't actually let me add new methods or fields, they don't get recognized until I restart the app, which is a bummer, and it's strange because their documentation says otherwise.

    Does anybody have the same problem? JVM has java 7 but the project's source level is set to java 6

    ReplyDelete
  4. is it work on tomcat jee

    ReplyDelete
  5. The hephen before noverify is not formatted properly for copying and pasting over but it works after I replaced it (with correct mapping of course).

    ReplyDelete

Post a Comment

Popular posts from this blog

Stretch a row if data overflows in jasper reports

It is very common that some columns of the report need to stretch to show all the content in that column. But  if you just specify the property " stretch with overflow' to that column(we called text field in jasper report world) , it will just stretch that column and won't change other columns, so the row could be ridiculous. Haven't find the solution from internet yet. So I just review the properties in iReport one by one and find two useful properties(the bold highlighted in example below) which resolve the problems.   example:
<band height="20" splitType="Stretch"> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true"> <reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="192" y="0" width="183" height="20"/> <box leftPadding="2"> <pen lineWidth="0.25"/> …

JasperReports - Configuration Reference

Live - solving the jasper report out of memory and high cpu usage problems

I still can not find the solution. So I summary all the things and tell my boss about it. If any one knows the solution, please let me know.


Symptom: 1.The JVM became Out of memory when creating big consumption report 2.Those JRTemplateElement-instances is still there occupied even if I logged out the system
Reason:         1. There is a large number of JRTemplateElement-instances cached in the memory 2.The clearobjects() method in ReportThread class has not been triggered when logging out
Action I tried:      About the Virtualizer: 1.Replacing the JRSwapFileVirtualizer with JRFileVirtualizer 2.Not use any FileVirtualizer for cache the report in the hard disk Result: The japserreport still creating the a large number of JRTemplateElement-instances in the memory     About the work around below,      I tried: item 3(in below work around list) – result: it helps to reduce  the size of the JRTemplateElement Object                Item 4,5 – result : it helps a lot to reduce the number of  JRTemplateE…