Skip to main content

jconsole plugin and netbeans issue

No replies
bencal
Offline
Joined: 2005-09-06
Points: 0

I,
I write a jconsole plugin using the NetBeans Nodes,Explorer and Visual APIs.
So, it also use the Lookup API (org.openide.util) of Netbeans.

In a Netbeans application, no problem.
In the JConsolePlugin, I receive always the same exception : MissingRessourceException

I tracked down the problem to the Lookup of Netbeans that use.
ImageUtilities use the Lookup mechanism to retrieve the classloader and use it to get the image resource (getResource(URL)).
This returns a null value.

I tink that functionally org.openide.util.Utilities.getIcon("myicon.png")
and Toolkit.getDefaultToolkit().createImage(getClass().getResource("myicon.png"))
should do the same but it seems that is untrue.

That is a blocking issue. I cannot use a BeanTreeView object.
and workaround like providing my own Lookup implementation doesn't work.

Do I something wrong or is it a real issue ?

Exception log:

F:\programmation\jconsole\portmapper\target>java -classpath "c:\Program Files\Ne
tBeans 6.1\platform8\lib\org-openide-util.jar";"c:\Program Files\NetBeans 6.1\pl
atform8\modules\org-openide-awt.jar";"c:\Program Files\NetBeans 6.1\platform8\mo
dules\org-openide-dialogs.jar";"c:\Program Files\NetBeans 6.1\platform8\modules\
org-openide-nodes.jar";"c:\Program Files\NetBeans 6.1\platform8\modules\org-open
ide-explorer.jar";"c:\Program Files\NetBeans 6.1\platform8\modules\org-netbeans-
api-visual.jar" -jar "C:\Program Files\Java\jdk1.6.0\lib\jconsole.jar" -pluginp
ath .\portmapper-1.0-SNAPSHOT.jar;"c:\Program Files\NetBeans 6.1\platform8\lib\o
rg-openide-util.jar";"c:\Program Files\NetBeans 6.1\platform8\modules\org-openid
e-awt.jar";"c:\Program Files\NetBeans 6.1\platform8\modules\org-openide-dialogs.
jar";"c:\Program Files\NetBeans 6.1\platform8\modules\org-openide-nodes.jar";"c:
\Program Files\NetBeans 6.1\platform8\modules\org-openide-explorer.jar";"c:\Prog
ram Files\NetBeans 6.1\platform8\modules\org-netbeans-api-visual.jar" service:jm
x:rmi:///jndi/rmi://my.server.dyndns.org:1099/jrmpconnector_jonas
java.util.MissingResourceException: No default icon
at org.openide.nodes.AbstractNode.getDefaultIcon(AbstractNode.java:366)
at org.openide.nodes.AbstractNode.findIcon(AbstractNode.java:359)
at org.openide.nodes.AbstractNode.getIcon(AbstractNode.java:315)
at org.openide.explorer.view.VisualizerNode.getIcon(VisualizerNode.java:
549)
at org.openide.explorer.view.NodeRenderer.configureFrom(NodeRenderer.jav
a:203)
at org.openide.explorer.view.NodeRenderer.getTreeCellRendererComponent(N
odeRenderer.java:141)
at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimen
sions(Unknown Source)
at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(Unknown Source
)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePrefer
redSize(Unknown Source)
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.getPreferred
Width(Unknown Source)
at javax.swing.tree.VariableHeightLayoutCache.getMaxNodeWidth(Unknown So
urce)
at javax.swing.tree.VariableHeightLayoutCache.getPreferredWidth(Unknown
Source)
at javax.swing.plaf.basic.BasicTreeUI.updateCachedPreferredSize(Unknown
Source)
at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.JTree.getPreferredScrollableViewportSize(Unknown Source)
at javax.swing.ViewportLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.ScrollPaneLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at org.openide.explorer.view.TreeView.(TreeView.java:250)
at org.openide.explorer.view.TreeView.(TreeView.java:226)
at org.openide.explorer.view.BeanTreeView.(BeanTreeView.java:101)
at org.dyndns.asphodele.j2ee.jmx.portmapper.PortMapperPanel.(PortM
apperPanel.java:66)
at org.dyndns.asphodele.j2ee.jmx.portmapper.PortMapperPlugin.(Port
MapperPlugin.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at sun.tools.jconsole.JConsole.initPluginService(JConsole.java:956)