Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring MVC JNDI Connection pool error please help me

 
Srihari Goud
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please please help me.. am getting error while creating JNDI connection pool..
my error is:
SEVERE: Servlet /empSearch_id_name threw load() exception
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context


my code:

server.xml
--------------------
<Resource name="jdbc/practice"
global="jdbc/practice"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/practice"
username="root"
password="root123"

maxActive="100"
maxIdle="20"
minIdle="5"
maxWait="10000"/>

contex.xml
----------------------
<ResourceLink name="jdbc/practice"
global="jdbc/practice"
auth="Container"
type="javax.sql.DataSource" />

applicationContex.xml
--------------------
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dbDataSource" ref="dbDataSource" />
</bean>
------------------------
daoImpl

public class EmpDAOImpl implements EmpDAO{

@Autowired
private SessionFactory sessionfactory;

@Autowired
@Qualifier("dbDataSource")
private DataSource dataSource;
public void addEmp(Employee e) {

this.sessionfactory.getCurrentSession().save(e);

}

web.xml
--------------
<resource-ref>
<description>MySQL Datasource example</description>
<res-ref-name>java:comp/env/jdbc/practice</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your resource link is not properly set up for your webapp context. What jndi resources have you defined in your application server ? What app server are you using ?

 
Srihari Goud
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you please tell me where to change code?
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What jndi resources have you defined in your application server ? What app server are you using ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic