[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to configure a JNDI to get results in the jsp page?

Posted on 2011-10-24
4
Medium Priority
?
441 Views
Last Modified: 2012-05-12
I tried to configure the files to get a jdbc connection from jsp to rertieve data and i get the following errors. Can you help me why ....

exception

javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)"
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
      org.apache.jsp.test.newjsp_jsp._jspService(newjsp_jsp.java:103)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)"
      org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:308)
      org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:192)
      org.apache.jsp.test.newjsp_jsp._jspx_meth_sql_005fquery_005f0(newjsp_jsp.java:124)
      org.apache.jsp.test.newjsp_jsp._jspService(newjsp_jsp.java:78)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


check the attachment  for the source code


Can you help me on how to get access to the database and retrieve the data by using the jndi configuration ...
0
Comment
Question by:semltd
  • 2
4 Comments
 
LVL 2

Expert Comment

by:DataCruncher
ID: 37018459
I can't see the source code attached to your question, could you post it again?

Also, could you confirm your web server (tomcat? which version?) and datase used (mysql?)
0
 
LVL 27

Assisted Solution

by:mrcoffee365
mrcoffee365 earned 200 total points
ID: 37019227
Googled your error message, and found one person who had this problem and fixed it with a configuration change:

You have to add following line to your $TOMCAT-CONFIG/policy.d/04webapps.policy

permission java.net.SocketPermission "127.0.0.1:3306", "connect";

However -- you should still post your code and configuration.  The above fix assumes Tomcat 6 and MySQL 5 on Unix.  YMMV
0
 

Accepted Solution

by:
semltd earned 0 total points
ID: 37022565
the problem was somewhere else ....  It was the jdbc connection Thank you that you try to help me anyway
0
 

Author Closing Comment

by:semltd
ID: 37049348
I trouble shoot and find the solution by myself
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month18 days, 17 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question