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

Java Development

Reply
Highlighted
Developer
Posts: 83
Registered: ‎02-17-2009
My Device: Not Specified

Unable to make an HttpConnection

Hi everybody,

 

I'm trying to make a simple httpconnection using the 8900 simulator with 4.6.1 and eclipse plug-in. I think I've made everything I should but maybe I'm wrong. I launch the simulator through eclipse and I've checked the "Launch MDS-CS" with simulator.

 

Neither this piece of code, nor my simulator browser are able to stablish a connection. On simulator I get a InterruptedIOException, Local timed out after 120000 .

 

StreamConnection s = (StreamConnection)Connector.open("http://www.google.com");
HttpConnection httpConn = (HttpConnection)s;
int status = httpConn.getResponseCode();

 



I've read that maybe it's that MDS simulator is not really running. How can I Know if it's already running?

 

Thanks in advance

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Unable to make an HttpConnection

You should launch MDS simulator manually or set in JDE to launch MDS along with device simulator.

 

If MDS simulator is not included in your JDE package - get it here:

 

https://www.blackberry.com/Downloads/entry.do?code=060AD92489947D410D897474079C1477

 

select "Blackberry Email and MDS simulators package"

Developer
Posts: 83
Registered: ‎02-17-2009
My Device: Not Specified

Re: Unable to make an HttpConnection

 

I'm already launching MDS along with simulator (at least it's checked in my Run configurations>simulator>general>Launch MDS...) but i don't really know if it's already launched.

 

Anyway, launching it manually using run.bat inside "\net.rim.eide.componentpack4.6.1_4.6.1.23\components\MDS" has the same effect. It doesn't work.

 

Any other idea?

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Unable to make an HttpConnection

Developer
Posts: 83
Registered: ‎02-17-2009
My Device: Not Specified

Re: Unable to make an HttpConnection

Thanks for your help but those path related issues are correctly set in my computer...

 

I'm using jdk1.6.0_12 and I suppose is ok for my blackberry environment. My path is ok,I don't have JAVA_HOME environmental variable (it also doesn't work if I use it), and setBMDSEnv.bat was already ok and I didn't have to check it.

 

Any ideas are welcomed...

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Unable to make an HttpConnection

try to contact devsupport@rim.com
Developer
Posts: 62
Registered: ‎11-24-2008
My Device: Blackberry 9530

Re: Unable to make an HttpConnection

Are you trying to launch run.bat from a command-line console, or are you just double-clicking on it.  When I just double-click on it a new command prompt pops open for a second and then closes -- without actually running the MDS simulator.  However, if I execute "run.bat" from an already open command console, it works just fine.  Try that if you haven't already.


All code is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
Developer
Posts: 83
Registered: ‎02-17-2009
My Device: Not Specified

Re: Unable to make an HttpConnection

[ Edited ]

Thanks for your answer!

I was trying by double-clicking on it. Now I've just tried it using a console and it's the same...as you say a command prompt pops for a second and closes.

 

I keep searching

Message Edited by miskatonic on 02-25-2009 09:43 AM
Developer
Posts: 62
Registered: ‎11-24-2008
My Device: Blackberry 9530

Re: Unable to make an HttpConnection

Is the command prompt you were executing it from running as an administrator if you're using Vista or Win7?


All code is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
Developer
Posts: 83
Registered: ‎02-17-2009
My Device: Not Specified

Re: Unable to make an HttpConnection

I'm using windows xp. My account has administrator privileges if it's what you're asking...