• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

very simple JAMon program giving error...

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I don't know, what the above code should do? But I am getting this error when I execute this program:



I took the reference of this link: http://jamonapi.sourceforge.net/

Thanks.
[ September 06, 2006: Message edited by: rathi ji ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(Unsupported major.minor version 48.0)
That sounds like a Java version problem. Which version of the Java SDK is installed on your machine?
Bill
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code looks good, but as William points out the error indicates you aren't using the required version of the jdk. The supported version message of 48 indicates jdk 1.4 or higher is required. I believe jamon could be recompiled to work with 1.3 though I haven' tried that. It requires 1.3 or higher due to its use of the recently added proxy class.

Here is a link that discusses the version error. You can google and get more:
http://www.artima.com/forums/flat.jsp?forum=1&thread=108274

The code you use will track performance statistitics for any Java interface, by adding that one line of code (A obj = (A) MonProxyFactory.monitor(new A())). If you display the jamon report you will see information about how many times your method was called and execution stats like avg/min/max/total among other things. You could print the jamon stats with the following line: System.out.println(MonitorFactory.getReport());

Or you could run your test code in a web app and use the jamon war viewer.


Also I suggest in a production app to hide all jamon code in a utilities class like the following:
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, being as the proxy class implements interfaces I think you may have to change this line of code:

A obj = (A) MonProxyFactory.monitor(new A());

to this

A obj = (MyInterface) MonProxyFactory.monitor(new A());

Also to see some more interesting data in the jamon report execute your method call in a loop.
[ September 06, 2006: Message edited by: steve souza ]
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by William Brogden:
(Unsupported major.minor version 48.0)
That sounds like a Java version problem. Which version of the Java SDK is installed on your machine?
Bill



Thanks William and Steve.

I am using 1.3. I will try to get 1.4 or 1.5 and then again check.

Thanks again.
[ September 06, 2006: Message edited by: rathi ji ]
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem is fixed by 1.5. Thanks.

And I have changed my code too, because it was giving class cast exception since I was not casting obejct -- returned by monitor() method -- into interface.

Why it is so???

Here are my files:



Now if I execute TestJaMon, it gives me report in HTML format on console, where it generates this HTML file, so I can directly go there and view the report.

I have some doubts regarding report also, I will ask very soon...

Thank you very much for your time.
 
reply
    Bookmark Topic Watch Topic
  • New Topic