I'm trying to develop a Trac plugin that contains a Java Applet to
display some data. What I've tried so far is writing a little applet
that just displays 'hello world', and a test html program with an
<applet> tag to test it, which works. I've then copied the .class file
into the htdocs directory of my plugin, and added the same <applet>
markup to my genshi template in my templates directory. I build the
egg and end up with a structure like this:
+my_plugin
+htdocs
MyApplet.class
+templates
my_plugin.html
my_plugin.py
my_plugin.pyc
__init__.py
__init__.pyc
+EGG-INFO
dependency_links.txt
entry_points.txt
PKG-INFO
SOURCES.txt
top_level.txt
zip-safe
The html template tries to show the applet at the top with an html
table underneath it. When I deploy the plugin, I get a Java error box
where the applet should be, and the html table displays fine. The
output from the JVM console is as follows:
load: class MyApplet not found.
java.lang.ClassNotFoundException: MyApplet
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager
$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed:http://
localhost/Projects/MyApplet.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Exception: java.lang.ClassNotFoundException: MyApplet
So obviously the JVM can't find the Applet. I've tried various
permutations of the above, including putting the class file in the
templates directory as well, and trying to use a .jar instead of just
the naked class file, all without success.
My applet tag in the template looks like this:
<applet code="MyApplet" width="600" height="600">
</applet>
I'm running Trac 0.11.6 with Apache. Basically my question is a) is it
possible to embed an applet in a Trac plugin, and b) if so how do I
set up the template, egg, Trac and Apache correctly for it to work?
I've searched and could only find one plugin that mentions using an
applet, called ScrumPlugin, but it looked to me like they just deploy
the class file in the htdocs directory too. I've modified the trac.ini
to set "render_unsafe_content" to true. Thanks for your help.
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en.