The Artima Developer Community
Sponsored Link

Java Answers Forum
java.io.FileNotFoundException: http://localhost:8080

16 replies on 2 pages. Most recent reply: Nov 27, 2005 9:16 PM by Kondwani Mkandawire

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 16 replies on 2 pages [ 1 2 | » ]
Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

java.io.FileNotFoundException: http://localhost:8080 Posted: Jul 4, 2005 7:39 AM
Reply to this message Reply
Advertisement
Hi Folks:

I have a perfectly functional Applet (atleast before it
attempts a connection to a DatabaseServlet that I have
implemented).

I have a Servlet that is meant to spit out Data upon
various requests connecting to a Database via some
Hibernate modules (successfully tested separately).

Unfortunately I receive the following error in my
Java Console when I try to run it through a browser.

java.io.FileNotFoundException: http://localhost:8080/MyLib.MyServlet

MyApplet and Servlet are packaged in the same war file,
and I have verified the Servlets location.

I have tried to repackage the Servlet by sticking
it at root:

http://localhost:8080/MyServlet

with no success.

This line of code here seems to be the cause of
pain.

URL url = new URL(getCodeBase(), "MyServlet");

This is within my applet class and causes an
IOException. Any assistance would be appreciated.

Thanks in advance...
Spike


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080">http://l Posted: Jul 4, 2005 8:16 AM
Reply to this message Reply
I stuck a triple slash in the url code and I now get:

java.net.ConnectException: Connection refused

URL url = new URL(getCodeBase(), "http:///localhost:8080/MyServlet")

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Jul 4, 2005 10:58 PM
Reply to this message Reply
Do you have a running http server?

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Jul 4, 2005 11:42 PM
Reply to this message Reply
default JBoss (Tomcat) Listening at Port 8080

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Jul 5, 2005 1:58 AM
Reply to this message Reply
I initially thought it was the Hibernate Modules
which my server uses (my hibernate is configured
to connect on a different port) but commenting the
hibernate parts out in my Servlet doesn't help
any.

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Jul 5, 2005 6:54 AM
Reply to this message Reply
I finally got it or am at least a step toward
achieving what I wanted (now just a Q of packaging
libraries in the right place).

I don't quite understand the concepts of J2EE
and was not too familiar with the directory
structure.

In all honesty, not to knock on the Java J2EE
tutorial, but its not exactly explicit in terms
of what fits where from a directory angle.

I found a great tutorial right here:

http://www.roseindia.net/jboss/

Straight to the point. It doesn't trod over
stuff that one who is about to tackle J2EE should
already know (e.g. how to match xml tags - lol).

Anyways, thanks Depaak

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Jul 6, 2005 8:09 AM
Reply to this message Reply
Finally managed!! All to do with placing things in the
right spot, Object Serialization and a simple 4T
architecture: Applet - Servlet - Hibernate Module
- Free Source Database and the reverse.

Applet - Servlet interaction happens by passing back
and forth Serialized Objects - I used Properties
though I might customize my own Class for extended
use (don't know if that is even necessary).

Life is great when things are going right -
for a change :O)

Spike

Iso Wane

Posts: 1
Nickname: iso
Registered: Aug, 2005

Re: java.io.FileNotFoundException: <a href="http://localhost:8080">http://localhost:8080</a> Posted: Aug 8, 2005 5:09 AM
Reply to this message Reply
Hi Kondwani,
Did you find a solution to your problem?

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Aug 8, 2005 5:35 AM
Reply to this message Reply
To which part? My solution was a multi-tiered scene in which I had my Applet as a
Client (It knew nothing about the database), it would send out requests to a Servlet
such as: "table=search_category" Forgive me if I'm a little bit off, but that was
a month or two ago so I can't remember the specifics right down to detail.
It communicated with a Servlet that called upon Hibernate type objects

(there are a fair deal of hibernate tutorials - btw. Hibernate is a great tool,
once learned, will make your life 100 times easier).

My Hibernate modules ran Sessions against a local postgres database that was on
my machine (configured to run by a postgres-jdbc driver.

So in summary as explained above you have:

An Applet - communicates with a Servlet,
A Servlet - communicates with a Hibernate Module (This will take a Fair
deal of configuration via. XML files - the coding is not as much though)
- apparently there is a tool that does the configurations for you - its
called Middlegen)

The Hibernate Modules connect to the Database, and a simple session.save(something);
writes to the database table the appropriate object.

It is quite a bit of work, probably the hardest bit being the XML mappings if
you are to generate them yourself.

I'd suggest you work on each communication level separately e.g.
Make sure that your Applet and Servlet can interchange data before
you move onto Servlet - Hibernate communication, etc...

For Applet Servlet Communication refer to:

http://www.unix.org.ua/orelly/java-ent/servlet/

Good luck

Tomas Barrios

Posts: 2
Nickname: tbarrios
Registered: Sep, 2005

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Sep 24, 2005 4:04 PM
Reply to this message Reply
I have a Web app that is based on an applet that gets data form another classes that are based on Hibernate, but not from a servlet. When i deploy it using Eclipse there is no problem, the applet gets the data find. But when i deploy it by web (On a tomcat server) it get a lot of errors. Also i had to replicate all my jars on the dir where the the applet is.
Im getting some errors really strange. Mainly i want to know what are the correct steps to deploy an applet on a web server and get it to comunicate with my Hibernate classes.

Thanks

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Sep 25, 2005 10:35 PM
Reply to this message Reply
Your hibernate modules cannot directly communicate with
your web application, you will have to write a Servlet
that links to your hibernate modules. That is what
your applet will be communicating with.

I did this a while back but if I remember correctly your
Applet will have code such as:

Properties prop = new Properties();
prop.put("search_books", "To kill a Mocking Bird");
send(prop);

Send will be based on the implementation of the URL
I posted above (Applet Servlet communication).

Your Servlet as ussual will have its doGet and doPost
which will call methods that link to your database
(I placed those methods in the same Servlet class
to avoid confusuion), methods such as:

searchBook(String book) or searchISBN(String isbn)
or what ever it is you are searching.

good luck,
Kondwani

Tomas Barrios

Posts: 2
Nickname: tbarrios
Registered: Sep, 2005

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Oct 10, 2005 3:41 PM
Reply to this message Reply
thanks for your reply, im now changing to a applet servlet architecture.
I made an applet that comunicates with a servlet but when i try to get a class that was generated by hibernate mapping i get an
java.lang.ClassNotFoundException: org.hibernate.proxy.SerializableProxy

I really have made a lot of effort solving this, but still no progress...

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Oct 11, 2005 12:33 AM
Reply to this message Reply
The package org.hibernate.proxy is part of hibernate.
I use hibernate 3 - I guess that's what you can
use, make sure that your ClassPath includes to
the hibernate3.jar file.

Ahsan Safdar

Posts: 2
Nickname: cdbever
Registered: Nov, 2005

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Nov 23, 2005 10:14 PM
Reply to this message Reply
Dear Kondwani,

In beginning of your thread you have mentioned a FileNotFoundException when trying to communication from the Applet to the Servlet.

I am going through a similar sort of problem, and have been trying to resolve it for the last couple of weeks. I have tried putting the applet in the same package as the servlet, in the root directory and various combinations of how to address the servlet from the applet. None seems to work.

Similar to your case, the servlet has been tested separately and the same URL works fine if i call from the browser.

Here is the call from the applet.
URL imageURL = new URL(getCodeBase(), "/GEFT/ImageRetriever");
        URLConnection connection = imageURL.openConnection();

The applet issues the following Exception on the above attempt to connect
java.io.FileNotFoundException: "http://localhost:8084/GEFT/ImageRetriever"

You mentioned that you got around this problem. Could you guide me on how you did it.
Thanx
Ahsan

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: java.io.FileNotFoundException: <a href="http://localhost:8080"><a href= Posted: Nov 23, 2005 11:19 PM
Reply to this message Reply
> Here is the call from the applet.
>
URL imageURL = new URL(getCodeBase(),
> "/GEFT/ImageRetriever");
> URLConnection connection =
> ection = imageURL.openConnection();

> The applet issues the following Exception on the above
> attempt to connect
> java.io.FileNotFoundException:
> "http://localhost:8084/GEFT/ImageRetriever"
>
Wow!! That was a while back. Just a few Q's:

Is your Servelt called Image Retriever?

If so let it default to sending/posting a string anyways,
i.e. let it print out "Successfully Accessed Server"
if it gets a request other than the one Supplied from
your Applet.

Then try running your Tomcat, JBoss or whatever App.
Server you're using and access the Servlet directly and
see if it displays what you want.

// You see to be using port 8084, are you sure this is
// the correct place at which your Server listens?
E.g. http://localhost:8080/GEFT/TheServlet

Where TheServlet is the name of your Servlet. E.g.
ImageRetriever. If it doesn't print out:
"Successfully Accessed Server" then your Servlet
is not being accessed correct in the first place.
Might be that 8084 is not the correct port at which
your Server runs or it might be that you have not placed
the correct directory.


> You mentioned that you got around this problem. Could you
> guide me on how you did it.
> Thanx
> Ahsan

Flat View: This topic has 16 replies on 2 pages [ 1  2 | » ]
Topic: spam Previous Topic   Next Topic Topic: Caller Id using JTAPI

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use