This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse - The import javax.servlet.http.HttpServletRequest cannot be resolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse - The import javax.servlet.http.HttpServletRequest cannot be resolved" Watch "Eclipse - The import javax.servlet.http.HttpServletRequest cannot be resolved" New topic
Author

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

Jon Koon
Greenhorn

Joined: Jun 04, 2009
Posts: 2
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

Joined: Mar 22, 2000
Posts: 12759
    
    5
Sounds like an eclipse classpath problem to me, not a servlet or Tomcat problem.

Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jon Koon
Greenhorn

Joined: Jun 04, 2009
Posts: 2
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.
 
jQuery in Action, 2nd edition
 
subject: Eclipse - The import javax.servlet.http.HttpServletRequest cannot be resolved
 
Similar Threads
How to use the server-side ?
Tomcat deployement Problem SEVERE: Error listenerStart
All of a sudden many of my imports are underlined in red, that goes away when I retype them..
How to use Eclipse ee
The type javax.servlet.http.HttpServletRequest cannot be resolved. iIt is ndirectly referenced...