We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › twitter4j applet problem
Page Index Toggle Pages: 1
twitter4j applet problem (Read 3309 times)
twitter4j applet problem
Mar 23rd, 2010, 8:05pm
 
I wrote a sketch that fetches tweets and generates visuals. Looking through these boards really helped a lot, but I can't find anything related to this problem I'm having.

I'm trying to generate an applet so that this project can run in a webpage, but I'm having problems. The sketch works perfectly when I run it in processing and when I export it as an application, so this doesn't make sense to me.

I made sure to sign all the jar files, but the error is generated regardless. Here is the java console output:

Code:
Java Plug-in 1.6.0_18
Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM

----------------------------------------------------


java.lang.RuntimeException: java.lang.NoClassDefFoundError: twitter4j/TwitterException
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.lang.NoClassDefFoundError: twitter4j/TwitterException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: twitter4j.TwitterException
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: twitter4j/TwitterException


I'm no programmer but it looks like there's some problem with the TwitterException class. It's like the export process is not including the twitter4j core applet, but it seems others have made applets successfully and it works fine as a standalone application.

I've tried the latest stable and the latest snapshot builds of twitter4j.
I'm using the latest version (1.1) of Processing.
Java: 1.6.0_18-b07 (latest stable JDK).
I've tried it on Windows 7 and XP.

Any ideas?
Re: twitter4j applet problem
Reply #1 - Mar 23rd, 2010, 11:56pm
 
It works now!

Upon further review, I found that I had to explicitly include the twitter4j jar file:

Code:
<param name="archive" value="twitdraw_pde.jar,core.jar,twitter4j-core-2.1.1-SNAPSHOT.jar" /> 



My other jar files were included by default.

Hope this helps anyone with a similar issue.
Re: twitter4j applet problem
Reply #2 - May 21st, 2010, 1:09am
 
hello  there,

me too with the same problem regarding the twitter4j. Even if i've done as you suggest to insert into the html the twitter4j <param name="archive" value="twitdraw_pde.jar,core.jar,twitter4j-core-2.1.1-SNAPSHOT.jar" />
i get the follow errors from the java console:

Fri May 21 10:07:35 CEST 2010 JEP creating applet ..... (file:/Users/.....)
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError
     at twitter4j.Twitter.<init>(Twitter.java:98)
     at chiara_3_terra.setup(chiara_3_terra.java:38)
     at processing.core.PApplet.handleDraw(PApplet.java:1571)
     at processing.core.PApplet.run(PApplet.java:1496)
     at java.lang.Thread.run(Thread.java:613)

i think i've some problem with the class...
any suggestions
Thanks.
Re: twitter4j applet problem
Reply #3 - May 22nd, 2010, 12:44am
 
Hello friends,

I need some help to understand why I've signed an applet to put online
(the sketch doesn't uses opengl) via terminal that uses the twitter4j
jar just following this example http://processing.org/hacks/hacks:signapplet
but doesn't works, doesn't loads any sketch into the browser (I've try
safari and firefox), even if the browser recognize the sign and ask to
me to accept the content but nothing appear.
Any suggestions or ideas?
Thanks in advance,

Chiara.


the java console error:
Sat May 22 08:36:53 CEST 2010 JEP creating applet chiara_3_terra
(file:/Users/.......)
Exception in thread "Animation Thread"
java.lang.ExceptionInInitializerError
   at twitter4j.Twitter.<init>(Twitter.java:98)
   at chiara_3_terra.setup(chiara_3_terra.java:38)
   at processing.core.PApplet.handleDraw(PApplet.java:1571)
   at processing.core.PApplet.run(PApplet.java:1496)
   at java.lang.Thread.run(Thread.java:613)
Caused by: java.security.AccessControlException: access denied
(java.util.PropertyPermission twitter4j.configurationFactory read)
   at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:
264
)
   at
java.security.AccessController.checkPermission(AccessController.java:
427)
   at java.lang.SecurityManager.checkPermission(SecurityManager.java:
532)
   at
java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:
1285)
   at java.lang.System.getProperty(System.java:662)
   at
twitter4j.conf.ConfigurationContext.<clinit>(ConfigurationContext.java:
42)


this is the HTML CODE page, where i had explicity insert the TWITTER4J
JAR:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <!-- charset must remain utf-8 to be handled properly by Processing
-->
 <meta http-equiv="content-type" content="text/html; charset=utf-8" /
>

 <title>chiara_3_terra : Built with Processing</title>

 <style type="text/css">
   /* <![CDATA[ */

   body {
       margin: 60px 0px 0px 55px;
     font-family: verdana, geneva, arial, helvetica, sans-serif;
     font-size: 11px;
     background-color: #ddddcc;
     text-decoration: none;
     font-weight: normal;
     line-height: normal;
   }

   a          { color: #3399cc; }
   a:link     { color: #3399cc; text-decoration: underline; }
   a:visited  { color: #3399cc; text-decoration: underline; }
   a:active   { color: #3399cc; text-decoration: underline; }
   a:hover    { color: #3399cc; text-decoration: underline; }

   /* ]]> */
 </style>
</head>

<body>
 <div id="content">
   <div id="chiara_3_terra_container">

   <!-- This version plays nicer with older browsers,
        but requires JavaScript to be enabled.
        http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html
-->
   <script type="text/javascript"
         src="http://www.java.com/js/deployJava.js"></script>
   <script type="text/javascript">
     /* <![CDATA[ */

     var attributes = { code:'chiara_3_terra.class',
                          archive: 'twitter4j-core-2.1.2-
SNAPSHOT.jar,chiara_3_terra.jar,core.jar',
                          width:712, height:712 } ;
       var parameters = { };
       var version = '1.5';
       deployJava.runApplet(attributes, parameters, version);


       /* ]]> */
     </script>

   <noscript> <div>
     <!--[if !IE]> -->
     <object classid="java:chiara_3_terra.class"
                 type="application/x-java-applet"

archive="chiara_3_terra.pde,chiara_3_terra.jar,core.jar,twitter4j-
core-2.1.2-SNA
PSHOT.jar"
                 width="712" height="712"
                 standby="Loading Processing software..." >


       <param name="archive"
value="chiara_3_terra.pde,chiara_3_terra.jar,core.jar,twitter4j-
core-2.1.2-SNAPS
HOT.jar" />

       <param name="mayscript" value="true" />
       <param name="scriptable" value="true" />

       <param name="image" value="loading.gif" />
       <param name="boxmessage" value="Loading Processing
software..." />
       <param name="boxbgcolor" value="#FFFFFF" />

       <param name="test_string" value="outer" />
     <!--<![endif]-->

       <!-- For more instructions on deployment,
          or to update the CAB file listed here, see:
          http://java.sun.com/javase/6/webnotes/family-clsid.html
          http://java.sun.com/javase/6/webnotes/install/jre/autodownload.html
-->
       <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
             codebase="http://java.sun.com/update/1.6.0/
jinstall-6u18-windows-i586.cab"
             width="712" height="712"
             standby="Loading Processing software..."  >

         <param name="code" value="chiara_3_terra" />
         <param name="archive" value="chiara_3_terra.jar,core.jar" /
>

         <param name="mayscript" value="true" />
         <param name="scriptable" value="true" />

         <param name="image" value="loading.gif" />
         <param name="boxmessage" value="Loading Processing
software..." />
         <param name="boxbgcolor" value="#FFFFFF" />

         <param name="test_string" value="inner" />

         <p>
         <strong>
           This browser does not have a Java Plug-in.
           <br />
           <a href="http://www.java.com/getjava" title="Download
Java Plug-in">
             Get the latest Java Plug-in here.
           </a>
         </strong>
         </p>

       </object>

     <!--[if !IE]> -->
     </object>
     <!--<![endif]-->

   </div> </noscript>

   </div>

   <p>

   </p>

 </div>
</body>
</html>
Re: twitter4j applet problem
Reply #4 - May 22nd, 2010, 1:45am
 
Please, don't spam the forum with multiple identical requests on various old threads, and PM too!
I removed the redundant messages.

I saw this message and didn't answered because I am not sure where the problem is. You still have a security issue. I can only give generic advices.

You don't need the chiara_3_terra.pde part in the archive attribute, the browser doesn't care about your source.
And if you haven't done it already, you should sign both jar files (chiara_3_terra.jar and twitter4j-core-2.1.2-SNAPSHOT.jar), just in case...
Re: twitter4j applet problem
Reply #5 - May 22nd, 2010, 2:10am
 
Solved yeah!
I've signed the core.jar even if the tutorial says to sign the
sketch.jar. Now works!
Chiara
Re: twitter4j applet problem
Reply #6 - May 22nd, 2010, 2:27am
 
I've signed just the core.jar 'cause the keytool via terminale doesn't permit to sign 2 or 3 jars together. I've tried first to sign chiara_3_terra.jar, then with the twitter... and nothing appears. Just signed the core.jar the applet appears online. I know very strange... anyway solved.
thanks, Chiara
Re: twitter4j applet problem
Reply #7 - May 22nd, 2010, 3:03am
 
Signing is still a mysterious operation for us... (black art!) Smiley
Thanks for sharing your finding.
Re: twitter4j applet problem
Reply #8 - May 23rd, 2010, 10:13am
 
yeah very misterious Wink
I had to sign all the 3 jars via terminal, but one by one.. now if somebody open the web page where the applet is placed, before to see it, will have to accept 3 security certificates! There is no way to sign all the jars together via terminal doing just one certificate.
Chiara
Page Index Toggle Pages: 1