Question

i'm new to java and i got some problems. i'm developping a web application using the framework stripes on tomcat 6.0. I'm working with eclipse EE on windows. i successfully managed to get the stripes example application (called Bugzooky) up and running on my tomcat server. I imported the .war file and stripes libs in Eclipse. Here is the stripes archive containing the examples and libs


But now i'm trying to change the example source files to learn how does it work. but whatever the modification made to the source files "WebContent/WEB-INF/src/*.java", nothing change! even after restarting the server. i noticed that the classes are compiled into .class files in the "ImportedClasses" folder, and tomcat always use these files, they are never updated, and if i removed one of them, the application just don't start. it look like my source files don't exists!


I also tried to build my webapp from scratch, but when i tried to use the features used in the example files (like SecurityFilter.java):

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import ...

It ends up with plenty of:

the import javax.servlet.Filter cannot be resolved

I checked the Librairies and it look like i'm using exactly the same as the example.


It's probably something i didn't understood about java but i googled 100 times yesterday, and i can't find the solution (i probably didn't search the right place because i don't really understand my problem).

I hope you'll be able to help me.

Was it helpful?

Solution

I'm not sure about the first problem. With regard to the problem when creating a new project:

the import javax.servlet.Filter cannot be resolved

This means that the web project in Eclipse is not associated with an application server. If this is done correctly, then Eclipse will automatically include the server's libraries (the server is actually a concrete implementation of under each the Servlet API) in the project's buildpath.

Did you integrate Tomcat in Eclipse? You can add servers in the Servers view at the right bottom box. Did you associate the web project with the particular Tomcat instance? You need to select the server in the Targeted Runtimes section of the project's Properties. This is by the way normally to be done during creating the Dynamic Web Project.

OTHER TIPS

You need to recompile all the changed .java files, rebuild the .war file and redeploy it to Tomcat. This is most easily done with an Ant build script. Look for a file called build.xml. If it is there install Ant if you don't already have it installed and you can then just execute the ant command in the directory with the build.xml file and then copy the resulting .war file over the existing one in Tomcat. This is all basic Java App server work flow stuff.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top