You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Apahce Tomact <ap...@yahoo.com> on 2004/02/03 20:19:10 UTC

Apache2, Mod_jk2 and Tomcat 4 on Linux - Help

Hi,
 
I want to configure Apache2, Mod_jk2 and Tomcat 4 on Linux. If any body has any procedure, Please send me.
 
I have done this in Windows environment successfully and Struggling to configure on Linux.
 
Your help is greatly appreciated.
 
Regards,
Rama.


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: Apache2, Mod_jk2 and Tomcat 4 on Linux - Help

Posted by Apahce Tomact <ap...@yahoo.com>.
Hi,
 
Thanks for your reply.
 
I need to have connector. I have installed Apache and Tomcat on Linux and independently they are working but failing when tried to load the mod_jk2 module.
 
Regards,
Rama

Josh Rehman <jr...@citysearch.com> wrote:
There are lots of resources on the net. Do a search. I don't have any 
links handy or I'd post 'em.

One word of advice: avoid installing a unique tomcat user. Just install 
it as your user name and not as root. As you develop and start/stop 
tomcat, log files and other things are generated with your UID. This 
essentially prevents you from using that special tomcat user anyway, so 
may as well avoid it.

chown -R user:user $CATALINA_HOME
chmod -R g+rwx user:user $CATALINA_HOME

is your friend. :)

(In production, having a tomcat user is a Good Idea - but not for 
development IMHO)

I don't know about the connector stuff. However, I do know that it is 
hard to integrate tomcat with the whole runlevel service thing while 
having it integrated with Apache. But then, I haven't spent serious time 
on that. I run tomcat stand-alone mostly. I would consider running with 
apache and a connector to be an "advanced topic" and I am certainly not 
advanced. Yet.

Apahce Tomact wrote:

>Hi,
> 
>I want to configure Apache2, Mod_jk2 and Tomcat 4 on Linux. If any body
>has any procedure, Please send me.
> 
>I have done this in Windows environment successfully and Struggling to
>configure on Linux.
> 
>Your help is greatly appreciated.
> 
>Regards,
>Rama.
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free web site building tool. Try it!
>
> 
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: Apache2, Mod_jk2 and Tomcat 4 on Linux - Help

Posted by Josh Rehman <jr...@citysearch.com>.
There are lots of resources on the net. Do a search. I don't have any 
links handy or I'd post 'em.

One word of advice: avoid installing a unique tomcat user. Just install 
it as your user name and not as root. As you develop and start/stop 
tomcat, log files and other things are generated with your UID. This 
essentially prevents you from using that special tomcat user anyway, so 
may as well avoid it.

chown -R user:user $CATALINA_HOME
chmod -R g+rwx user:user $CATALINA_HOME

is your friend. :)

(In production, having a tomcat user is a Good Idea - but not for 
development IMHO)

I don't know about the connector stuff. However, I do know that it is 
hard to integrate tomcat with the whole runlevel service thing while 
having it integrated with Apache. But then, I haven't spent serious time 
on that. I run tomcat stand-alone mostly. I would consider running with 
apache and a connector to be an "advanced topic" and I am certainly not 
advanced. Yet.

Apahce Tomact wrote:

>Hi,
> 
>I want to configure Apache2, Mod_jk2 and Tomcat 4 on Linux. If any body
>has any procedure, Please send me.
> 
>I have done this in Windows environment successfully and Struggling to
>configure on Linux.
> 
>Your help is greatly appreciated.
> 
>Regards,
>Rama.
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free web site building tool. Try it!
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Apache2, Mod_jk2 and Tomcat 4 on Linux - Help

Posted by Apahce Tomact <ap...@yahoo.com>.
Hi Francois,
 
Thank you very much for your help.
 
I am trying to configure mod_jk2. Do you have any procedure for it.
 
Regards,
Rama

Francois Masson <fr...@dartfish.com> wrote:

Hi,

I did an installation on Fedora, with Apache2, Tomcat 4.1.29 and mod_jk 
1.2. You can access the installation journal at 
http://www.javateria.net/fedora/index.php.

Regards,
Francois


Apahce Tomact wrote:

>Hi,
> 
>I want to configure Apache2, Mod_jk2 and Tomcat 4 on Linux. If any body has any procedure, Please send me.
> 
>I have done this in Windows environment successfully and Struggling to configure on Linux.
> 
>Your help is greatly appreciated.
> 
>Regards,
>Rama.
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free web site building tool. Try it!
> 
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: Apache2, Mod_jk2 and Tomcat 4 on Linux - Help

Posted by Francois Masson <fr...@dartfish.com>.
Hi,

I did an installation on Fedora, with Apache2, Tomcat 4.1.29 and mod_jk 
1.2. You can access the installation journal at 
http://www.javateria.net/fedora/index.php.

Regards,
Francois


Apahce Tomact wrote:

>Hi,
> 
>I want to configure Apache2, Mod_jk2 and Tomcat 4 on Linux. If any body has any procedure, Please send me.
> 
>I have done this in Windows environment successfully and Struggling to configure on Linux.
> 
>Your help is greatly appreciated.
> 
>Regards,
>Rama.
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free web site building tool. Try it!
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


help? JNDI Datasource HOW-TO

Posted by da...@etrak-plus.com.
i have followed the example but changed the location of the database to another machine.
Tomcat 5.0.18

the test.jsp returns

Results
Foo Not Connected
Bar -1 

checking the DBTest log i get :


2004-02-03 14:19:36 NamingContextListener[/Catalina/localhost/DBTest]:   Resource parameters for jdbc/TestDB = ResourceParams[name=jdbc/TestDB, parameters={factory=org.apache.commons.dbcp.BasicDataSourceFactory, url=jdbc:mysql://<internal ip address>:3306/javatest?autoReconnect=true, password=<password>, maxWait=10000, maxActive=100, driverClassName=org.gjt.mm.mysql.Driver, username=Daniel, maxIdle=30}]
2004-02-03 14:19:36 NamingContextListener[/Catalina/localhost/DBTest]:   Adding resource ref jdbc/TestDB
2004-02-03 14:19:36 NamingContextListener[/Catalina/localhost/DBTest]:   ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFactory},{type=url,content=jdbc:mysql://<internal ip address>:3306/javatest?autoReconnect=true},{type=password,content=<password>},{type=maxWait,content=10000},{type=maxActive,content=100},{type=driverClassName,content=org.gjt.mm.mysql.Driver},{type=username,content=Daniel},{type=maxIdle,content=30}]
2004-02-03 14:19:36 NamingContextListener[/Catalina/localhost/DBTest]:   Resource parameters for UserTransaction = null

at this point im stumped.

server.xml is :::

<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true"/>
<Connector port="8009" enableLookups="false" redirectPort="8443" debug="0" protocol="AJP/1.3"/>
<Engine name="Catalina" defaultHost="localhost" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase"/>
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>username</name>
<value>Daniel</value>
</parameter>
<parameter>
<name>password</name>
<value><password></value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://<ipaddress>:3306/javatest?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
</Host>
</Engine>
</Service>
</Server>


/DBTest/WEB-INF/web.xml:::

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>dbtest</display-name>
<description>
Welcome to dbtest
</description>
<description>MySQL Test App</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>


/DBTest/test.jsp

<html>
<head>
<title>DB Test</title>
</head>
<body>
<%
foo.DBTest tst = new foo.DBTest();
tst.init();
%>
<h2>Results</h2>
Foo <%= tst.getFoo() %><br/>
Bar <%= tst.getBar() %>
</body>
</html>


/DBTest/WEB-INF/foo/DBTest.class

package foo;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

public class DBTest {

  String foo = "Not Connected";
  int bar = -1;
    
  public void init() {
    try{
      Context ctx = new InitialContext();
      if(ctx == null ) 
          throw new Exception("Boom - No Context");

      DataSource ds = 
            (DataSource)ctx.lookup(
               "java:comp/env/jdbc/TestDB");

      if (ds != null) {
        Connection conn = ds.getConnection();
              
        if(conn != null)  {
            foo = "Got Connection "+conn.toString();
            Statement stmt = conn.createStatement();
            ResultSet rst = 
                stmt.executeQuery(
                  "select id, foo, bar from testdata");
            if(rst.next()) {
               foo=rst.getString(2);
               bar=rst.getInt(3);
            }
            conn.close();
        }
      }
    }catch(Exception e) {
      e.printStackTrace();
    }
 }

 public String getFoo() { return foo; }
 public int getBar() { return bar;}
}
What am i missing?thanks,Daniel Schulken---Outgoing mail is certified Virus Free.Checked by AVG anti-virus system (http://www.grisoft.com).Version: 6.0.576 / Virus Database: 365 - Release Date: 1/30/2004