• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse - The import javax.servlet.http.HttpServletRequest cannot be resolved

 
Jon Koon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just switched to plain old Eclipse from MyEclipse for development, and my struts application was running great. But now I am getting this error "The import javax.servlet.http.HttpServletRequest cannot be resolved" over and over again but inconsistently. Sometimes my app runs with no problems and sometimes I get the error. A lot of times I can fix it by removing the project from the server and then adding it again within the Eclipse -> Server interface. It is an especially painful issue, becuase it is inconsistent.

Here is an excerpt of the error

SEVERE: Error creating form bean of class com.****.struts.beans.*********
java.lang.Error: Unresolved compilation problem:
The import javax.servlet.http.HttpServletRequest cannot be resolved

I'm new to the forum, so I appreciate any guidance.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like an eclipse classpath problem to me, not a servlet or Tomcat problem.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.
 
Jon Koon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that. Thanks for moving the post for me.

I have added j2ee.jar and javaee.jar to the classpath, but I still get the error every time I make a change to the source code and the context is reloaded into Tomcat.

[Edit]

So I think that I just misunderstood how Eclipse interacts with Tomcat. This FAQ helped out a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic