home
NEWS       BLOGS       FORUMS       NEWSLETTERS       RESEARCH       EVENTS       DIGITAL LIBRARY       CAREERS  
Network Computing Network Computing Powered by InformationWeek Business Technology Network

IMMERSE YOURSELF:

SOA

  |

Data Center

  |

802.11n

  |

Data Privacy

  |
APO  |

Virtualization

  |

NAC

  |

Security

  |

Network Mgmt

  |

Enterprise Apps

  |

Storage & Servers



Features   | Tutorials   |  Books   |   Columns   |   Research   |

Workshop: Deploying Java Server Pages on Apache

October 23, 2000
By Lori MacVittie


Setting up JSPs

To setup JSPs, we copied the default properties file, zone.properties, and created a new file called test.properties. You'll need to make a change to the repository listing. The repositories directive indicates the jar files or directories containing servlets which are controlled by this zone.
repositories=/home/gnujsp-1.0.0/lib/gnujsp10.jar
repositories=/home/gnujsp-1.0.0/lib/servlet-2.0-plus.jar
You should also include the gnujsp jar files here. All that is left is to define the gnujsp servlet and specify it's init paramters. This is accomplished by including the following within test.properties :
servlet.gnujsp.code=org.gjt.jsp.JspServlet
servlet.gnujsp.initArgs=jserv=true,checkclass=true,pagebase=/var/www/html,
scratchdir=/usr/local/apache/jsp,debug=true,compiler=builtin-javac -classpath
%classpath%:%scratchdir%:/home/gnujsp-1.0.0/lib/servlet-2.0-plus.jar:/home/gnujsp-1.0.0/lib/gnujsp10.jar 
-d %scratchdir% -deprecation %source%
Be sure that pagebase points to the DocumentRoot of your Web server and that scratchdir points to a directory that the JVM process can write to.

That's it! Now restart Apache and test your installation.

Test It Out

There are several .jsp files included with the gnujsp distribution. snoop.jsp (this lists environment and agent variables), hello.jsp (of course), and date.jsp. Post them so that they are accessible from the Web server. We created an "examples" directory in the root of our Web server and copied all the .jsp files there.

You should now be able to access any of these JSP files via a URL like this:

http://mydomain.com/examples/hello.jsp
If everything worked correctly, you should see the following text.
The Famous JSP Hello Program
The following line should contain the text "Hello GNUJSP World!". If that's not the case start debugging ...


Hello GNUJSP World!

Debugging

If everything did not go as planned, you can try several things to find the problem. In jserv.conf you can change the level of information being shown in the log file. You can also change the ApJServLogLevel directive so that it displays more informative information.

Our first installation failed miserably. We could run servlets some of the time but not others. After expanding the level log information, we found the following error to be particularly confusing:

(INFO) wrapper: VM died too many times w/in 5 second intervals (6); 
no more tries
After consulting the FAQ-O-MATIC (http://java.apache.org) we found that this is generally caused by the JVM's inability to write to or read a log file. We verified that permissions were correct and remained mystified for several hours.

After a while, we found that the problem was the time-out length specified in the jserv.conf file. Our first installation was on a P-II 75 machine running RedHat 6.2 with 16 MB of RAM. It is commonly accepted that there be a limit of 125 users per JVM, 256 MB RAM per JVM, and 250 MHz of CPU per JVM. We were no where close to the minimum recommendations, so the JVM was timing out while trying to process each call. We increased the ApJServVMTimeout from its default of 10 seconds to 30 seconds, and suddenly we were running smoothly. Not quickly, but smoothly.

The JSP specification is based on XML and therefore requires JSP documents to be well-formed. Fortunately, errors caused by pages containing malformed tags will be displayed in the browser when you attempted to run them. This aided in quick debugging the problems associated with incorrect JSP syntax.

Using JSPs on a lower-end machine causes performance problems as well. This is because the performance is directly related to the capabilities of the JVM you invoke to process and compile your JSP files. If you're experiencing such problems, you can try two things. First, you can upgrade your machine. However, since this is often not an option, you can try IBM's Jikes compiler, purported to be much more efficient and a better performer than Sun's compiler.

Even though we ran into problems, most of them were solved by carefully reading the documentation included in the property files or by consulting the FAQ. By following the installation instructions carefully, you should be able to get JSP support up and running without too many roadblocks.

If you have any comments on or questions about this article, please message Lori MacVittie at lori@nandgate.com.

Page 1 | 2 | 3 | First page






Ready to take that job and shove it?

Function:

Keyword(s):

State:
SPONSOR
RECENT JOB POSTINGS
CAREER NEWS
Aneesh Chopra is looking to other CIOs to advise him on fleshing out a more detailed agenda to best serve the president's IT agenda.

IT spending is expected to decline by 3.8 percent in 2009 according to Gartner.










2009 IT Salary Survey: Meager Raises, Solid Prospects
Though raises are notably smaller than a year ago, and job security’s shrinking, IT careers are looking safer than many others in this economic downturn. Get all the findings in InformationWeek's 2009 IT Salary Survey. Available FREE for a limited time.
 
ROLLING RIGHT ALONG
Follow key Network Computing Reviews from conception to completion. This Week: Holistic APM.



Network Computing Reports Emerging Enterprise Podcast Series: Secrets to Success








TechSearch


Microsite of the Week


Powerful Information at Your Fingertips



Techweb
Informationweek Business Technology Network
InformationweekInformationweek 500Informationweek 500 ConferenceInformationweek AnalyticsInformationweek Events
Informationweek MagazineGlobal CIOIWK Government ITbMightyByte and SwitchDark Reading
Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingPlug Into The CloudDr. DobbsContentinople
space
TechWeb Events Network
InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0Mobile Business ExpoNoJitter
Black HatGTECEnergy CampCloud ConnectGov 2.0 ExpoGov 2.0 Summit
space
Light Reading Communications Network
Light ReadingLight Reading AsiaUnstrungCable Digital NewsInternet EvolutionPyramid Research
Heavy ReadingLight Reading LiveLight Reading InsiderEthrnet ExpoTelco TVTower Technology Summit
space
Financial Technology Network
Advanced TradingBank Systems and TechnologyInsurance and TechnologyWall Street and TechnologyAccelerating WallstreetBST SummitBuyside Trading SummitIT Summit
space
Microsoft Technology Network
MSDNTechNetTotal IT ProTotal Dev ProNET Total Dev Pro CommunitySQL Total Dev Pro Community
space


App Infrastructure   |   Messaging & Collaboration   |   Network & Systems Mgmt   |   Network Infrastructure   |   Security  |   Storage & Servers   |   Wireless   |   Enterprise Apps
About Us  |  Contact Us  |  Site Map  |  Technology Marketing Solutions  |  Advertising Contacts  |   Briefing Centers
Copyright © 2009  United Business Media LLC  |  Privacy Statement  |  Terms of Service