Where translated servlet of jsp got stored - java

As we know, when the jsp got complied it will get converted to servet.
I have installed weblogic server 9.2, and i deployed a struts project which has jsp files.
And in the browser i am able to see the application.
Now I want to see the servelt file of jsp which I ran.
Can anybody please tel me where I can find it
or do i need to do some configurations for this because I searched whole weblogic directory there is no java file with the jsp file name.

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.
See also
Using JSP Precompilation in WebLogic

I was struggling with this today and found another option. If you deploy your application via eclipse (and not via EAR file using the weblogic console) the compiled JSPs will be in <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp<some digit>\<domain name>\work\<app name>\jsp_servlet.

For Weblogic 10.3.6, the folder is this.
C:\oracle\MIDDLEWARE\user_projects\domains\APPNAME\servers\myserver\tmp_WL_user_appsdir_APPNAME_dir\\jsp_servlet_jsp_content

You can also check the <working-dir></working-dir> section in the weblogic.xml file to check for the location of jsp_servlets folder where the .java and .class files can be found.
You can trick the weblogic into recompiling the jsp files by deleting the existing ones, and try and access the jsp page from browser (in case lazy initialization is being followed).

Related

weird jsp output - Application working under eclipse, but not directly under tomcat

J2ee application (Spring 4.0, jsp ,java 1.7 e) is working great in the dev env (eclipse with built in tomcat)
Once deployed onto tomcat outside eclipse - it will render Gibberish output (class names, file names , configuration file names some binary data)
I didn't find any exception in the logs, according to the debug logs - like the request was processed correctly on the controller side.
I went over the jar packaged in the WAR and it seems like the list is identical to the list in build configuration in eclipse
Any idea what could cause this?
Sample source output:
weird jsp output
EDIT
After some more research I Found three missing jars (eclipse vs deployed version)
javax.servlet-api-3.0.1.jar
junit-4.11.jar
hamcrest-core-1.3.jar
I found this jar packaged in the war:
jsp-api-2.2.1-b03.jar
Should this jar be in the war?
When you are deploying it in standalone tomcat, proper directory structure has to followed. http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html Another important thing is the mapping of your servlets in web.xml
Hope this helps you. Thanks
Issue was corrupted JSP files
What corrupted my JSPs is still a mystery.

How Tomcat Notify about When New Jsp being uploaded

when we directly upload JSP page into tomcat where application deployed directory then why we don't need to restart Tomcat? how tomcat know that it has new JSP page?
when user hit the url /myapp/mynewjsp.jsp He/She always get new jsp deployed page.
Tomcat has an auto deploy feature. When you update JSP files it detects you have done so, compiles it, and replaces the old compiled JSP page with the new one that it compiles into a java class.
http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
If you don't want that to happen, you can turn off the auto deploy feature for your web application. It is described in the link how you do that.
Hey you can use jetty plugin for auto deploying tomcat folder . You don't need to paste your file on webapps folder. If you using maven project structure then add jetty plugin on pom.xml file . There is some command to run like mvn jetty:run etc... May these solution get you out from these problem

Website directory structure different from eclipse

I am coding a website using java servlets and am using eclipse and tomcat. When I test it using localhost, it works fine. But when I am deploying it on my actual website, the directory structure is messed up and the files are not called properly.
My eclipse directory structure on localhost is
Project Name
.src/packageName/java files
.WebContent/HTML files.
When I make a call from the html files, I use the relative location and tomcat automatically knows to look in the src/packageName folder. For example, from the /WebContent/login.html page makes a onClick call as follows,
. This will automatically trigger the java file in /src/packageName/welcome
When I am deploying it in my actual website, the WebContent/login.html is throwing an error WebContent/welcome file is not found. How do I tell my website to search in /src/packageName folder?
Hmm...have you been sure to package the application as a war for deployment.

NoClassDefFoundError on a class within a WAR on WebLogic server

I am trying to deploy a WAR file on weblogic server.
This is a simple java application.
I am new to this and experimenting.
JRE: 1.5.0_41, OS: redhat 5.8, Weblogic: WebLogic Server 10.0 MP2
The contents just include a jsp file and a java file (jsp inside jsp folder and java class inside WEB-INF\classes folder and correct package structure). I am using this java util file inside the jsp for some common utility methods.
However, when I deploy the WAR, it gives me NoClassDefinitionFoundError for this java utility class.
I have searched the threads and found that this exception points to some other inherent issue in the deployment. It also mentioned class path conflicts etc. I can understand this issue when it comes to using a class from an external JAR file, but could not understand how it fails to locate a file in the same context as that of the jsp.
How come the import statements in the jsp worked and the jsp got compiled and rendered and failed only when the part of accessing this object came into picture? (runtime problem maybe?)
Please educate me on this. My debugging efforts are still on. Thanks a lot, folks!!
[P.S.: Could it be because i compiled and built my source using eclipse setting 1.7 compliance and used it on a lesser JRE?]
For a war file classes is normally packaged inside WEB-INF/classes, not classes.

Where does Eclipse store generated servlet files for Tomcat?

I'm using Eclipse Java EE IDE and launch Tomcat from the Server's tab on Eclipse.
Where does Eclipse store generated servlet .java files for JSP files? I've checked the Tomcat installation directory, but nothing there.
Thanks.
Doubleclick the server entry in Servers view and check the path represented by Server path. Explore in there from inside the workspace directory. The generated classes are there.
If you choose the 2nd option Use Tomcat installation, then it will be available Tomcat's /work folder, there where you expected it to be.
go to your application work space directory(not eclipse installation directory) in windows explorer(not in eclipse IDE explorer).
in my laptop it is d:/applicationdata/j2ee
then follow the path as:
work space directory(in my case j2ee)/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/catalina/localhost
here u will find your application
Eclipse doesn't generate servlet files for JSP files. Validation happens directly on JSP syntax. When a JSP is deployed to an app server like Tomcat, the server may choose to generate servlet files to disk, but that is not required. The generation and compilation can happen in memory or the app server may even compile JSP files directly to bytecode.
I don't know specifically about Tomcat, but if it does generate servlet files to disk, the temporary directory containing these files will be somewhere under your Tomcat install.
/home/waheguru/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/jspnotes/org/apache/jsp
localhost or your website name,
project name is jspnotes, whatever your project.
This path is shown in Linux Mint.
Check META-INF\context.xml file from your work space. There will be path metioned like below
workDir="C:\apache-tomcat-7.0.39\work"
In above path you will find the package structure of your project and in it there will be both *_jsp.java and *_jsp.class

Categories

Resources