Reputation: 1736
I'm working in web application. Server used is Apache Tomcat 6. I tried to access resource from mylocalhost http://localhost:8080/examples/README.txt
after running the server. But I can't access the resources showing the error message file not found from the Eclipse. But if I press ctrl+left click on the link, the resource was opening in Eclipse work area. The same resources I can access without going through the server, i.e going to path C:\Program Files (x86)\apache-tomcat-6.0.35\bin
and clicking Startup.bat
. By this way I can open the file. May I know what is reason for not accessing that resources through Eclipse?
url = new URL("http://localhost:8080/examples/README.txt");
con = url.openConnection(); // open the url connection.
dis = new DataInputStream(con.getInputStream());
Upvotes: 1
Views: 236
Reputation: 4629
Here is what i am quoting from the blog mentioned previously
Tomcat actually consists of 2 aspects: a sharable codebase (CATALINA_HOME) and a per-instance part (CATALINA_BASE). This allows multiple copies of Tomcat to run on a single server using one codebase. Most of the time, CATALINA_HOME and CATALINA_BASE are the same value, since more often than not, only one copy of a given version of Tomcat is is use – at least on a developer’s machine.
When you create a Tomcat server using the Eclipse Servers facility, however, it clandestinely creates its own CATALINA_BASE, copying selected files – and only those files into a directory owned by the plugin.
I got burned. I was keeping a file of my own in CATALINA_HOME and using a relative reference to it in server.xml. The file didn’t copy and Tomcat didn’t start clean.
The simplest solution was to edit server.xml and replace the relative path to an absolute path, so that the copied configuration would be able to locate the original (and in this case, the only) copy of my file.
Apparently, however, the copying of the CATALINA_BASE data occurs only when you create a new Server definition. I had to delete the old Server definition from Eclipse and create a new one to get the changes to take.
I have believe from this post as eclipse server copying only selected files and there your file is not getting copied. Just have a look at this post and think if this makes sense to your problem. Ben
Upvotes: 1