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
Go beyond Google and get vertical. These specialized search sites will help you find the business information you need -- fast.

Ari Balogh was named to the post of chief technology officer as the companys for a "realignment" of employees.










InformationWeek U.S. IT Salary Survey 2008
Salaries for business technology professionals are falling. Here's what you need to know in order to make good hiring decisions and personal career choices. Download Today
 
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



InformationWeek Business Technology Network
InformationWeekInformationWeek 500InformationWeek 500 ConferenceInformationWeek AnalyticsInformationWeek CIO
InformationWeek EventsInformationWeek ReportsInformationWeek MagazinebMightyByte and SwitchDark Reading
Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingNo JitterPlug Into The Cloud
space
Techweb Events Network
InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0 ConferenceMobile Business ExpoSoftware ConferenceCSI - Computer Security Institute
Black HatGTECEnergy CampMashup CampStartup Camp
space
Light Reading Communications Network
Light ReadingLight Reading EuropeUnstrungLight Reading's Cable Digital NewsConstantinopleInternet EvolutionPyramid Research
Heavy ReadingLight Reading Live!Light Reading InsiderEthernet ExpoOptical ExpoTeleco TVTower Technology Summit
space
Financial Technology Network
Advanced TradingBank Systems & TechnologyInsurance & TechnologyWall Street & TechnologyAccelerating Wall StreetBank Systems & Technology Executive SummitBuyside Trading SummitInsurance & Technology Executive Summit
space
Microsoft Technology Network
MSDN MagazineTechNetThe Architecture Journal
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 © 2008  United Business Media LLC  |  Privacy Statement  |  Terms of Service  |  Your California Privacy Rights