Nik ,
Thank u for the reply . But still I have some doubt . I am using DOJA
KtoolBar , and the Network.jar file is located in
J2MEWSDK4DOJA/apps/network/bin folder . I am not able to access the jar
file from web server . As the Jar file is in the above mentioned folder ,
getSourceUrl() return null . So , I am not able to connect to the Apache web
server any way .
I think , for that I need to run the jar file from web server itself . For
that what I need to do ?
The security exception is coming because , iAppli can only access its
originating server , but in my case , there is no originating server . The
iAppli are located at the current working directory of Doja Toolbar .
Please suggest , what else I need to do ?
Can I run i-appli from webser using DOJA Ktoolbar ?
waiting for ur reply .
dibyendu .
----- Original Message -----
From: "Nik Frengle" <eseller@eimode.com>
To: <keitai-l@appelsiini.net>
Sent: Tuesday, November 27, 2001 7:18 AM
Subject: (keitai-l) Re: Accesng web server
> Dibyendu,
> The HttpConnection will only work if the address is exactly the same as
that
> from which the jam file was downloaded. Even if you can get the jam file
in
> a number of ways (ie, through an ip number, a domain, a localhost, etc)
you
> better be very sure that you use exactly the same way as you use in your
> code. There is an easy way to fix that:
>
> Change this: HttpConnection hc =
> (HttpConnection)Connector.open("http://localhost:80/abc.txt");
>
> to this: HttpConnection hc =
> (HttpConnection)Connector.open(getSourceURL()+"/abc.txt");
>
> Then you just have to make sure that anything you are using HttpConnection
> to get is on the same server as the jam and jar files are.
>
> I have never seen the package URL mismatch error, so I can't say with any
> authority, but it could also come from not having a proper pointer to the
> jar file. The DoJa KToolbar does this automatically, adding to the jam
file
> something like this:
>
> PackageURL = network.jar
>
> Also, though that error message doesn't seem to indicate it, make sure you
> have this line in your jam file:
>
> UseNetwork = http
>
> Finally, if you are using KToolbar, be sure to add a value for AppClass:
>
> AppClass = network.Network
>
> Sorry if I missed something, and hope this helped.
>
> Nik Frengle
> IntaDev, Inc.
> www.intadev.com
>
> -----Original Message-----
> From: keitai-l-bounce@appelsiini.net
> [mailto:keitai-l-bounce@appelsiini.net]On Behalf Of Dibyendu
> Sent: Monday, November 26, 2001 8:28 PM
> To: keitai-l@appelsiini.net
> Subject: (keitai-l) Accesng web server
> Importance: High
>
>
> dear sir , I wrote a simple iApplication to read a text file from apache
web
> server runing in local machine .
>
> But it is giving the exception ....
> java.lang.SecurityException: package URL mismatch
>
> the code is like this ...
>
> Any one please tell me what is going wrong here . Do i need to configure
> anything for that ?
>
>
> import com.nttdocomo.ui.*;
> import com.nttdocomo.io.*;
> import javax.microedition.io.*;
> import java.io.*;
> import com.nttdocomo.net.*;
> public class Network extends IApplication
> {
> String extractedText;
> public Network () {
> }
> public void start() {
> try{
>
> HttpConnection hc =
> (HttpConnection)Connector.open("http://localhost:80/abc.txt");
>
> hc.setRequestMethod(HttpConnection.GET);
> hc.connect();
> InputStream is = hc.openInputStream();
>
> byte[] text=new byte[(int)hc.getLength()];
> is.read(text);
> String s = new String(text);
> extractedText = "hello";
> is.close();
> hc.close();
> }
> catch(Exception e){
> extractedText = e.toString();
> System.out.println(e.toString());
> e.printStackTrace();
>
> }
> Panel p = new Panel();
> TextBox tb = new TextBox(extractedText, 18,
> 4,TextBox.DISPLAY_ANY);
> p.add(tb);
> Display.setCurrent(p);
> }
> }
>
> regards ,
> Dibyendu .
>
>
> [ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]
[ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]
Received on Tue Nov 27 05:58:20 2001