Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 13
Registered: ‎06-03-2011
My Device: Various
My Carrier: Various

JVM Error 104 Uncaught: NullPointerException

JVM Error 104 Uncaught: NullPointerException


I have a simple PhoneGap test that shows the current location on a Google map.


It is very similar to the PhoneGap Geolocation Sample Application except it does not use a static map (http://wiki.phonegap.com/w/page/16494764/PhoneGap-Geolocation-Sample-Application).

See the code below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">



    <meta name="viewport" content="width=device-width; height=device-height; user-scalable=no" />

    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />


    <script type="text/javascript" src="x-javascript/phonegap."></script>

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <script type="text/javascript" src="x-javascript/json2.js"></script>

    <script type="text/javascript">


        function loader() {


            var state = document.readyState;


            if (state == 'loaded' || state == 'complete') {


            } else {

                if (navigator.userAgent.indexOf('Browzr') > -1) {

                    setTimeout(run, 250);

                } else {

                    document.addEventListener('deviceready', run, false)





        function run() {


            var win = function (position) {


                // Grab coordinates object from the Position object passed into success callback.

                var coords = position.coords;

                alert("lat:" + coords.latitude + " lng:" + coords.longitude);


                var myLatLng = new google.maps.LatLng(coords.latitude, coords.longitude);


                var options = {

                    zoom: 12,

                    center: myLatLng,

                    mapTypeId: google.maps.MapTypeId.ROADMAP



                var map_canvas = document.getElementById("map");


                var map = new google.maps.Map(map_canvas, options);


                // Place markers

                var bounds = new google.maps.LatLngBounds();


                var marker = new google.maps.Marker({

                    position: myLatLng, title: "Home"






            var fail = function (e) {

                alert('Can\'t retrieve position.\nErrorCode: ' + e.code + "\nMessage:" + e.message);



            var options = {};

            options.enableHighAccuracy = true;

            options.timeout = 5000;

            options.maximumAge = 3000;


            navigator.geolocation.getCurrentPosition(win, fail, options);




<body onload="loader();">

    <div id="map" style="width: 300px; height: 400px; border: solid 1px #333">






My problem is that the alert fires correctly showing that the gps position has been retrieved but then the BlackBerry Emulator displays JVM Error 104 Uncaught: NullPointerException error.

Can anyone tell me what is causing this error?

Thanks – Desparate!

Posts: 13
Registered: ‎06-03-2011
My Device: Various
My Carrier: Various

Re: JVM Error 104 Uncaught: NullPointerException

I have used Bing Maps api v7 instead of Google maps.


Using the Bing Maps api v7 does NOT throw a JVM Error 104 Uncaught: NullPointerException unlike Google Maps.


Can anyone explain why Google Maps throws an error in the simulator (9800 OS6) but Bing Maps api does not??

New Member
Posts: 1
Registered: ‎07-15-2011
My Device: non-BlackBerry user
My Carrier: developer

Re: JVM Error 104 Uncaught: NullPointerException

this same error is displayed on my blackberry application too...in my application, i was trying to conect to a url using the HTTP method POST, to request for a transaction detail and then get a response ..but it gives this error instead..but this same application works perfectly on other mobile apart from Blackberry...