Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are compiled JSP Java (*__jsp.java) files?

I am getting a javax.servlet.jsp.JspException in one of the jsp files that my website is trying to render (survey.jsp). However, the stack trace does not give me the the specific line in jsp where it fails but rather the line number where it fails in (survey_jsp.java:787), which seems to be the compiled JSP file. Where do I find such files, so that I know what line is throwing this exception?

Thanks

EDIT: These files live in the /work directory if you are using tomcat as Will suggested in the comment below.

like image 739
Sam Avatar asked Jul 26 '11 16:07

Sam


People also ask

Where do JSP files go?

In order to deploy Java Server Pages (JSP) files, you must place them in the root (or in a subdirectory below the root) of a Web application.

Where is compiled JSP in WebLogic?

If WebLogic is compiling JSP (i.e. if you are not precompiling them), they should be located under domain_name/servers/server-name-1/tmp/_WL_user .

Where and when does the compilation takes place for a JSP?

When you deploy a web app with a JSP, the whole translation and compilation step happens only once in the JSP's life. Once it's been translated and compiled, it's just like any other servlet.

Which directory is mainly used in JSP compilation?

The class files are compiled into the web module's WEB-INF/classes directory. The class files are compiled into the web module's WEB-INF/classes directory.


2 Answers

The compiled JSP files are by default available in the /work folder of the Tomcat environment. There should be a subfolder Catalina which in turn has a subfolder representing the domain name which defaults to localhost. There in turn should be the project folder which in turn contains package hierarchy org.apache.jsp with therein the compiled JSP files.

Tomcat  |-- backup  |-- bin  |-- conf  |-- lib  |-- logs  |-- temp  |-- webapps  `-- work       `-- Catalina            `-- localhost                 `-- projectname                      `-- org                           `-- apache                                `-- jsp                                     |-- survey_jsp.class                                     `-- survey_jsp.java    <--- here 

Unrelated to the concrete problem, there should be a root cause part in the stacktrace of the JspException which usually contains more detail about the real root cause of the problem. Read a bit further in the stacktrace. By the way, do you know that putting raw Java code in JSP files is considered a bad practice? It makes problems harder to debug as you encounter now.

like image 135
BalusC Avatar answered Oct 03 '22 00:10

BalusC


I am using Intellij to learn JavaEE and in order to view some features when jsp translating into servlet, I also have to find the file.

I didn't find it below <tomcat_home>/work/*. I finally find that the file is under the ~/.IntelliJIdea15/system/tomcat/ folder( tree structure showing from ~/.IntelliJIdea15/system/tomcat/)!

Name related to project name  |-- conf  |-- logs  `-- work       `-- Catalina            `-- localhost                 `-- projectname and type                      `-- org                           `-- apache                                `-- jsp                                     |-- survey_jsp.class                                     `-- survey_jsp.java    <--- here 

If you still can't find it under Intellij's home folder, you may have to try using

find . | grep 'nameOfYourJsp_jsp.java' 

in suitable parent folder.

like image 42
Tony Avatar answered Oct 02 '22 23:10

Tony