tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamez smith <jamez...@gmail.com>
Subject Re: tomcat 4.1.31 problem
Date Tue, 01 Sep 2009 17:10:32 GMT
On Tue, Sep 1, 2009 at 11:26 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jamez,
>
> On 8/31/2009 10:27 PM, jamez smith wrote:
>
> >>Really? When you run startup.bat from the command-line, is EXITS
> >>CMD.EXE? That is very surprising.
>

    Sorry  I didn't make this clear. The DOS Window where I type
"startup.bat" is not closed and showed below, but the DOS Window it opened
is closed itself.
C:\Tomcat 4.1\bin>startup.bat
Using CATALINA_BASE:   ..
Using CATALINA_HOME:   ..
Using CATALINA_TMPDIR: ..\temp
Using JAVA_HOME:       C:\j2sdk1.4.2_15

>
>
> >>Try looking in the file logs/procurement_log.[datestamp].txt
>
After I run both "startup.bat" or "catalina run", the procurement_log.txt
showed the exception: (in the server.xml, myApp = procurement, I used myApp
to represent the real project name, hope it won't confuse you.)

2009-09-02 00:25:51 StandardContext[/procurement]: Starting
2009-09-02 00:25:51 StandardContext[/procurement]: Processing start(),
current available=false
2009-09-02 00:25:51 StandardContext[/procurement]: Configuring default
Resources
2009-09-02 00:25:51 StandardContext[/procurement]: Resources start failed:
java.lang.IllegalArgumentException: Document base ..\webapps\procurement
does not exist or is not a readable directory
    at
org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:146)
    at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3285)
    at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3415)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
    at
org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:463)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)

2009-09-02 00:25:51 StandardContext[/procurement]: Configuring
non-privileged default Loader
2009-09-02 00:25:51 StandardContext[/procurement]: Configuring default
Manager
2009-09-02 00:25:51 StandardContext[/procurement]: Processing standard
container startup
2009-09-02 00:25:51 StandardContext[/procurement]: Context startup failed
due to previous errors
2009-09-02 00:25:51 StandardContext[/procurement]: Exception during cleanup
after start failed
LifecycleException:  Container StandardContext[/procurement] has not been
started
    at
org.apache.catalina.core.StandardContext.stop(StandardContext.java:3600)
    at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3573)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
    at
org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:463)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)


>
> > org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
> > class '' for connect URL 'null', cause:
> > java.lang.NullPointerException
> >  at COM.ibm.db2.jdbc.app.DB2Driver.acceptsURL(Unknown Source)
> >  at java.sql.DriverManager.getDriver(DriverManager.java:232)
> >  at
> >
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
>
> >>Amusingly enough, there's a thread occurring concurrently with this one
> >>on the list on this exact issue. Basically: check and re-check all your
> >><Resource> parameters, make sure your datasource name is consistent, and
> >>only put your MySQL driver JAR file in one place: in the server's
> >>library directory (common/lib on TC 4.1 IIRC).
>

I am rechecking and rechecking......I found in common/lib directory there
are one  db2java.jar and one COM folder, basically it is the unzipped
version of that db2java.jar.  Not sure why the COM folder is there.  But I
try to remove the COM folder, the error is still there.

 >>It wouldn't hurt to turn up debug to something like "99". I've never
> >>seen good documentation on what that attribute is supposed to do,
> >>unfortunately.
>

 I am not sure what debug tag is for? I have never used this tag before.

>
> >  <Resource name="jdbc/test_DS" auth="Container"
> > type="javax.sql.DataSource"/>
> >  <ResourceParams name="jdbc/test_DS">
> >      <!-- Class name for JDBC driver -->
> >      <parameter>
> >         <name>driverClassName</name>
> >        <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
> >      </parameter>
> >
> >      <!-- The JDBC connection url for connecting to your DB -->
> >      <parameter>
> >        <name>url</name>
> >        <value>jdbc:db2:oscahe</value>
> >      </parameter>
> >    </ResourceParams>
>
>
> >>The two above parameters are the ones you ought to double- and
> >>triple-check: does the IBM driver really start with COM all in caps? I
> >>suspect that it should be "com.ibm.db2.jabc.app.DB2Driver" instead of
> >>that you have. Case does matter. Also, is the URL you have above the
> >>correct URL for DB2? Does anything need to be set up in a separate file
> >>to resolve "oscahe" (and is that spelled right? "oscache", maybe?)? I
> >>remember Oracle's non-type-IV JDBC drivers needed a separate file to
> >>configure the driver.
>

Yes, IBM driver really starts with COM all in caps. I have unzipped the
db2java.jar and can confirm it is correct. The path
"COM\ibm\db2\jdbc\app\DB2Driver.class" is also correct. "oscahe" is
correct.  I have DB2 universal server installed on my local machine.  When I
import a profile, I can have different databases to connect to.  I am able
to connect to the oscahe database using Toad.  I just so confused why I set
docBase as local, Tomcat is working?

>
> >>The last thing I'd ask about your webapp is what the code looks like
> >>that is trying to grab a connection from the connection pool. Is it your
> >>own code? If so, post that. If you are using something like Hibernate,
> >>an O-R mapper, or some other DB framework, post the configuration for
> >>/that/ so we can see what the expected DataSource JNDI name is.
>

This application is not using Hibernate or any other OR mapper.  Just the
simple JDBC.  This is the code:

private void init() {

    /* Initialize the connection manager based upon the interface type */

    //OscLogger.debug("Initializing connection pool");
    Context ctx = null;

    // create parameter list to access naming system
    try {
        boolean isTomcatServer = config.getBoolean("isTomcatServer",false);
        //OscLogger.debug("ConnectionPool : "  + "inside  init()
isTomcatServer : "  + isTomcatServer);
        if(isTomcatServer==true){
            ctx = new InitialContext();
            DataSource ds =
(DataSource)ctx.lookup(config.getString("dbLookUp","java:comp/env/jdbc/test_DS"));
            this.setDs(ds);
        } else {// else it is a websphere server
            Properties parms = new java.util.Properties();
            parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
            // access naming system
            ctx = new InitialContext(parms);
            //OscLogger.debug("ConnectionPool : "  + "inside  init()
poolName is  : "  + poolName);
            // get DataSource factory object from naming system
            this.setDs((DataSource)
ctx.lookup("java:comp/env/"+this.poolName));
        }
        OscLogger.debug("Datasource : "+ds.toString());
        OscLogger.debug("New DB connection pool "+poolName+" created.");
    } catch (Exception ne) {
        OscLogger.error(new LogRecord(ErrorCode.UNEXPECTED,
BaseModule.DATABASE),
                new OscException("Unable to initialize connection pool -
"+this.poolName,ne));
    }finally {
        try {
            if(ctx!=null) {
            ctx.close();
            }
        } catch (Exception e) {
            // Handle Exception
            OscLogger.error(new LogRecord(ErrorCode.UNEXPECTED,
BaseModule.DATABASE),
                    new OscException("Error occured while closing the
initial context ",e));
            }
        }
}


>
> >>Finally, I wonder if upgrading to a newer level of Tomcat is an option.
> >>I see it's a legacy application, but the servlet API hasn't changed that
> >>dramatically over the years (other than adding features and
> >>tightening-down the specification of older ones). You might find that
> >>your webapp runs perfectly fine on Tomcat 6.0, and will receive better
> >>support from just about everyone. TC 4.1 just got its last update ever,
> >>and it's basically dead.
>

This application has to run on JDK 1.4.  My colleague told me we have to use
Tomcat 4, as Tomcat 5 requires JDK 1.5. Is that true?  I am more than happy
to switch to higher version of Tomcat.  Basically I only use Tomcat on local
for development, and we are using Websphere application server in
production.

Thanks so much Chris!

Jamez.


>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkqdPScACgkQ9CaO5/Lv0PDSqgCeL5A1lOEn1+MQtxwz1kXYfrzl
> IfEAn2Aq9tS22XgOgvxqiwkRujlWXnn8
> =X00F
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message