Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9059961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:06:06+00:00 2026-06-16T15:06:06+00:00

I am trying to send a String[] array in j2me using ObjectOUputStream , but

  • 0

I am trying to send a String[] array in j2me using ObjectOUputStream, but i keep getting this error,

java.lang.IllegalArgumentException: Not an HTTP URL

Here is my code:

    OutputStream os=null;
    HttpConnection hc= null;
    ObjectOutputStream oj=null;

    //get the URL
    String serverURL=entry.getUrl();

    hc=(HttpConnection)Connector.open(serverURL, Connector.READ_WRITE, true);
    hc=(HttpConnection)Connector.open(serverURL);


    hc.setRequestMethod (HttpConnection.POST);
    hc.setRequestProperty ("Content-Type", "application/x-www-form-urlencoded");
    hc.setRequestProperty ("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");
    hc.setRequestProperty ("Content-Language", "en-US");

    System.out.println ("Posting to the URL: " + entry.getVectorParams());

    //open the output stream to send the post parameters
    //os=hc.openOutputStream();

    oj=(ObjectOutputStream)hc.openOutputStream();
    //writing post parameters
    String[] bg=entry.getVectorParams();

    oj.writeObject(bg);

Please give a suggestion.

I checked my URL, it is correct and regarding Connector.open(), i pasted it twice here, not in my actual code. Is there anything else that I am doing wrong?

The System.out.println("Posting to the URL: " + entry.getVectorParams()), this only prints the post parameters, I have the serverurl passed in here:

String serverURL=entry.getUrl();
hc=(HttpConnection)Connector.open(serverURL, Connector.READ_WRITE, true);

My server URL is : http://localhost:8080/Web/gServer.jsp

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:06:08+00:00Added an answer on June 16, 2026 at 3:06 pm

    The value of your serverURL variable must not be a valid URL. Try printing it out, and checking.

    You have this debug statement:

    System.out.println ("Posting to the URL: " + entry.getVectorParams());
    

    but that is printing out the params, not the url. You should print out the serverURL variable.

    Also, you are calling Connector.open() twice in a row. There’s no need for that.

    Update: I also think there could be a problem with the way you’re writing the POST parameters to your connection’s OutputStream. I wouldn’t use an ObjectOutputStream. See something like this for an example of making J2ME POST calls. Basically, you make a String of the POST parameters, separated by &, and then use String.getBytes() to convert to a byte[] for writing to the OutputStream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am trying send an array to php file using $_POST ,still always getting an
I'm trying to send an e-mail using the Java mail API. But my e-mail
I have a string array like {myname,yourname,hisname} and I am trying to send this
I am trying to send string array from web service to android application using
I'm trying to send a String[] over an open socket connection but it's doesn't
:) I'm trying to send an XML using curl but not as post parameter.
I am trying to send the database Array by using the method below: OracleConnection
I'm trying to send some data from c++ to java using JNI. In c++
I'm trying to send an array of hexadecimal values through an udp socket but
Im trying to send a array to my method with $.post() but Im kinda

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.