Android application trying out rss feed read using Rome. Getting exception ExceptionInInitializerError

by MCON Dev » Sun, 12 Jul 2009 20:04:58 GMT


Sponsored Links
 Hello All,
I am trying to write some test code to receive RSS feeds. I am using the
ROME api's. But I am getting a exception when executing the following line
of code
  SyndFeed feed = new SyndFeedInput().build(reader);
I googled this exception and found the following. I dont know if thats
helpful or not. Please advice me on my next steps.
"Ok, I figured it out after traversing through the Rome code.
ClassLoader isn't supported by Android's DalvikVM. Is there an
implementation of this project that doesn't use ClassLoader?"
*Exception Stack*
Thread [<3> main] (Suspended (exception ExceptionInInitializerError))
 SyndFeedInput.build(Reader) line: 123
 MainActivity.onCreate(Bundle) line: 42
 Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1123
 ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord) line:
2231
 ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord) line:
2284
 ActivityThread.access$1800(ActivityThread, ActivityThread$ActivityRecord)
line: 112
 ActivityThread$H.handleMessage(Message) line: 1692
 ActivityThread$H(Handler).dispatchMessage(Message) line: 99
 Looper.loop() line: 123
 ActivityThread.main(String[]) line: 3948
 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean)
line: not available [native method]
 Method.invoke(Object, Object...) line: 521
 ZygoteInit$MethodAndArgsCaller.run() line: 782
 ZygoteInit.main(String[]) line: 540
 NativeStart.main(String[]) line: not available [native method]


*Code*

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;

import android.app.Activity;
import android.os.Bundle;
import com.sun.syndication.*;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class MainActivity extends Activity
{
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  URL url;
  try
  {
  url = new URL(" http://viralpatel.net/blogs/feed" ;);
  }
  catch (MalformedURLException e1)
  {
  // TODO Auto-generated catch block
  e1.printStackTrace();
  return ;
  }
  XmlReader reader = null;

  try
  {
  reader = new XmlReader(url);
  SyndFeed feed = new SyndFeedInput().build(reader);
  System.out.println("Feed Title: "+ feed.getAuthor());
  for (Iterator i = feed.getEntries().iterator(); i.hasNext();)
  {
  SyndEntry entry = (SyndEntry) i.next();
  System.out.println(entry.getTitle());
  }
  }
  catch (IllegalArgumentException e)
  {
  e.printStackTrace();
  }
  catch (FeedException e)
  {
  e.printStackTrace() ;
  }
  catch (IOException e)
  {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  /*finally
  {
  if (reader != null)
  try
  {
  reader.close();
  } catch (IOException e)
  {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  } */
  }
}

--~--~---------~--~----~------------~-------~--~----~



Android application trying out rss feed read using Rome. Getting exception ExceptionInInitializerError

by android_dev » Thu, 30 Jul 2009 01:26:47 GMT


 i,

I'm having the same error when using ROME api on Android. Were you
able to figure out the issue? Please let me know the details if
resolved.

-Thanks.

On Jul 12, 5:04am, MCON Dev <mcon...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Android application trying out rss feed read using Rome. Getting exception ExceptionInInitializerError

by Tomas » Fri, 31 Jul 2009 02:57:46 GMT


 've been digging into this, as I was hoping to use ROME for a project
on Android. So far I've had little luck.

The problem lies in ROME's use of the java.beans package, which is
part of the dependencies mentioned on
http://wiki.java.net/bin/view/Javawsxml/Rome
(in particular the point "J2SE 1.4+"). If you go to Ed Burnette's blog
you can find a listing of what IS and ISN'T in the Android runtime
(http://blogs.zdnet.com/Burnette/?p=504) and on the no-go list you
find java.beans.

I've been digging through the ROME source-code to see if the
java.beans packages usage was something easily removed, but it seems
quite central to how ROME works. I am still digging, and if I find a
way I will release a fork of ROME without java.beans usage for Android
use (but don't hold your breath, it might be a while).

For now I suggest you have a look at other RSS libraries in Java. I'm
a bit new to RSS's so I don't know any off the top of my head - a
google tells me that Informa (http://informa.sourceforge.net/) and
the apache commons feedparser (http://commons.apache.org/sandbox/
feedparser/) might be alternatives. These may have similar problems, I
just don't know yet.

I hope this helps!
-Tomas Ekeli

On Jul 29, 5:14am, android_dev <getvi...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Android application trying out rss feed read using Rome. Getting exception ExceptionInInitializerError

by Tomas » Fri, 31 Jul 2009 02:57:57 GMT


 've been digging into this, as I was hoping to use ROME for a project
on Android. So far I've had little luck.

The problem lies in ROME's use of the java.beans package, which is
part of the dependencies mentioned on
http://wiki.java.net/bin/view/Javawsxml/Rome
(in particular the point "J2SE 1.4+"). If you go to Ed Burnette's blog
you can find a listing of what IS and ISN'T in the Android runtime
(http://blogs.zdnet.com/Burnette/?p=504) and on the no-go list you
find java.beans.

I've been digging through the ROME source-code to see if the
java.beans packages usage was something easily removed, but it seems
quite central to how ROME works. I am still digging, and if I find a
way I will release a fork of ROME without java.beans usage for Android
use (but don't hold your breath, it might be a while).

For now I suggest you have a look at other RSS libraries in Java. I'm
a bit new to RSS's so I don't know any off the top of my head - a
google tells me that Informa (http://informa.sourceforge.net/) and
the apache commons feedparser (http://commons.apache.org/sandbox/
feedparser/) might be alternatives. These may have similar problems, I
just don't know yet.

I hope this helps!

On Jul 29, 5:14am, android_dev <getvi...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Android application trying out rss feed read using Rome. Getting exception ExceptionInInitializerError

by Tomas » Fri, 31 Jul 2009 02:57:57 GMT


 've been digging into this, and the problem seems to stem from the
fact that ROME uses the java.beans package, which is not included in
the Android runtime.

The java.beans package is central to how ROME works, and not easily
removed. It seems ROME is not coming to Android in the short term.

On Jul 29, 5:14am, android_dev <getvi...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to download firmware in init?

Our driver calls request_firmware() after probe to request firmware
download. Then, init starts ueventd to process uevents according to
its "early-init" action. But ueventd fails to open our firmware under /
etc/firmware during device_init(), because file system hasn't been set
up yet, which is done until init executes its "init" action.

Do I misunderstand init's mechanism? Is there a decent way to handle
firmware download in init?

Thanks

-- 

2. XML or JSON in Android

Hi All,

I am developing an Android application.
Following is my scenario:

1. I parsing XML in android which is hosted on server (same like RSS feed).
2. It takes around 10 second depend on network speed.
3. XML refresh on server in every 15 minutes.

Is there any other way so I can make it more faster then current.
Someone suggest me to use JSON instead of XML.
Can some one suggest me; which format is better from XML and JSON (In 
term of fast execution and easy to use).


regards


--

3. Handle preferences in BroadcastReceiver's

4. For those who are looking for testing their apps on multiple devices:

5. Middle School Android Programming Class

6. Error when i try to convert the minSDK version from 8 to 7

7. Make Money Online