Mason Woods
Mason Woods

Reputation: 1

eclipse and tomcat integration

I have a Tomcat server installed on Eclipse Luna IDE... and I'm developing a Java Enterprise Edition project.

The problem is when I start working a simple "Hello world example" with servlets in a dynamic web application and then run it on the server, I get the output and then when I change the code and save and then run again, it's always the last execution result. even if I define a new server and I run the application on the result won't change and the output stays the same. I tried basically everything, spent hours, and then it started giving me 404 HTTP error, "the requested resource is not available". Nothing seems to be working. Any ideas guys?

Upvotes: 0

Views: 72

Answers (2)

user2173738
user2173738

Reputation:

When resource not available the server issues 404 error code to the browser. Thus you need to provide a URL that match the path to the resource counting from the web content root folder. If you deploy war file the root folder will have the name of the war after extraction of its content to the deployment location.

Eclipse as it is a great IDE for developing Java projects. For the sake of Apache Tomcat Eclipse Integration the plugin is available.

Upvotes: 0

Jean-François Savard
Jean-François Savard

Reputation: 21004

The problem with Java web development is that since the code need to be compiled in bytecode, you need to rebuild the war for all change to take place instead of just refreshing the page. Eclipse have an option to automatically deploy after save but still, if your project is big it may get very annoying.

There is some company that offer product for "hot compiling" but most of them cost a lot of money. I think JRebel is the best one, you could try a 30 days licence which is free if your not planning a long development.

Note that Java are working to fix that as this is very annoying.

As for the 404 error, this mean that the page is not found. Make sure your web.xml is correctly configure (servlet-mapping etc).

If the problem persist for the not found error, try creating a new project and copy the source-code in it.

Check this link on Oracle documentation on how to configure servlet http://docs.oracle.com/cd/E13222_01/wls/docs92/webapp/configureservlet.html

Upvotes: 1

Related Questions