Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem when moving context from server.xml to web.xml

 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to move <context> element from server.xml to web.xml, so I can add new applications without restarting the server.

Everything works fine, my DB and all, until I move this entry:



As soon as I move this thing, and try to use my DB, I get the following error:

Error message: Cannot create JDBC driver of class '' for connect URL 'null'

My mysql connector is both in my /common/lib and my /WEB-INF/lib/, just to keep it safe. Also, to my web.xml I added these two entries:



I have no idea what the hell is wrong. Theoretically, I am not changing anything by simply copying <context> element, yet, it seems to stop working .
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a new ugly feature in Tomcat 5.xx When your web-application have been deployed, Resource reference created for each context, but this referrence have an empty value of URL and DriverClass name.

You have to describe an additional reference to Resource for each HOST and context. You can use Tomcat admin interface and repeat resource description from general section (Resources->Data Sources) in context related Tomcat (Server->Service->Host(yourhost)->Context(/sccm)->Resources->Data Sources). But you will have to repeat it after every deployment Another way is creation an additional web.xml file in folder "Tomcat 5.xx\conf\Catalina\yourhost\web.xml" with description of resource for your context like follow:

<Context displayName="CNTX" docBase="web" path="/web" workDir="work\Catalina\localhost\web">
<Resource auth="Container" description="" name="jdbc/license" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/license">
<parameter><name>url</name><value>jdbc:mysql://localhost:3306/licenses?autoReconnect=true</value></parameter>
<parameter><name>driverClassName</name><value>com.jdbc.mysql.Driver</value></parameter>
</ResourceParams>
</Context>
 
This is my favorite tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic