Menu

Duplicated a plugin in the Demo, changed class names. Fails

2014-03-13
2014-03-15
  • Bob Futrelle

    Bob Futrelle - 2014-03-13

    I stripped the Demo down until it was only using the CodeColorer plugin.

    I then commented out all the CodeColorer Constructor body - ran fine, showing an empty window.
    Then I create an additional source package, org.jpf.demo.toolbox.codecolorer2 and in it placed copies
    of the sources, renamed CodeColorer2 and CCTool2. My motivation was simple: Create many "blank" plugins that I could then specialize. When I ran the standard $java -jar lib/jpf-boot.jar
    the core GUI window came up with the following text, which I don't understand. Could it have something
    to do with the config.properties file?

    org.java.plugin.standard.StandardPluginClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    org.jpf.demo.toolbox.core.CorePlugin.activateTool(CorePlugin.java:183)
    org.jpf.demo.toolbox.core.CorePlugin.readState(CorePlugin.java:280)
    org.jpf.demo.toolbox.core.CorePlugin.createAndShowGUI(CorePlugin.java:160)
    org.jpf.demo.toolbox.core.CorePlugin$1.run(CorePlugin.java:106)
    java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
    java.awt.EventQueue.access$200(EventQueue.java:103)
    java.awt.EventQueue$3.run(EventQueue.java:694)
    java.awt.EventQueue$3.run(EventQueue.java:692)
    java.security.AccessController.doPrivileged(Native Method)
    java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

     
    • Pavel Sharov

      Pavel Sharov - 2014-03-13

      As you can see from 'org.jpf.demo.toolbox.codecolorer' plugin's plugin.xml file, it requires (depends on) the 'org.jpf.demo.toolbox.core' plugin. So you should at least have both of them to get the thing running. Maybe this is the reason of the error you are getting. The text you citing looks like an incomplete exception stack trace, I suppose your error is a ClassNotFoundException. Check if you've copied everything from your error output.

       
  • Bob Futrelle

    Bob Futrelle - 2014-03-13

    I've made a lot of progress, but I'm not there yet. Below is a detailed description of what I've done and the results. I do have the Boot app running with two tabs/buttons - that's some progress.

    I want a painless way to create multiple plugins.
    I don't understand all the innards of JPF, so I have focused
    on working with the Demo plugins.

    I've done everything I can think of, but now I'm stuck.

    I started by removing all the plugins except the CodeColorer plugin
    and the toolbox.core plugin.

    To simplify the CodeColorer plugin, I commented out the body of its constructor.
    This created a Boot app with an empty window and a single tab/button.

    In the working build/ directory in the JPF Demo I then duplicated the plugin folder,
    org.jpf.demo.toolbox.codecolorer and named the duplicate
    org.jpf.demo.toolbox.codecolorer2.

    I changed its class source names to
    CCTool2.java and CodeColorer2.java
    and their package to org.jpf.demo.toolbox.codecolorer2
    They compiled (using the src/ and jars in Eclipse) without incident.

    I also altered the plugin.xml file in the newly duplicated plugin.
    I had to escape all the xml tags. Then, what you see
    is a rendering of what the xml actually looked like.

    <?xml version="1.0" ?>
    <!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 1.0" "http://jpf.sourceforge.net/plugin_1_0.dtd">
    <plugin id="org.jpf.demo.toolbox.codecolorer2" version="0.0.5">
    <requires>
    <import plugin-id="org.jpf.demo.toolbox.core" />
    </requires>
    <runtime>
    <library id="codecolorer" path="classes/" type="code">
    <doc caption="API documentation">
    <doc-ref path="api/index.html" caption="javadoc" />
    </doc>
    </library>
    <library id="java2html" path="lib/java2html.jar" type="code">
    <doc caption="Java2html Library by Markus Gebhard">
    <doc-ref path="http://www.java2html.de"
    caption="Java2Html Homepage" />
    </doc>
    </library>
    <library type="resources" path="icons/" id="icons" />
    </runtime>
    <extension plugin-id="org.jpf.demo.toolbox.core" point-id="Tool"
    id="codeColorerTool2">
    <parameter id="class"
    value="org.jpf.demo.toolbox.codecolorer2.CCTool2" />
    <parameter id="name" value="Code Colorer Tool 2" />
    <parameter id="description"
    value="Tool to colorize source code text" />
    <parameter id="icon" value="codecolorer2.gif" />
    </extension>
    </plugin>

    Running java -jar lib/jpf-boot.jar brought up the splash screen and the Boot app with
    tabs/buttons for "Code Colorer Tool" and "Code Colorer Tool 2"
    with the same icon for both.

    The Code Colorer Tool window is empty, as it was before the duplication procedure.

    I then selected the Code Color Tool 2 tab.
    The error below, associated with Code Colorer Tool 2, complains that CodeColorer (not CodeColorer2)
    could not be resolved to a type.

    The Code Colorer Tool 2 had this error line at the top:
    "java.lang.Error: Unresolved compilation problem: CodeColorer cannot be resolved to a type"
    with this error report in its window:

    org.jpf.demo.toolbox.codecolorer2.CCTool2.init(CCTool2.java:21)
    org.jpf.demo.toolbox.core.CorePlugin.activateTool(CorePlugin.java:188)
    org.jpf.demo.toolbox.core.CorePlugin$3.stateChanged(CorePlugin.java:157)
    javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:416)
    javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270)
    javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132)
    javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67)
    javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616)
    javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591)
    com.apple.laf.AquaTabbedPaneUI$MouseHandler.mouseReleased(AquaTabbedPaneUI.java:891)
    java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    java.awt.Component.processMouseEvent(Component.java:6505)
    javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
    java.awt.Component.processEvent(Component.java:6270)
    java.awt.Container.processEvent(Container.java:2229)
    java.awt.Component.dispatchEventImpl(Component.java:4861)
    java.awt.Container.dispatchEventImpl(Container.java:2287)
    java.awt.Component.dispatchEvent(Component.java:4687)
    java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    java.awt.Container.dispatchEventImpl(Container.java:2273)
    java.awt.Window.dispatchEventImpl(Window.java:2719)
    java.awt.Component.dispatchEvent(Component.java:4687)
    java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
    java.awt.EventQueue.access$200(EventQueue.java:103)
    java.awt.EventQueue$3.run(EventQueue.java:694)
    java.awt.EventQueue$3.run(EventQueue.java:692)
    java.security.AccessController.doPrivileged(Native Method)
    java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    java.awt.EventQueue$4.run(EventQueue.java:708)
    java.awt.EventQueue$4.run(EventQueue.java:706)
    java.security.AccessController.doPrivileged(Native Method)
    java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

     
  • Pavel Sharov

    Pavel Sharov - 2014-03-13

    Bob,
    it appears like you did not build your project properly. You code is half-compiled and hence not self-consistent, that's why you are getting a runtime java.lang.Error. It might not be enough to build the project from within Eclipse. Use the build.xml Ant file located in the root of the demo-src. Run the 'ant -p' command to see which Ant targets are available (build, clean, run etc). Reach successful building for the project using the Ant tool first, then try to run (equally either using Ant or in the way you currently do it).

     
  • Bob Futrelle

    Bob Futrelle - 2014-03-14

    Pavel,
    Thanks for your continued attention and helpful advice.

    ant successfully built and and ran the full demo-src with the modified duplicated plugin, a total of four tabs/buttons.

    But the errors in the CodeColorer2 window in the Boot application are the same as before.
    Somewhere, there's source file or parameter file that I didn't thoroughly and correctly alter.
    I begin each attempt by unzipping jpf-demo-src-1.0.1.zip, so I start with a fresh project.

    My alterations suffered from one or both of the following types of errors, obviously:
    Errors of omission and errors of commision - the only two types.

    When I regain some energy (this has been tiring), I'll dutifully record every single change I make to create CodeColorer2 and its environment. I'll also look at the other two plugins that worked successfully alongside CodeColorer and compare them with my CodeColorer2. It's very much a finite problem - there aren't that many things to change.

     
  • Pavel Sharov

    Pavel Sharov - 2014-03-14

    Bob,
    you can also pack your project in a zip and send it as attachment here. I'll try to figure out the cause of the problem. By the way: why do you need JPF? Be aware that it's not been supported for years, thus is not the best fit for a business purpose.

     
  • Bob Futrelle

    Bob Futrelle - 2014-03-15

    I wrote a long reply about moving up to OSGi, but it disappeared. I'm not going to type it in again.
    More later.

     

Log in to post a comment.

MongoDB Logo MongoDB