views:

1002

answers:

2

I have following situation:

  • I have a Maven war project in NetBeans 6.7
  • I added Tomcat 6.0 as a server, which I use to run this project
  • NetBeans itself creates context.xml file in META-INF directory, I added jdbc resources there, I am sure they are correct. The name is 'jdbc/defaultDS';
  • I checked in the target directory, context.xml file is copied correctly.
  • I use 'java:comp/env/jdbc/defaultDS' as JNDI location to access this data source.
  • When I run this project on Tomcat (no resources in conf/context.xml) I get exception:
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSource': Invocation of init method failed; 
nested exception is 
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

I have no clue as to what is happening, any help is appreciated.

A: 

Most probably netbeans starts tomcat with it's own configuration, to have projects integrated directly from netbeans.

Mercer Traieste
How can I make it use my configuration?
Ula Krukar
Haven't used tomcat integration in netbeans myself. I suppose you can define the datasource you are missing within some integration menu. I have doubts that you can convince netbeans to use your configuration and its configuration at the same time.
Mercer Traieste
A: 

As always, it was my mistake.

I was using different maven profile than I thought. As a result, I was using 'jdbc/defaultDS' instead of 'java:comp/env/jdbc/defaultDS' to access the data source :/

Note to self: triple check your project before blaming the IDE.

Ula Krukar