I have installed tomcat, how do I enable jsp for a domain?

destr0yr

Well-Known Member
May 4, 2004
58
0
156
Kelowna, BC.
BianchiDude said:
I have installed tomcat, how do I enable jsp for a domain?
I haven't used this for a while, but it should work:

In Cpanel Addon Modules, enable and install the module. It will install java (/scripts/installjava) and install Tomcat (/usr/local/jakarta/jakarta-tomcat-5.5.7/) as well as mod_jk. A username (root) and password (random chars - different every time) will be generated during the install process. Verify Tomcat is running with "ps ax | grep java" or "nmap localhost | grep 8080". Point Browser to http://x.y.w.z:8080. Login, run some of the test jsp's, servlets, etc.

To enable mod_jk and have .jsp files parsed by Tomcat, edit server.xml (/usr/local/jakarta/jakarta-tomcat-5.5.7/conf/server.xml) and add a <Host> entry for every VirtualHost in the Apache httpd.conf. Example:
Code:
      <Host name="domain.tld" debug="0" unpackWARs="true" appBase="/home/USERNAME/public_html">
       <Context path=""
        docBase="/home/USERNAME/public_html" debug="0"
        crossContext="false"
        reloadable="true" />
      </Host>
(METHOD 1) In the Apache httpd.conf (/etc/httpd/conf/httpd.conf), edit the VirtualHost and add the following two lines:
Code:
	JkMount /*.jsp ajp13
	JkMount /servlet/* ajp13
(METHOD 2) Add the following for the entire system:
Code:
	<IfModule mod_jk.c>
	  JkMount /*.jsp ajp13
	  JkMount /servlet/* ajp13
	  JkMount /servlets/* ajp13
	  <Location "/examples/WEB-INF/">
	    AllowOverride None
	    deny from all
	  </Location>
	</IfModule>
Verify the following lines exist:
Code:
	LoadModule jk_module libexec/mod_jk.so
	AddModule mod_jk.c
	Include "/usr/local/apache/conf/jk.conf"
Add the following line below the other AddType's:
Code:
	AddType text/html .jsp
Restart Apache. Point your brower to http://yourdomain.tld, you should see a jsptest.jsp file, click it and the world should be a better place. All workers.properties, jk.conf entries are suffient and autocreated by Cpanel upon installation of the Tomcat addon module.
 

ghazizadeh

Registered
Sep 13, 2005
3
0
151
dgbaker said:
Under the Account Functions in whm -> Install Servlets, that is for adding jsp/servlet support to an account.
in account function i don't have "Install Servlets" option ,please help me and tell me what i can do
 

destr0yr

Well-Known Member
May 4, 2004
58
0
156
Kelowna, BC.
ghazizadeh said:
in account function i don't have "Install Servlets" option ,please help me and tell me what i can do
Did tomcat install? Is it running? Try reinstalling it... or go to /usr/local/cpanel/modules-install/tomcat-Linux-i386/ and run the install script. If the install servlet still doesn't show up, try /scripts/installservlet (SSH as root) or https://your.hostname.tld:2087/scripts/servletlist
 

destr0yr

Well-Known Member
May 4, 2004
58
0
156
Kelowna, BC.
ghazizadeh said:
thanks for your answer,
i reinstalled tomcat but "install servlets" not added to acount function,
and i tryd to access with this link:

https://myserverIP:2087/scripts/servletlist

but i get this error:

"Sorry you must install the cPanel java servlets addon module"
Any my other two suggestions? If you want this to work you're going to need to try all possibilities.

If a re-install doesn't work, goto the directory above and run the install script manually. You might even see some errors if it fails. Goodluck. I won't be replying again.
 

FeeL

Well-Known Member
Apr 17, 2004
134
2
168
Rio de janeiro
cPanel Access Level
Reseller Owner
404

Everithing here seems to be ok, but when I point my browser to the jsptest.jsp IO recieve the 404 page of tomcat..

But the file is there!

What can be wrong?

sds
 

casey

Well-Known Member
Jan 17, 2003
2,288
0
191
FeeL said:
Everithing here seems to be ok, but when I point my browser to the jsptest.jsp IO recieve the 404 page of tomcat..

But the file is there!

What can be wrong?

sds
Go to /usr/local/jakarta/tomcat/conf/server.xml and make sure that

</Engine>
</Service>
</Server>
are in the proper order (as above) at the end of the file. If not, fix them and restart tomcat.