- This topic has 6 replies, 4 voices, and was last updated 20 years, 2 months ago by
kyrylkov.
-
AuthorPosts
-
good4evilMemberI am having trouble with my web app.
I have created a datasource using tomcats admin page. The datasource information was automatically inserted into the server.xml. I then added a refrence to the datasource into the application’s web.xml file.
I get the following error when trying to get a connection from the datasource
Cannot create JDBC driver of class ” for connect URL ‘null’.
The .jar for mysql is in tomcat’s classpath. I made sure of that by setting it up in the myeclipse prefrences of the application server.
Please help,
MarcMay 4, 2005 at 2:54 am #229059
kyrylkovMemberHaving JNDI config in server.xml is a bad idea.
If you are using Tomcat 5.5.x restore the old server.xml and create context.xml in META-INF directory with the following example contents:
<Context> <Resource name="jdbc/resourcename" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="user" password="pass" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://server.com:3306/database?autoReconnect=true" /> </Context>
You don’t need to have anything in web.xml for this to work.
May 4, 2005 at 10:07 am #229073
Riyad KallaMemberMoving to OT > Soft Dev, this is not ME related.
Additionally Marc, kyrylkov’s advice is a good one, makes your app very portable, easy to deploy. The context.xml file is also valid for Tomcat 5.0.x, but the format is a little different. For future compatibility I suggest using kyry’s suggestion and Tomcat 5.5.x
May 4, 2005 at 4:52 pm #229105
good4evilMemberDo i name the file context.xml?
also what is the syntax of the file for tomcat 5.0?
thanks,
marcMay 4, 2005 at 5:13 pm #229109
Riyad KallaMemberDo i name the file context.xml?
yes
also what is the syntax of the file for tomcat 5.0?
This is why god invented documentation: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
May 12, 2005 at 6:15 pm #229513
wendalMember@support-rkalla wrote:
Moving to OT > Soft Dev, this is not ME related.
Additionally Marc, kyrylkov’s advice is a good one, makes your app very portable, easy to deploy. The context.xml file is also valid for Tomcat 5.0.x, but the format is a little different. For future compatibility I suggest using kyry’s suggestion and Tomcat 5.5.x
Is this really portable to other Servlet Engines and Application Servers ?
(i.e. Resin, Jetty, JBoss, ..)
May 13, 2005 at 1:16 am #229519
kyrylkovMemberOf course each engine and AS has its own deployment/configuration rules/settings, but still it is better to keep the config files separate, rather than mix general server configs with your application settings.
Having context.xml for Tomcat allows you to delpoy your web application even if you don’t have permissions to edit server.xml on the server.
-
AuthorPosts