Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNDI exception when creating dataSource

 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have configured the following context tag for using a dataSource over JNDI,
this is added within the Host Tag in server.xml



And in my web application I add the following defintion



However initialization still fails and I get the Error



the enite trace is as follows



Sorry I forgot to add, its a spring web app, and I have the following addedthe applicationContext.xml



I am using Spring 2.5.4. Please help
[ July 31, 2008: Message edited by: Anadi Mishra ]
 
Jetendra Ivaturi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@PersistenceContext(unitName="datasourcename") private EntityManager manager;

Have you done this.
 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Not sure what you meant but I am not using an Entity Manager, I am using the HibernateTransactionManager in the application. The application runs on Tomcat 5.5.28.

The application persists POJOs which hold User, and Event information



As you can see i was earlier using the JndiObjectFacotryBean but then i used to get

 
Jetendra Ivaturi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh ok. I think am wrong. Not sure.
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context


Your JNDI name is "jdbc/webmeet" but "jdbc" is not bound to your context
 
Anadi Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Any specific way or configuration that i have to do to bind this 'jdbc' name? I have provided a Context definition and a resource ref definition in the web.xml. The reason for asking is that even if i use a name like wmAppDS i get the sane exception with wmAppDS replacing jdbc.

More I some how see that tomcats pooling restricts you to using javax.sql.DataSource only. For example if i use something like these



and the web xml res-type tag to



or even



It still fails. It only works if i keep res-type in the web.xml and the type attribute or resource tag in server.xml to javax.sql.DataSource, but then the logs show that C3P0 is not being used.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic