Avatar of dbeachy1
dbeachy1

asked on 

Where are the intermediate java files generated when Weblogic 10 compiles JSPs?

I am porting our webapp from Tomcat 6 to Weblogic 10, and I am trying to figure out how to view the java files generated by Weblogic when the JSP files are compiled.  After Googling around I found some documentation for setting 'keepgenerated=true' by editing weblogic.xml as follows:

<jsp-descriptor>
    <precompile>false</precompile>
    <precompile-continue>false</precompile-continue>
    <keepgenerated>true</keepgenerated>
    <verbose>true</verbose>
    <working-dir>c:/temp/bea</working-dir>
  </jsp-descriptor>

The file I edited was C:\bea\wlserver_10.0\server\lib\consoleapp\webapp\WEB-INF\weblogic.xml.

However,when I then bring up Weblogic the class files are still being compiled to its internal work directory (instead of c:\temp\bea), and no JSP java files are being preserved.  I have confirmed that I am editing the correct weblogic.xml because when I deliberately introduce a syntax error in it I get an error on startup.  However, I don't understand why 'working-dir' and 'keepgenerated' are not working.  I am running the default 'sample' instance under Weblogic 10; here is the command I use to start it:

C:\bea\wlserver_10.0\samples\domains\wl_server\startWebLogic.cmd

So, in a nutshell, what file and setting do I need to edit in order for Weblogic to preserve the java files?  It is very difficult to debug stack traces in JSPs without those files.

Any help would be appreciated!
Java App Servers

Avatar of undefined
Last Comment
Becky
Avatar of ctoan
ctoan

I am not sure where you will find those generated java files. But, I guess you could run the command line weblogic.jspc tool on the jsp and view the generated files.

Example:
java weblogic.jspc -keepgenerated one.jsp  
Avatar of dbeachy1
dbeachy1

ASKER

Thanks for the tip.  What classpath would I use for that?
Avatar of ctoan
ctoan

I guess if you have weblogic.jar in classpath, it should work
Avatar of Becky
Becky
Flag of United States of America image

You have precompile set to false - you know that means the JSP won't get compiled until you pull it up in a browser, right?    So if you're looking into c:/temp/bea/ after deploying the app, but before running any JSPs in the app, you won't see anything in that folder.  

It also may be possible that a running instance of the appserver won't write to a directory outside of its domain (just a guess). I also suggest adding debug.  Try the example bwlow. If the below folder doesn't work try a relative path (relative to the domain dir):  

<working-dir>temp</working-dir>  (temp dir in the domain dir)

PS: precompile-continue is not necessary if precompile is false.

<jsp-descriptor>
       <precompile>false</precompile>
      <keepgenerated>true</keepgenerated>
     <verbose>true</verbose>
      <working-dir>c:/<bea home dir>/user_projects/domains/<domain dir>/temp</working-dir>
      <backward-compatible>true</backward-compatible>
      <debug>true</debug>
</jsp-descriptor>

Avatar of dbeachy1
dbeachy1

ASKER

Thanks for the information.  Something odd is going on -- as another test, I set weblogic.xml to use that working directory with "/222" appended to it (that "222" subdirectory does not exist).  The idea was to confirm that the appserver is really reading that setting.  And sure enough, it created the "222" subdirectory automatically when the appserver started.  However, the appserver continues to compile JSP class files to the default tmp directory (under "C:\bea\wlserver_10.0\samples\domains\wl_server\servers\examplesServer\tmp\_WL_user\_appsdir_mytest_dir\lgpkat\jsp_servlet"), and furthermore, it is still deleting the intermediate Java files (or never creating the physical files in the first place).  
I have confirmed that my login.jsp is being compiled when I refresh the page, because when I introduced a syntax error into my login.jsp I see a compile error message.  But oddly, even when a compile error occurs I still cannot find any generated Java file for the JSP.  It's really odd.  Why would the appserver be reading that weblogic.xml, creating the specified 'working-dir', but then not using it?  This seems like such a trivial issue, but it's proving to be ridiculously difficult.
ASKER CERTIFIED SOLUTION
Avatar of Becky
Becky
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of dbeachy1
dbeachy1

ASKER

Thanks for the details and for confirming what I am seeing here.  I agree it looks like a bug.  
Avatar of dbeachy1
dbeachy1

ASKER

OK, good news here!  After a lot more digging I figured out the problem: it seems that with Weblogic 10 you have to use the Weblogic console web application to configure your web application.  Furthermore, it doesn't work with auto-deployed webapps, so you have to configure a "real" webapp for your deployment using the Webapp console located here by default: http://localhost:7001/console.  The default login is weblogic/weblogic.  Then after you log into the console:
1. Click the "Deployments" tab.  
2. In the "How do I..." box on the left, click the "Install a Web application" link.
3. Follow the instructions to deploy and activate your new web application.
4. Go into your new deployment settings in the Weblogic console and click the "Configuration" tab.
5. Check the "Debug Enabled", "JSP Keep Generated", and "JSP Verbose" checkboxes.
6. Click the "Save" button.
Then restart your application and your JSP java files will be available!  On my system here using the default 'examplesServer' instance the JSP class and Java files were stored here: C:\bea\wlserver_10.0\samples\domains\wl_server\servers\examplesServer\tmp\_WL_user\myWebApp\omlcvv\jsp_servlet
I never could get the 'keepgenerated' settings to work by editing the XML file, but once I deployed the webapp using the Weblogic console the 'keepgenerated' settings in the console app worked!
Avatar of Becky
Becky
Flag of United States of America image

Awesome sleuthing!  Glad you finally got what you needed.  

I'm curious to know if something changed in config.xml after you saved that change in the console.  If so you should may be able to get away with just editing config.xml in the same manner next time.  Weblogic 9 and 10 has this concept of an edit lock, though, so it could be that if you don't have an edit lock any changes you make to the config.xml are ignored (unlike previous versions where you could make your own changes to config.xml).
Java App Servers
Java App Servers

Java application servers that support the Java EE platform and features include JOnAS from Object Web, WildFly (formerly JBoss AS) from JBoss, Geronimo from Apache, TomEE from Apache, Resin Java Application Server from Caucho Technology, Blazix from Desiderata Software, Enhydra Server from Enhydra.org, and GlassFish from Oracle. Commercial Java app servers include WebLogic by Oracle, WebSphere from IBM and the open source JBoss Enterprise Application Platform (JBoss EAP) by Red Hat.

7K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo