File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Strange error when uploading files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Strange error when uploading files" Watch "Strange error when uploading files" New topic
Author

Strange error when uploading files

Otmane Malih
Greenhorn

Joined: Oct 03, 2011
Posts: 5
Hi,
I'm working on a j2ee application.
While testing this application on local host, everything works fine.
Now that's deployed to the production, I found some strange errors, for example when I'm uploading a file using forms, this message appears: "The specified URL cannot be found. "
The error above happens only if I used the DNS (ex: www.domaineName.com), but when I'm connected to the application using the IP address everything works fine.
Just to make things clear, here is some examples:
when typing this address www.domain.com/Portal/reclamation
then choosing a file and submitting the form i got : The specified URL cannot be found.
but if I type the IP: xx.yy.zz.aa:8080/Portal/reclamation
I successfully upload any file I want.
Thanks for your help.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Hi,

the adress www.domain.com/Portal/reclamation, is that hidden behind another web server such as Apache HTTPD and then forwarded to IP: xx.yy.zz.aa:8080/Portal/reclamation??

If not, then you should try calling www.domain.com:8080/Portal/reclamation to see that the DNS really points out the IP: xx.yy.zz.aa.

There is no such thing as automatic port resolving in a DNS.
Otmane Malih
Greenhorn

Joined: Oct 03, 2011
Posts: 5
Hi Ove Lindström,
When I'm trying to connect to www.domain.com:8080/Portal i get this error: The page cannot be displayed.
The j2ee application is deployed in a tomcat server.
When you enter www.domain.com it's like you type xx.yy.zz.aa:8080/Portal
The problem exist only if you are connected to our server using DNS
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

If you use the command:



does it give you the same ip as xx.yy.zz.aa?

If not, then the domain is not setup as it should.

You might also have an entry in your host-file that overrides the DNS.

If you type http://xx.yy.zz.aa:8080/Portal does that to give you a "404: Page not found"?
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Otmane Malih wrote:
When you enter www.domain.com it's like you type xx.yy.zz.aa:8080/Portal


Well... No.... there are no such thing a port resolving in a DNS entry. You can do it if you have a proxy that receives all the calls on www.domain.com and forwards them to xx.yy.zz.aa:8080. In Apache HTTPD it is done using the mod_proxy. (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html)

Edit: And, if you have a rule that states "forward everything that comes to www.domain.com to xx.yy.zz.aa:8080/Portal", then all your servlet mappings will be invalid if they are using /Portal.
Otmane Malih
Greenhorn

Joined: Oct 03, 2011
Posts: 5
Ove Lindström wrote:
If you use the command:



does it give you the same ip as xx.yy.zz.aa?


No, it give me an other different ip.

Ove Lindström wrote:
You might also have an entry in your host-file that overrides the DNS.


Where can I find the host-file?

Ove Lindström wrote:
If you type http://xx.yy.zz.aa:8080/Portal does that to give you a "404: Page not found"?


No, it take me to the home page of my application.

For now i think it's a problem of permission. I think when the application tries to write the file to the temp directory, an exception is thrown, so when it tries to log it to the log file an other exception is thrown since the application can't write to the log file

Otmane Malih
Greenhorn

Joined: Oct 03, 2011
Posts: 5
Ove Lindström wrote:
Otmane Malih wrote:
When you enter www.domain.com it's like you type xx.yy.zz.aa:8080/Portal


Well... No.... there are no such thing a port resolving in a DNS entry. You can do it if you have a proxy that receives all the calls on www.domain.com and forwards them to xx.yy.zz.aa:8080. In Apache HTTPD it is done using the mod_proxy. (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html)


Well you were right. The xx.yy.zz.aa:8080/Portal works only on local network.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Otmane Malih wrote:

For now i think it's a problem of permission. I think when the application tries to write the file to the temp directory, an exception is thrown, so when it tries to log it to the log file an other exception is thrown since the application can't write to the log file



No, I think it is because you don't really know your server setup...

I would think that when you enter http://www.domain.com/ it calls server with ip aa.aa.aa.aa that looks at the call and think "Lets forward this to xx.yy.zz.aa:8080/Portal".

The Tomcat at xx.yy.zz.aa then receives the call and tries to interpret it, but can't resolve any mapping that matches.

How does you servlet mapping look like?
Otmane Malih
Greenhorn

Joined: Oct 03, 2011
Posts: 5
Ove Lindström wrote:
Otmane Malih wrote:

For now i think it's a problem of permission. I think when the application tries to write the file to the temp directory, an exception is thrown, so when it tries to log it to the log file an other exception is thrown since the application can't write to the log file



No, I think it is because you don't really know your server setup...

I would think that when you enter http://www.domain.com/ it calls server with ip aa.aa.aa.aa that looks at the call and think "Lets forward this to xx.yy.zz.aa:8080/Portal".

The Tomcat at xx.yy.zz.aa then receives the call and tries to interpret it, but can't resolve any mapping that matches.

How does you servlet mapping look like?


I don't think that's the problem.
Let's say that I have this form:



You will notice that I have an input file here for uploads.
If I leave this input file blank, everything works fine, but when I'm trying to upload a file it crashes.
So the problem is a problem of permission. The application can't write the file to the server.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange error when uploading files