Twitter4j Google App Engine - java.lang.NoClassDefFoundError -
i'm trying create java application on google app engine using twitter4j library.
when create normal ( not google ) app can use twitter4j , works fine. include library in project -> properties -> java build path -> libraries -> add external jars. code:
twitter twitter = new twitterfactory().getinstance(); twitter.setoauthconsumer(consumer_key, consumer_secret); twitter.setoauthaccesstoken(new accesstoken(oauth_token,oauth_token_secret)); try{ responselist<status> = twitter.getusertimeline("medium"); for(status b:a) { system.out.println(b.gettext()); } } catch(exception e) { system.out.println(e.tostring()); }
when create google java project , try initialize twitter error :
java.lang.noclassdeffounderror: twitter4j/twitterfactory @ com.paperbox.helloworldservlet.doget(helloworldservlet.java:26) @ javax.servlet.http.httpservlet.service(httpservlet.java:617) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java:511) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1166) @ com.google.appengine.api.socket.dev.devsocketfilter.dofilter(devsocketfilter.java:74) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.responserewriterfilter.dofilter(responserewriterfilter.java:123) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.headerverificationfilter.dofilter(headerverificationfilter.java:34) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.api.blobstore.dev.serveblobfilter.dofilter(serveblobfilter.java:63) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.utils.servlet.transactioncleanupfilter.dofilter(transactioncleanupfilter.java:43) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.staticfilefilter.dofilter(staticfilefilter.java:125) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.devappservermodulesfilter.dodirectrequest(devappservermodulesfilter.java:368) @ com.google.appengine.tools.development.devappservermodulesfilter.dodirectmodulerequest(devappservermodulesfilter.java:351) @ com.google.appengine.tools.development.devappservermodulesfilter.dofilter(devappservermodulesfilter.java:116) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:388) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java:182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java:765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java:418) @ com.google.appengine.tools.development.devappenginewebappcontext.handle(devappenginewebappcontext.java:97) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ com.google.appengine.tools.development.jettycontainerservice$apiproxyhandler.handle(jettycontainerservice.java:485) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ org.mortbay.jetty.server.handle(server.java:326) @ org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java:542) @ org.mortbay.jetty.httpconnection$requesthandler.headercomplete(httpconnection.java:923) @ org.mortbay.jetty.httpparser.parsenext(httpparser.java:547) @ org.mortbay.jetty.httpparser.parseavailable(httpparser.java:212) @ org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) @ org.mortbay.io.nio.selectchannelendpoint.run(selectchannelendpoint.java:409) @ org.mortbay.thread.queuedthreadpool$poolthread.run(queuedthreadpool.java:582)
twitter4j async direct invoke new thread()
in gae not allowed.
you need modify dispatcherimpl
constructor use gae's threadmanager
create threads.
please ref gae sandbox constratints
Comments
Post a Comment