Welcome!

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

Reply
New Contributor
Posts: 2
Registered: ‎11-04-2012
My Device: Bold 9000
My Carrier: NA

Always got JVM 104 NullPointerException on Blackberry 9000 (OS 4.6) simulator

Hi,

I am new to BB development and currently working on a website with jQuery 1.6.3 that is required to support blackberry browsers on OS 4.6 + devices. I use the BlackBerry 9000 simulator (Platform: v4.6.0.307) for testing . The site consists of three parts: header, content, footer. The content div is updated using the jquery .load method to load the content dynamically. Everytime when I open the site on the BB 4.6 browser, it throw a JVM 104 nullpointerexception. I tried on BB OS 7.0 simulator and other android/iPhone devices and they use work properly. After serveral tests, I found out if the dynamic html page has a javascript part (no matter its inline or external), then it will give me the error. I tried loading the javascript in different ways like using inline javascript, jquery .getScript, or other methods but they all gave me the same error.  Is there anyway to check what is causing the error as I don't know how to debug a web page on the blackberry 4.6 browser. I trying using javascript alert statement to locate the errorr but no luck. I also used Fiddler to make sure the correct html and external javascript is downloaded to the device dynamically. It just werid that if there is any javascript code loaded dynamically, then it will throw me the error. Please help. Here is my test code:

 

Index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="./js/jquery/jquery-1.6.3.js"></script>
<script src="./js/test.js"></script>
</head>
<body>
	<div id="contentMain" class="contentMain">
		This is test.html
	</div>
</body>
</html>

 Index.js

var Test = new function($){
	this.test = function(){
		alert("testing");
	};
}(jQuery);

$(document).ready(function(){
	$("#contentMain").load("Test2.html");
	Test.test();
});

 

Test2.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function test2() {
    alert('test 2 alert') ;
 }
</script>


</head>
<body>
	<div>
		This is Test2.html
	</div>
	
</body>
</html>