File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Null URL Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Null URL Exception" Watch "Null URL Exception" New topic

Null URL Exception

Darren Jackson
Ranch Hand

Joined: Jan 18, 2007
Posts: 42
I am trying to connect to a servlet via a MIDlet.

However I am getting a Null URL Exception error.

Does this mean anything to anyone?

Here is my code.

Any help would be great.


Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

You're never testing that the value returned here:

String url = getAppProperty("http://localhost:8080/midp/thename");

is not null, so it might be... and in fact, almost certainly is. The argument to this method is supposed to be the name of a property, like APP_URL or something; the value of the property would be the actual URL. You could start by simply changing above to

String url = "http://localhost:8080/midp/thename";

and see if things work; then look into properly storing this url in your JAD file under a name like APP_URL .

[Jess in Action][AskingGoodQuestions]
Darren Jackson
Ranch Hand

Joined: Jan 18, 2007
Posts: 42
Thank you.

All sorted now :-).
I agree. Here's the link:
subject: Null URL Exception
It's not a secret anymore!