Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java type cannot be resolved

Tags:

java

I have a statement

String pass = com.liferay.portal.util.PortalUtil.getUserPassword(renderRequest);

that causes the following error in eclipse IDE:

The type javax.servlet.http.HttpSession cannot be resolved. It is indirectly referenced from required .class files

Why is this error occuring? I have added an import statement for the type but yet the error remains. How can I remove this error?

Thanks for your help.

like image 277
smauel Avatar asked Apr 08 '09 13:04

smauel


3 Answers

It sounds like you haven't referenced the right libraries. Add a reference to servlet.jar.

like image 58
Jon Skeet Avatar answered Oct 04 '22 00:10

Jon Skeet


You need to put the definition of that class (usually contained in a servlet.jar file) into the build path of your project (right-click on the project, select "Properties" and then "Build Path").

like image 31
Michael Borgwardt Avatar answered Oct 04 '22 00:10

Michael Borgwardt


Check your project setup. If I recall correctly, this has to do with com.liferay.portal.util.PortalUtil.getUserPassword(renderRequest) using javax.servlet.http.HttpSession under the hood, but eclipse isn't able to find that class. Try adding the servlet api jar to the project class path

like image 31
Vincent De Baere Avatar answered Oct 04 '22 02:10

Vincent De Baere