Ariela Carrera schrieb am 24.11.2008 um 09:40:40 (-0800):
> 1) The servlet loading problem happens when I startup Tomcat,
> manually, as I always do, showing the exception:
> 
> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
>     java.lang.ClassLoader.defineClass1(Native Method)
>     java.lang.ClassLoader.defineClass(ClassLoader.java:620)

That's like you find out your car has no wheels. You said you've
manipulated Tomcat's startup script. Don't do that. Make a clean install
and it should work.

> 2) When the first problem does not happen, the http session works
> unproperly, and some attributes of the session are made null, in this
> case, Tomcat throws the NullPointerException, but if I reload the jsp
> everything is ok.

This sounds like something in the session isn't properly initialized.
I'd say this is an error in your application.

> 2) About an earlier Tomcat: I just downloaded the 6.0.18 version and
> catalina.sh it's running ok (but I have not put my webapp there yet). 

Careful! :-)

> 3) About the db2 jdbc driver, well, it is allocated in many paths... 
> 
> JAVA_HOME/jdk/jre/lib/ext/db2jcc.jar

Placing the driver here makes it available to everything run via this
JVM, including Tomcat and your web applications.

> CATALINA_HOME/lib/db2jcc.jar

Placing the driver here makes it available to both Tomcat and all web
applications. It allows you to use the connection pool with this driver.

> CATALINA_HOME/webapps/cqaex/db2jcc.jar

Placing the driver here makes it available for download in the cqaex web
application.

> CATALINA_HOME/webapps/peerca/WEB-INF/lib/db2jcc.jar

Placing the driver here makes it available only to the web application
peerca. It is (a) redundant when the driver is already placed in
CATALINA_HOME/lib, and (b) won't allow you, on its own, to use the
connection pool. It only allows you to load the driver via the
DriverManager.

> DB2_HOME/V9.5/java/db2jcc.jar

This is probably the place of the driver in the DB2 distribution. Won't
hurt.

> ¿Can this cause troubles? Where exactly I need to put this file,
> taking into account I need driver be avalaible for other java
> aplications, not only for tomcat webapps?

If you want to think of Tomcat as independent of the JVM you run
it with, place the driver in "Tomcat6/lib" or reference it from
"Tomcat6/conf/catalina.properties".

> 5) About running Tomcat as root user: can this cause troubles too? Do
> I need to running it as the common user? What kind of properties
> (chmod) does the CATALINA_HOME need to work in many users without
> running as a root?

It's not considered good practice to have a service run as root when
there is no need to do so. The root user is very powerful, so it's
potentially dangerous expose a process run as root to the world.

Tomcat should probably be run as www-data or whatever it is called on
your system.

All permissions issues can be handled by using chmod and chown. I don't
know your particular situation, but it's unlikely you have to resort to
running Tomcat as root.

> I am not using any Eclipse, I just write manually my codes

Very good! So you don't lose the ground under your feet.

> Now I just try with the 6.0.18 and I will put my webapp there. The
> only error is with DB2 connections, although the session has the
> connection, this is not null but when i tried to list the tables some
> error happens:
> ------------------
> com.ibm.db2.jcc.b.nm: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704,
> SQLERRMC=DB2INST1.AM_BASE_TASKS, DRIVER=3.50.152

Sounds like an SQL error to me. Look it up in your IBM manual.

>         at com.ibm.db2.jcc.b.wc.a(wc.java:579)
>         at com.ibm.db2.jcc.b.wc.a(wc.java:57)
>         at com.ibm.db2.jcc.b.wc.a(wc.java:126)

Reasonable package names. Got to get an IBM database, too.

>         at java.lang.Thread.run(Thread.java:619)
> -----------
> and this error did not happen in the older version... any ideas? Where
> the db2jcc.jar needs to be, to be available for all my applications in
> java (not only in Tomcat).

Read this:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200811.mbox/[EMAIL 
PROTECTED]

Short answer for Tomcat 6: Either put the driver in $Tomcat/lib, or add
it to the "common.loader" in "conf/catalina.properties".

> The idea I have is to create a pool of connections. I read the concept
> but now I need to implement it. Is Tomcat deal with the pool or I need
> to ask help in DB2 forums ?

It'll probably work the same way as for other database servers. In order
for this to work, both Tomcat and your webapp need to be able to see the
driver.

I hope this helps.

Michael Ludwig

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to