Re: tomcat server start up without looking dependency jars
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ahmed, On 12/5/2009 7:17 AM, ahmed kasim wrote: I have few jars which need to get loaded only when the war file is getting loaded or when the request comes, to be more clear I have some jar which is having connection to DB, if I specify in my context.xml file it is getting loaded when the server getting started up initially, so I want to avoid this and make it when my war file gets loaded the db connection should get loaded. Resource name=jdbc/DB2DS auth=Container type=javax.sql.DataSource driverClassName=com.ibm.db2.jcc.DB2Driver url=jdbc:db2://localhost:5/SPARK username=db2admin password=d...@dmin maxActive=20 maxIdle=10 maxWait=-1/ So, this resource is being specified in context.xml? Which one? If it's conf/context.xml then it's the default configuration for all contexts, including ROOT, which is (nearly) always deployed, so you should expect your database connection to be established whether you have deployed your webapp or not. If you've placed that Resource definition in your webapp's META-INF/context.xml file, then the resource should not be created until webapp deployment. I have three jar file specified for Resource What does this mean? Resource elements do not reference JAR files directly. if i place jar file Where? it is getting loaded and server starts up looking for connection with db. What is getting loaded? The JAR file or the context.xml file? How can I avoid server starting time look up and make it available only when I deploy the war file. Make sure your Resource definition is in your webapp's private context.xml file. The location of the JAR file should be in $CATALINA_HOME/lib for Tomcat 6.0, which I presume you are using. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkselskACgkQ9CaO5/Lv0PDB3gCgps+AvNnwyKzfxvewxFVnnp4H vqYAnjII5yNrUyiToUUnDDPrbFsZOojp =68c3 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat server start up without looking dependency jars
On 06/12/2009 17:10, ahmed kasim wrote: Hi thanks a lot for your response and valuable inputs. I want to avoid looking of that classes during server startup, my requirement is, specified classes/properties should lookup only when my war file deployed. If the app is not deployed before start up, then it gets deployed at the end of start up. Any classes (and the classes they are dependant on) defined in web.xml as Servlets, for example, will also be loaded. Why do you have such a requirement? p many thanks, Kasim From: Jorge Medinacerebrotecnolog...@gmail.com To: Tomcat Users Listusers@tomcat.apache.org Sent: Sat, December 5, 2009 8:03:30 PM Subject: Re: tomcat server start up without looking dependency jars hi Ahmed, JAR files are not loaded by Tomcat. A jar file is just a container of classes, the classes are loaded by the JVM when the code makes reference to them. If you specify aResource on your context.xml, then Tomcat will look for those classes (the driverClassName), but that does not mean that a connection to the database is established at that point in time. It only means that the driver has been loaded. Your application is responsible to ask for a connection whenever it wishes. On Sat, Dec 5, 2009 at 7:17 AM, ahmed kasimcallka...@yahoo.com wrote: Hi, I have few jars which need to get loaded only when the war file is getting loaded or when the request comes, to be more clear I have some jar which is having connection to DB, if I specify in my context.xml file it is getting loaded when the server getting started up initially, so I want to avoid this and make it when my war file gets loaded the db connection should get loaded. Resource name=jdbc/DB2DS auth=Container type=javax.sql.DataSource driverClassName=com.ibm.db2.jcc.DB2Driver url=jdbc:db2://localhost:5/SPARK username=db2admin password=d...@dmin maxActive=20 maxIdle=10 maxWait=-1/ I have three jar file specified for Resource , if i place jar file it is getting loaded and server starts up looking for connection with db. How can I avoid server starting time look up and make it available only when I deploy the war file. many thanks, Kasim - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat server start up without looking dependency jars
Hi thanks a lot for your response and valuable inputs. I want to avoid looking of that classes during server startup, my requirement is, specified classes/properties should lookup only when my war file deployed. many thanks, Kasim From: Jorge Medina cerebrotecnolog...@gmail.com To: Tomcat Users List users@tomcat.apache.org Sent: Sat, December 5, 2009 8:03:30 PM Subject: Re: tomcat server start up without looking dependency jars hi Ahmed, JAR files are not loaded by Tomcat. A jar file is just a container of classes, the classes are loaded by the JVM when the code makes reference to them. If you specify a Resource on your context.xml, then Tomcat will look for those classes (the driverClassName), but that does not mean that a connection to the database is established at that point in time. It only means that the driver has been loaded. Your application is responsible to ask for a connection whenever it wishes. On Sat, Dec 5, 2009 at 7:17 AM, ahmed kasim callka...@yahoo.com wrote: Hi, I have few jars which need to get loaded only when the war file is getting loaded or when the request comes, to be more clear I have some jar which is having connection to DB, if I specify in my context.xml file it is getting loaded when the server getting started up initially, so I want to avoid this and make it when my war file gets loaded the db connection should get loaded. Resource name=jdbc/DB2DS auth=Container type=javax.sql.DataSource driverClassName=com.ibm.db2.jcc.DB2Driver url=jdbc:db2://localhost:5/SPARK username=db2admin password=d...@dmin maxActive=20 maxIdle=10 maxWait=-1/ I have three jar file specified for Resource , if i place jar file it is getting loaded and server starts up looking for connection with db. How can I avoid server starting time look up and make it available only when I deploy the war file. many thanks, Kasim
Re: tomcat server start up without looking dependency jars
hi Ahmed, JAR files are not loaded by Tomcat. A jar file is just a container of classes, the classes are loaded by the JVM when the code makes reference to them. If you specify a Resource on your context.xml, then Tomcat will look for those classes (the driverClassName), but that does not mean that a connection to the database is established at that point in time. It only means that the driver has been loaded. Your application is responsible to ask for a connection whenever it wishes. On Sat, Dec 5, 2009 at 7:17 AM, ahmed kasim callka...@yahoo.com wrote: Hi, I have few jars which need to get loaded only when the war file is getting loaded or when the request comes, to be more clear I have some jar which is having connection to DB, if I specify in my context.xml file it is getting loaded when the server getting started up initially, so I want to avoid this and make it when my war file gets loaded the db connection should get loaded. Resource name=jdbc/DB2DS auth=Container type=javax.sql.DataSource driverClassName=com.ibm.db2.jcc.DB2Driver url=jdbc:db2://localhost:5/SPARK username=db2admin password=d...@dmin maxActive=20 maxIdle=10 maxWait=-1/ I have three jar file specified for Resource , if i place jar file it is getting loaded and server starts up looking for connection with db. How can I avoid server starting time look up and make it available only when I deploy the war file. many thanks, Kasim