Solved

Force re-compile of JSP

Posted on 2006-11-28
18
3,228 Views
Last Modified: 2013-12-10
When I changed a JSP file in our WebLogic 8.1 server (Solaris), the JSP will not get compiled immediately when accessed. I have to re-start the server to force it to recompile. If I change the file again, I have to restart the server again. From what I found, the pageCheckSeconds parameter in weblogic.xml is used to control the compiling. If it is absent or set to 1, JSPs should be compiled when changed. But in both cases, it does not work. What else can I do?
0
Comment
Question by:integrosys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
  • +2
18 Comments
 
LVL 10

Expert Comment

by:ECollin
ID: 18035020
Hi,

the jsp will be compiled before the first access by a client.
You can use 2 different tools for compiling your jsp : weblogic.appc and weblogic.jspc

These links will give you details about these products :
.http://e-docs.bea.com/wls/docs81/ejb/appc_ejbc.html
.http://e-docs.bea.com/wls/docs81/jsp/reference.html

good read
Emmanuel
0
 
LVL 6

Expert Comment

by:Ajar
ID: 18038515
hey you can actually go to the admin console and redeploy the application from the deployments link that will force the jsps to recompile
0
 
LVL 10

Expert Comment

by:ECollin
ID: 18039929

it could be a good idea, but this will stop the application during redeployement.
Emmanuel
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:integrosys
ID: 18051798
>> the jsp will be compiled before the first access by a client.

I know. But after I change the JSP again, WebLogic will not re-compile it.

If I use appc to compile, do I need to redeploy the application?

Why doesn't the pageCheckSeconds work? Is it a bug in WebLogic 8.1?

It is just not practical if we need to compile manually, then redeploy the application everytime that we change the JSP.
0
 
LVL 10

Accepted Solution

by:
ECollin earned 25 total points
ID: 18052163


>> I know. But after I change the JSP again, WebLogic will not re-compile it.

Do you mean that the new version of the jsp file is not used when the user requests this page ?

Weblogic will not pre-compile your jsp file until the user accesses the page.

You don't need to redeploy your application when using weblogic.appc on your jsp files.

Emmanuel
0
 
LVL 5

Expert Comment

by:Becky
ID: 18089744
Weblogic should automatically be recompiling that JSP page when a user requests the page and the server detects that the page has changed.  

So if you say you have to restart the server for it to compile, I am going to assume you're putting the JSP page in the right place (weblogic copies deployed apps to the server's staging folder, by default, and serves all pages from below that folder structure, so if you need to make a quick patch or update to a JSP in a running application putting it in the correct folder under the staging folder should auto-compile it next time the page is requested).

So assuming it's in the right place.... there must be some setting that's missing?  All my apps automatically work this way, with Weblogic's default settings.  So I'm thinking you changed something in either a config file (web.xml) or in weblogic's server or deployments settings.

So I did a search on the internet.  BEA says that "WebLogic Server automatically compiles JSPs if the servlet class file is not present or is older than the JSP source file" ... but I didn't see any mention of if there's a way to turn that on an off, so I could find if perhaps you had accidentally turned it off.  Even the Servlet spec says the appserver needs to recompile modified JSPs on demand.

Some more searching on BEA's site produced the text below.  Can you check and be sure you're NOT using JSPClassServlet?

-------
http://edocs.bea.com/wls/docs81/jsp/reference.html

Another way to prevent your JSPs from recompiling is to use the JSPClassServlet in place of JSPServlet and to place your precompiled JSPs into the WEB-INF/classes directory. This will remove any possibility of the JSPs being recompiled, as the server will not look at the source code. The server will not note any changes to the JSPs and recompile them if you choose this option. This option allows you to completely remove the JSP source code from your application after precompiling.

This is an example of how to add the JSPClassServlet to your Web Application's web.xml file.

<servlet>
   <servlet-name>JSPClassServlet</servlet-name>
   <servlet-class>weblogic.servlet.JSPClassServlet</servlet-class>
</servlet>

<servlet-mapping>
   <servlet-name>JSPClassServlet</servlet-name>
   <url-pattern>*.jsp</url-pattern>
</servlet-mapping>
----

The only thing I can think of is that maybe my initial assumption is wrong?  Are you sure you're putting the modified JSP in Weblgic's staging location (the actual location Weblogic should be looking for changes to the JSPs)?
0
 

Author Comment

by:integrosys
ID: 18113695
As far as I know, the only parameter that tells WebLogic to whether to re-compile JSP is pageCheckSeconds. If I don't specify (this is the default), it will always re-compile if the file is changed. But somehow it is not re-compiling.

I don't have the JSPClassServlet as you mentioned, and my JSPs are all in the correct locations since I am able to access them without problems.
0
 
LVL 10

Expert Comment

by:ECollin
ID: 18114099
hi,

is your domain in production mode ?

is your application deployed as an exploded directory structure ?

Emmanuel
0
 
LVL 5

Expert Comment

by:Becky
ID: 18117038
It's not about whether or not you can access the JSP, it's about whether or not Weblogic is copying the web application files to its staging location on the server that serves the application.  If and when you make a change to a JSP you must make it under the staging folder of the appserver and not the original deployed location (which only gets looked at upon redeploy).

Make sure you're editing the JSPs in both the original deployed location AND copying the changed JSP to the correct location under the appserver's staging folder.

-B
0
 

Author Comment

by:integrosys
ID: 18120724
>> is your domain in production mode ?

No.

>> is your application deployed as an exploded directory structure ?

Yes. The files are copied individually over.

>> Make sure you're editing the JSPs in both the original deployed location AND copying the changed JSP to the correct location under the appserver's staging folder.

Where is this staging folder?
0
 
LVL 5

Expert Comment

by:Becky
ID: 18126375
If you're in dev mode and are using all the defaults, and ou're not using Weblogic Workshop for development (which uses the split directory strucutre), your staging folder will be:

BEA\user_projects\domains\<your domain name>\<your server name - usually the admin server in dev>\staging\

If you can't find it do a search for a directory called "staging" under the BEA folder.

Once you find it, in the staging folder, you should see a folder name that corresponds to your web application name. Find the old JSP and copy the new JSP over it.  That's the folder Weblogic looks at to detect changes in the JSP for automatic recompilation
0
 

Author Comment

by:integrosys
ID: 18128635
I can't find the staging folder in either Windows or Solaris environment. For your information, my problem is confined to Solaris only. On Windows, WebLogic will automatically re-compile the JSP if it has been changed.
0
 
LVL 5

Assisted Solution

by:Becky
Becky earned 25 total points
ID: 18144525
Well, then I'm stumped.  BEA's documentation states:

"WebLogic Server automatically compiles JSP pages if the servlet class file is not present or is older than the JSP source file."

I've never heard of any means to turn that off.

The ONLY other thing I can think of (assuming the JSP is going into the right directory...there should be a staging directory even in Solaris) is if you try scrubbing out pageCheckSeconds completely from the descriptor, and make sure you don't have the JSP precompile setting .... basically limit yourself to a paired down descriptor file, and completely remove and redeploy with the fresh start.

0
 
LVL 5

Expert Comment

by:Becky
ID: 19254810
I think you have some good solutions here, even though the questioner didn't follow up.  There are a few issues that get explained:  1) How to precompile JSPs,  2) How BEA handles staging mode and where files are stored when serving from staging mode, and 3) Clearing up possible confusion about  when BEA automatically compiles JSPs.

For those reasons, at least, this question shouldn't be deleted.
0
 

Expert Comment

by:himanshutageja
ID: 24916805
First thing to be checked in this case is the value of the parameter "JSPPage Check Secs" at weblogic console.
This will be visible on weblogic console when u navigate to ur application deployed on server and then click on the Descriptor tab.
If this is "-1" here then it will be overwritten as written in ur weblogic.xml.
I faced the same issue and was successful on correcting this at console.
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question