|
||||
|
Sorry about the title its not 4.1.29 its 4.1.12. Will try 4.1.29 and post results of that install as well soon,. I have installed the latest stable release Tomcat 4.1.12 (Oct 31) and the JDBC drivers and have had excellent success on cpanel run servers.
I use the latest version (not 4.0.3 as used here) because it does fix many bugs, is more efficient and doesnt require the old restarts when new scripts are added. It is good to go out of the box and really adds to your servers value if you get both options to run well. Heres a guide to installing First, if you already have another version of Tomcat on your server, clean it out. Delete these files: in /usr/local jakarta in / jsp-install-4 (or whatever version you have) Then edit httpd.conf and remove all instances of <IfModule mod_jk.c> JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 JkMount /servlets/* ajp13 </IfModule> </VirtualHost> Make sure you write down the accounts that have JSP installed so you can reinstall Also take out the following line: AddModule mod_jk.c (In some cases depending on your boxes configuration this line will make it work without adding mod_jk2.c ::Go figure:-) You can leave: AddType text/html .jsp index.jsp in the DirIndex now to install the new version SSH as root wget http://layer1.cpanel.net/jsp-install-4.x.tar.gz tar xfzv jsp-install-4.x.tar.gz cd jsp-install-4 ./install.sh That will install Tomcat NOTE: You may get this error right off the bat; error: failed dependencies: compat-libstdc++ = 6.2-2.9.0.16 is needed by compat-egcs-c++-6.2-1.1.2.16 Not to worry, after install go to WHM and reinstall the compat-libstdc++ and check ignore dependencies and forced install. That will update that. Now open httpd.conf again and add the following so it looks like the following (You may already have some of these from install): LoadModule jk2_module libexec/mod_jk2.so AddModule mod_jk2.c Include "/usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/conf/auto/mod_jk.conf" AddType text/html .jsp AddHandler jakarta-servlet2 .jsp Done, save. restart Apache. Now re-install servlets on accounts. After thats done go back to httpd.conf, and look for this under all the accounts virtualhost <IfModule mod_jk.c> JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 JkMount /servlets/* ajp13 </IfModule> </VirtualHost> Needs to be: <IfModule mod_jk2.c> JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 JkMount /servlets/* ajp13 </IfModule> </VirtualHost> Now Tomcat is installed and and should be running, test your install by creating a file named test.jsp and insert the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head><title>JSP Test</title></head> <body> <h1>JSP Test</h1> time: <%= new java.util.Date() %> </body> </html> This will show the current date and time if Tomcat is installed correctly like below: http://www.planetgac.net/test.jsp ***************************************** Installing the JDBC cd /usr/local wget http://dev.mysql.com/get/Downloads/C...s.hoobly.com// unpack the distribution now enter the created directory and copy this file: mysql-connector-java-3.0.9-stable-bin.jar to your $JAVA_HOME/jre/lib/ext also I copied it to: /usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/common/lib Now just set the classpath in your scripts. The thing is we have to use com.mysql.jdbc.Driver instead of org.gjt.mm.mysql.Driver in the command Class.forName("com.mysql.jdbc.Driver").newInstance (); So the suggestion code generated by phpMyAdmin for mySQL Class.forName("org.gjt.mm.mysql.Driver").newInstan ce(); should be revised to Class.forName("com.mysql.jdbc.Driver").newInstance (); TEST IT! Heres a sample script that shows websites that have visited a page on your site First create a new database And the sql for the DB: CREATE TABLE `t_log` ( `logtime` timestamp(14) NOT NULL, `ip` varchar(15) NOT NULL default '', `hostname1` varchar(5) NOT NULL default '_', `hostname2` varchar(50) NOT NULL default '_', `uid` bigint(20) NOT NULL default '0', `actid` tinyint(4) NOT NULL default '0', `targetid` tinyint(4) NOT NULL default '0', KEY `logtime` (`logtime`,`hostname1`,`hostname2`,`uid`) ) TYPE=MyISAM COMMENT='For logging user''s activities'; And the script that calls the info (Change DBname, user and pass to yours): <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> <% //Driver DriverSearchResult = (Driver)Class.forName("org.gjt.mm.mysql.Driver").n ewInstance(); Driver DriverSearchResult = (Driver)Class.forName("com.mysql.jdbc.Driver").new Instance(); Connection ConnSearchResult = DriverManager.getConnection("jdbc:mysql://localhost/DBname?user=DBuser&password=password"); PreparedStatement StatementSearchResult = ConnSearchResult.prepareStatement("SELECT * FROM t_log order by logtime desc"); ResultSet SearchResult = StatementSearchResult.executeQuery(); boolean SearchResult_isEmpty = !SearchResult.next(); boolean SearchResult_hasData = !SearchResult_isEmpty; Object SearchResult_data; int SearchResult_numRows = 0; %> <% int Repeat1__numRows = -1; int Repeat1__index = 0; SearchResult_numRows += Repeat1__numRows; %> <html> <head> <title>Domain Name Log</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p> The List of Domain Names Visiting the Website <font color="#FF00FF"><strong>planetgac.net/index.shtml</strong></font>:</p> <table width="100%" border="1"> <tr> <td width="26%"><strong>Host Name</strong></td> <td width="74%"><strong>Time</strong></td> </tr> <% while ((SearchResult_hasData)&&(Repeat1__numRows-- != 0)) { %> <tr> <td><%=(((SearchResult_data = SearchResult.getObject("hostname2"))==null || SearchResult.wasNull())?"":SearchResult_data)%></td> <td><%=(((SearchResult_data = SearchResult.getObject("logtime"))==null || SearchResult.wasNull())?"":SearchResult_data)%></td> </tr> <% Repeat1__index++; SearchResult_hasData = SearchResult.next(); } %> </table> </body> </html> <% SearchResult.close(); ConnSearchResult.close(); %> heres the output: http://www.planetgac.net/mysqltest.jsp More info can be found here on setting classpath: http://www.mysql.com/documentation/c...html#id2800725 Need support? Email me or post questions. Just a few notes, chkserv.d will probably show Tomcat as failed but all JSP/Servlets work. This is because the chkserv.d file for this release will be no good. I am working on an updated one and will get it here ASAP. In the meantime if you do not want to see the failed Tomcat. Delete the file and reboot server. Last edited by Planet_Master; 06-28-2004 at 01:21 AM. |
|
|||
|
Quote:
(doesn't work either way)
__________________
hiiii |
|
||||
|
You can run the test.jsp without the WEB-INF directory but to run servlets/class files you need to create a directory in your root called WEB-INF
Create this directory structure in your /public_html directory: /WEB-INF/classes Then you can then put servlets in the /classes subdirectory and call them like so: http://www.yourdomain.com/servlet/NameOfServlet chmod the new directories to 755 Also create /WEB-INF/lib To execute .jars It would also be better if your domain resolved before testing. |
|
|||
|
ok probably a dumb question, but any clue on how to fix this?
/etc/init.d/httpd configtest Create config for main host Syntax error on line 4 of /usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/conf/auto/mod_jk.conf: Cannot load /usr/local/apache/libexec/mod_jk.so into server: /usr/local/apache/libexec/mod_jk.so: cannot open shared object file: No such file or directory |
|
|||
|
alright, i have looked all over the place for information on mod_jk.so
This lead me to install sun java since it was not there, but i still can not find information on how to compile mod_jk.so which is what is giving me errors. Can anyone tell me if they had any luck on a cpanel box, and if so where can i find some documentation? and please do NOT give me google search results as i have spent countless hours googling for my answer already |
|
||||
|
I am thinking this can be compiled with Apache. I just received word that Apache version 1.3.29 is available and I will be upgrading later on. I will see if mod_jk.so can be or is in fact compiled with thye upgrade.
Last edited by Planet_Master; 11-07-2003 at 06:58 PM. |
|
|||
|
changed and now i get this
/etc/init.d/httpd configtest Create config for main host Syntax error on line 4 of /usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/conf/auto/mod_jk.conf: Can't locate API module structure `jk_module' in file /usr/local/apache/libexec/mod_jk2.so: /usr/local/apache/bin/httpd: undefined symbol: jk_module so i changed everything to this <IfModule !mod_jk.c> LoadModule jk2_module libexec/mod_jk2.so </IfModule> Jk2WorkersFile "/usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/conf/jk/workers.properties" Jk2LogFile "/usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/logs/mod_jk2.log" Jk2LogLevel emerg now i get this Syntax error on line 7 of /usr/local/jakarta/jakarta-tomcat-4.1.12-src/build/conf/auto/mod_jk.conf: Invalid command 'Jk2WorkersFile', perhaps mis-spelled or defined by a module not included in the server configuration |
|
||||
|
Quote:
Yeah scrap that because I tried it after I posted and it caused Apache to fail on my box at least. Keep it the way it was originally. Damn I know I saw this before and I will find it for you. |
|
||||
|
Got this from dgbaker over at http://forum.cpanelhosts.com/
Its worth a try. In some cases for some strange reason the mod_jk.so and mod_jk2.so in /usr/local/apache/libexec end up being the wrong size as so -rwxr-xr-x 1 root root 148130 Apr 30 18:02 mod_jk2.so* -rwxr-xr-x 1 root root 129963 Jul 12 19:49 mod_jk.so* They should be -rwxr-xr-x 1 root superdb 150601 Aug 27 17:42 mod_jk2.so -rwxr-xr-x 1 root superdb 130215 Aug 27 18:18 mod_jk.so If yours ends up being wrong you will know because jsp and servlets will not work through apache and only through tomcat port directly. You can pick up the modified mod_jk files here http://server11.virtual-hosting.ca/modjk.tar just untar and replace the old ones (back them up first though). |
![]() |
| Thread Tools | |
| Display Modes | |
|
|