JVM Error 104, Uncaught: ClassCastException on BlackBerry

199 views
Skip to first unread message

Vidal Graupera

unread,
Jan 14, 2010, 11:55:42 AM1/14/10
to phonegap
Hi,

I am using the latest BB version from http://github.com/phonegap/phonegap-blackberry.

I cam compile and run the phonegap sample. BTW, I still need to change

private static final String DEFAULT_INITIAL_URL = "data:///
index.html";

in PhoneGap. java because otherwise nothing works, but I have already
reported that previously.

Now I replace index.html with my own HTML file, change nothing else,
rebuild and reinstall. This HTML file works fine in the native
browser.

I get "JVM Error 104, Uncaught: ClassCastException" and PhoneGap
crashes.

I am using Eclispe 3.4.1 and the Blackbery 4.7.0 component package.

Vidal

filmaj

unread,
Jan 14, 2010, 1:13:57 PM1/14/10
to phonegap
The constant you have posted is not what exists in the repository you
linked to...

http://github.com/phonegap/phonegap-blackberry/blob/master/framework/src/com/nitobi/phonegap/PhoneGap.java#L67

The value of that constant is 'data:///www/index.html', which
corresponds to the file located under framework/src/www/index.html, or
this file:

http://github.com/phonegap/phonegap-blackberry/blob/master/framework/src/www/index.html

As long as you include the contents of the framework folder in a
BlackBerry application project, you should be OK. What are you
changing it to that 'fixes' your project? You also mention 'nothing
works' if you don't change that line - what do you mean by this?

As for the exception, have you tried placing a breakpoint, turning on
debugging mode and seeing where the exception occurs / what is causing
it? Without more information I cannot reproduce the issue, and thus
cannot help you, please try to provide as much information as
possible.

Thanks,
Fil

On Jan 14, 8:55 am, Vidal Graupera <vgraup...@gmail.com> wrote:
> Hi,
>

> I am using the latest BB version fromhttp://github.com/phonegap/phonegap-blackberry.

Vidal Graupera

unread,
Jan 14, 2010, 1:39:10 PM1/14/10
to phonegap
Hi,

Yes, the initial value is

private static final String DEFAULT_INITIAL_URL = "data:///www/
index.html";

that causes the app to crash on start up.

I have to change it to

private static final String DEFAULT_INITIAL_URL = "data:///
index.html";

for phonegap to not die with JVM 104 Uncaught exception on startup.
That is the only think I changed. Phonegap then works. When i replace
index.html and rebuild then it fails with Uncaught:
ClassCastException.

Where should I place the breakpoint and how do I turn on debugging
mode exactly? If you give me some steps I can send you stack trace,
etc.

Vidal.

On Jan 14, 10:13 am, filmaj <filip....@nitobi.com> wrote:
> The constant you have posted is not what exists in the repository you
> linked to...
>

> http://github.com/phonegap/phonegap-blackberry/blob/master/framework/...


>
> The value of that constant is 'data:///www/index.html', which
> corresponds to the file located under framework/src/www/index.html, or
> this file:
>

> http://github.com/phonegap/phonegap-blackberry/blob/master/framework/...

Vidal Graupera

unread,
Jan 14, 2010, 1:41:01 PM1/14/10
to phonegap
Fil,

Are you using eclipse 3.4.1 and component pack 4.7.0 under XP? If not,
what is a working configuration? I would like to eliminate my
configuration as a problem.

Thanks,

Vidal.

filmaj

unread,
Jan 14, 2010, 2:09:34 PM1/14/10
to phonegap
Hi Vidal,

Currently, I use Eclipse 3.4 on Windows 7 x64 Ultimate. However,
before the new year I used Eclipse 3.4.1 on Windows XP 32bit. Both
environments worked fine for me.

Vidal, interesting with the DEFAULT_INITIAL_URL value. In your Eclipse
project, you should see a 'src' directory under the project root.
Inside that directory, you should see a 'www' directory. All of your
web assets should reside in that www directory. Here's what the
PhoneGap BlackBerry Eclipse project structure looks like for me when I
load it up:

http://nitobi.com/fil/eclipse_bb_proj.png

If you are having to change the DEFAULT_INITIAL_URL to data:///index.html,
then I think you are missing the www directory (and all of your web
assets reside in the 'src' directory, then).

To grab a stack trace, you should be able to simply run the
application in debug mode - the debugger will stop automatically at
the exception, at which point you can view the stack trace and see
what is causing it. You can click on the little bug icon in your
Eclipse toolbar and select either Simulator or Device. You can also
right-click on the project root, go to Debug As -> and select Device
or Simulator. Screenshot of that:

http://nitobi.com/fil/eclipse_bb_debug.png

Vidal Graupera

unread,
Jan 14, 2010, 8:10:45 PM1/14/10
to phonegap
Hi Fil,

For me it doesn't appear that way although the files on the harddrive
are in the www folder.

http://picasaweb.google.com/lh/photo/IVVAfC8PwzSnpmrVjpWj-A?feat=directlink

I got a stack trace as well.

http://picasaweb.google.com/lh/photo/cYA4RReiwHZP886uSHio_Q?feat=directlink

Vidal.

Vidal Graupera

unread,
Feb 17, 2010, 7:11:35 PM2/17/10
to phonegap
Hi Fil,

Any chance someone can look at this?

I pulled the latest phonegap-blackberry code and it still fails for me
out of the box.

If anyone else has phonegap working on BB I would love to know how you
got around these problems.

Thanks,

Vidal.

On Jan 14, 5:10 pm, Vidal Graupera <vgraup...@gmail.com> wrote:
> Hi Fil,
>
> For me it doesn't appear that way although the files on the harddrive
> are in the www folder.
>

> http://picasaweb.google.com/lh/photo/IVVAfC8PwzSnpmrVjpWj-A?feat=dire...


>
> I got a stack trace as well.
>

> http://picasaweb.google.com/lh/photo/cYA4RReiwHZP886uSHio_Q?feat=dire...


>
> Vidal.
>
> On Jan 14, 11:09 am, filmaj <filip....@nitobi.com> wrote:
>
>
>
> > HiVidal,
>
> > Currently, I use Eclipse 3.4 on Windows 7 x64 Ultimate. However,
> > before the new year I used Eclipse 3.4.1 on Windows XP 32bit. Both
> > environments worked fine for me.
>
> >Vidal, interesting with the DEFAULT_INITIAL_URL value. In your Eclipse
> > project, you should see a 'src' directory under the project root.
> > Inside that directory, you should see a 'www' directory. All of your
> > web assets should reside in that www directory. Here's what the
> > PhoneGap BlackBerry Eclipse project structure looks like for me when I
> > load it up:
>
> >http://nitobi.com/fil/eclipse_bb_proj.png
>
> > If you are having to change the DEFAULT_INITIAL_URL to data:///index.html,
> > then I think you are missing the www directory (and all of your web
> > assets reside in the 'src' directory, then).
>
> > To grab a stack trace, you should be able to simply run the
> > application in debug mode - the debugger will stop automatically at
> > the exception, at which point you can view the stack trace and see
> > what is causing it. You can click on the little bug icon in your
> > Eclipse toolbar and select either Simulator or Device. You can also
> > right-click on the project root, go to Debug As -> and select Device
> > or Simulator. Screenshot of that:
>
> >http://nitobi.com/fil/eclipse_bb_debug.png
>

> > On Jan 14, 10:41 am,VidalGraupera <vgraup...@gmail.com> wrote:
>
> > > Fil,
>
> > > Are you using eclipse 3.4.1 and component pack 4.7.0 under XP? If not,
> > > what is a working configuration? I would like to eliminate my
> > > configuration as a problem.
>
> > > Thanks,
>
> > >Vidal.
>

filmaj

unread,
Feb 18, 2010, 6:18:55 PM2/18/10
to phonegap
Vidal,

Your HTML/CSS/JS assets are still not in the proper directory. I will
point you again to a screenshot of what my BlackBerry project looks
like in Eclipse:

http://nitobi.com/fil/eclipse_bb_proj.png

Compared to your project structure:

http://picasaweb.google.com/lh/photo/IVVAfC8PwzSnpmrVjpWj-A?feat=directlink

Notice how my HTML/CSS/JS sits in a 'www' directory, whereas your
assets sit directly in the root directory. The GitHub repository also
has this structure: under the 'src' folder there is a 'www' folder
that contains the HTML/CSS/JS assets. This is visible on the public
repository: http://github.com/filmaj/phonegap-blackberry/tree/master/framework/src/www/

I do not know why your project does not honour this structure.

You have to make sure your project exists in this 'www' directory
otherwise references to your application HTML/CSS/JS will point to non-
existent files and throw NullPointerExceptions.

Like I said, the GitHub repository contains this structure, so if you
execute this command from your shell / Git Bash / wherever you have
access to Git from:

git clone git://github.com/phonegap/phonegap-blackberry.git

... you will generate a new phonegap-blackberry directory, with a
framework/src/www directory under it. Try to keep this structure and
put your HTML/CSS/JS into this directory, otherwise the pathing and
file referencing will be messed up.

Reply all
Reply to author
Forward
0 new messages