3
votes

I have been trying to import a java class into a jsp page using the typical syntax:

<%@ page import="packageName.HelloWorldTest" %>

and

<%@ page import="packageName.* %>

Whenever I try I receive this error:

PWC6199: Generated servlet error: cannot find symbol

symbol: class HelloWorldTest

location: package packageName

PWC6197: An error occurred at line: 3 in the jsp file: /WEB-INF/jsp/test.jsp

PWC6199: Generated servlet error: cannot find symbol

symbol: variable HelloWorldTest

location: class org.apache.jsp.WEB_002dINF.jsp.test_jsp

I'm also using Maven. I have reconfigured my project so that the default output folder is WEB-INF/classes, but I still receive this error.

1
show your WEB-INF directory structure with HellowWolrdTest location.Juned Ahsan

1 Answers

0
votes

It's very likely that when your Maven build finishes you don't have any HelloWorldTest class generated inside /WEB-INF/classes/packageName/ folder. If not, you would need to fix your Maven configuration.

If the class file is there, check your final war artifact that Maven is generating. Is the class there too? If yes, check that the exploded war directory on your servlet container has the class file too (under /webapps folder in Tomcat).

If the class file exists inside your app server too, check for any spelling mistakes in the package name specified in your JSP.