I took away the postgres jar file from the application/WEB-INF/lib
folder.

Unfortunately, I still encounter the error. 

I look into the log files. The deployment seems successful. 

I tracked the errors for days, and still could not get a clue. 

Please help me to give me some insights.

Thank you.

Stanley



All files are attached again below. 

META-INF\context.xml
====================
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/someApp" docBase="someApp"
   crossContext="true" reloadable="true" debug="1">

<Resource name="jdbc/postgres" auth="Container"
          type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
          url="jdbc:postgresql://127.0.0.1:5432/testdb"
          username="gepguser" password="password" maxActive="20"
maxIdle="10" maxWait="-1"/>
</Context>

WEB-INF\web.xml
===============
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://java.sun.com/xml/ns/javaee";
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; id="WebApp_ID"
version="2.5">
        <resource-ref>
                <description>postgreSQL Datasource example</description>
                <res-ref-name>jdbc/postgres</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
</webapp>

server.xml
==========
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>

  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
 
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
  
    <Connector port="8009" enableLookups="false" protocol="AJP/1.3"
redirectPort="8443" maxPostSize="0" />

    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

      </Host>
    </Engine>
  </Service>
</Server>

The call:

                Context initCtx;
                try {
                        initCtx = new InitialContext();
                        DataSource ds = (DataSource) initCtx
        
.lookup("java:comp/env/jdbc/postgres");

                        conn = ds.getConnection();


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to