Home » Java » maven can not find package and symbol

maven can not find package and symbol

Posted by: admin December 28, 2021 Leave a comment


I have an app with these class:
(part of class):

public class UserSessionBean implements Serializable {

    @javax.ws.rs.core.Context private HttpServletRequest httpRequest;

and during mvn compile, I have this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project highway-web: Compilation failure: Compilation failure:
[ERROR] /home/kelevra/java/git/ttkHighway/highway-web/src/main/java/com/kmware/ttk/highway/beans/session/UserSessionBean.java:[28,25] package javax.servlet.http does not exist
[ERROR] /home/kelevra/java/git/ttkHighway/highway-web/src/main/java/com/kmware/ttk/highway/beans/session/UserSessionBean.java:[40,38] cannot find symbol
[ERROR] symbol  : class HttpServletRequest
[ERROR] location: class com.kmware.ttk.highway.beans.session.UserSessionBean
[ERROR] -> [Help 1]

While making in IDEA there is no such problems. What it could be?


Java file UserSessionBean can not find the class HttpServletRequest.

You should check the dependencies declared in the pom file. Make sure that you include


Could you try a mvn clean install and see if it produces the same error.

P.S. Are you running the project from console or from an IDE.