Database connectivity problem-Oracle
Hello techs,
Could anyone help me out to sort the below exception error.
Oracle Port: 8080 Tomcat Port : 8088
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
db.DAO.getConnection(DAO.java:38)
db.DAOQuery.register(DAOQuery.java:113)
actions.RegistrationAction.execute(RegistrationAct ion.java:58)
org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
The below coding might be helpful to resolve.
DAO Coding:
Code :
package db;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.lang.String;
import oracle.jdbc.pool.OracleDataSource;
import java.sql.*;
import java.util.Properties;
/**
*This class used to establish the connection between JdbcDriver and DataBase.
*DataSourceName will be created through URL.Connection will be
*created successfully next data will be inserted.Suppose
*connection can not be created then Exception occured.
*
*DriverManager class -- makes a connection with a driver
*/
public class DAO
{
public static Connection con = null;
public Connection getConnection(String path)
{
Properties property;
try
{
property = new Properties();
File f=new File(path);
FileInputStream filein=new FileInputStream(f);
property.load(filein);
String systemname = property.getProperty("SYSTEMNAME");
OracleDataSource ods=new OracleDataSource();
ods.setUser("SYSTEM");
ods.setPassword("REDHAT");
ods.setURL("jdbc:oracle:oci:system@"+systemname+":8088/XE");
con=ods.getConnection();
}
catch(SQLException e)
{
System.out.println("1");
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
return con;
}
public boolean returnConnection(Connection conn)
{
boolean status=true;
try
{
con.close();
}
catch(Exception e)
{
status=false;
}
return status;
}
}
Re: Database connectivity problem-Oracle
Sounds like you're missing oracle.jdbc.pool.OracleDataSource at runtime, place the appropriate jar file in your application server lib folder or include it with your app.
// Json
Re: Database connectivity problem-Oracle
Hi Json,,,,,
Ur knowledge sharing helped me to sort out the problem...
Thanks buddy!!!!!
Re: Database connectivity problem-Oracle
No worries, glad to help.
// Json