Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » application throws NoClassDefFoundError for some classes of org.eclipse.mat.api jar
application throws NoClassDefFoundError for some classes of org.eclipse.mat.api jar [message #990021] Mon, 10 December 2012 14:17 Go to next message
rits Mising name is currently offline rits Mising nameFriend
Messages: 4
Registered: October 2009
Junior Member
Hello,

I am trying to write a simple MAT plugin, taking HashEntriesQuery.java as refrence.

After launching plugin as an eclipse application. Application throws java.lang.NoClassDefFoundError for following classes :-

org/eclipse/mat/inspections/InspectionAssert,
org/eclipse/mat/inspections/collections/CollectionUtil

Might be this is related to export package property of manifest.mf
But, I am struggling hard to resolve this.

Thanks in advance... Smile
rits

[Updated on: Mon, 10 December 2012 14:20]

Report message to a moderator

Re: application throws NoClassDefFoundError for some classes of org.eclipse.mat.api jar [message #990332 is a reply to message #990021] Tue, 11 December 2012 21:56 Go to previous messageGo to next message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
InspectionAssert is part of a package org.eclipse.mat.inspections which is not an API, so is not exported.
Quote:
Package org.eclipse.mat.inspections Description

These are general queries. The queries delivered with Memory Analyzer and their expected parameters are not part of the API. Both names/identifiers and parameters may change. Subject to that caveat, SnapshotQuery can be used to call these queries.


What do you want to do in your query?
Re: application throws NoClassDefFoundError for some classes of org.eclipse.mat.api jar [message #990445 is a reply to message #990332] Wed, 12 December 2012 14:03 Go to previous messageGo to next message
rits Mising name is currently offline rits Mising nameFriend
Messages: 4
Registered: October 2009
Junior Member
Hello Andrew,

Thanks for your quick reply Smile .

I am trying to analyze a HashMap<SomeKey, SomeValue> in heap.
Please find below dummy definition of classes :-

//this class is a singleton
class KeyValueManager{
	HashMap<SomeKey, SomeValue> map ;
}
----------------------------------------------------------------------------
class SomeKey{
	private NestedKey key = new NestedKey("someKey") ;
}
class NestedKey{
	private String key ;
}
----------------------------------------------------------------------------
class SomeValue{
	private NestedValue value = new NestedValue("someValue", "sessionId", 2332) ;
}

class NestedValue{
	private String someValue ;
	private String sessionId ;
	private int port ;
}


Now, for analysis, I want to list HashMap key value pairs in different ways like :-

1. records of HashMap sorted by NestedKey.key
2. records of HashMap sorted by NestedValue.port, etc...


I tried it using HashEntries query, but it only lists [SomeKey,SomeValue] pair.
Even after googling, I am not able to find some good refrences to use HashEntries with it's all available options.

But, i am able to correctly fetch the count of total records in HashMap with below query :-

SELECT map.table.getReferences().size() FROM java.util.HashMap map WHERE (map LIKE ".*0x2fb9ded8.*")


Also, following query gives me the HashMap object only, not records of HashMap :-

SELECT objects b FROM KeyValueManager


Also, below query gives error on execution :-
SELECT objects FROM java.util.HashMap map WHERE (map LIKE ".*0x2fb9ded8.*")


I am also trying to itereate elements of HashMap$Entry array (with different sorting criteria as described above in BOLD), but no success yet... Sad

regards,
rits

[Updated on: Wed, 12 December 2012 14:08]

Report message to a moderator

Re: application throws NoClassDefFoundError for some classes of org.eclipse.mat.api jar [message #990667 is a reply to message #990445] Thu, 13 December 2012 16:41 Go to previous messageGo to next message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
If you call HashEntries query, you get an IResultTable.
getRows(rowId) and getRowCount() gets you the rows

getContext(row) gets you the Map etc. for each row
getResultMetaData().getContextProviders() gets you the context providers for the key and the value
contextProvider.getContext(row).getObjectId() gets you the object ID of key or value depending on which context provider you have.


For OQL, something like
SELECT entry.key, entry.value FROM OBJECTS ( SELECT OBJECTS map.table.@referenceArray FROM java.util.HashMap map  ) entry
could be a starting point.

I hope this is enough to get you going.
Re: application throws NoClassDefFoundError for some classes of org.eclipse.mat.api jar [message #991478 is a reply to message #990667] Wed, 19 December 2012 12:32 Go to previous message
rits Mising name is currently offline rits Mising nameFriend
Messages: 4
Registered: October 2009
Junior Member
Thanks for your valuable inputs.
I will try these queries.

Also, it will be great, if you share the link of these resources (because I am not able to find any Smile ).

Thanks,
rits
Previous Topic:uptime
Next Topic:How to start MAT
Goto Forum:
  


Current Time: Thu Apr 18 01:27:14 GMT 2024

Powered by FUDForum. Page generated in 0.01979 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top